| 1 |
Generating a parser starts with creating a bnf file. |
| 2 |
We have created an example.bnf file to illustrate this. |
| 3 |
Running gen.sh will generate the parser, scanner and token code |
| 4 |
needed to parse the language. |
| 5 |
|
| 6 |
The ast (abstract syntax tree) package needs to created by the user. |
| 7 |
This package should contain the corresponding function calls |
| 8 |
required by the syntax directed translation rules. |
| 9 |
See the example/ast package we have created. |
| 10 |
|
| 11 |
Parsing a string with the generated code and evaluating the ast is |
| 12 |
shown in example/example_test.go with some corresponding tests. |