28 lines
638 B
Plaintext
28 lines
638 B
Plaintext
|
|
|
|
<program> := <statements> EOF
|
|
|
|
<statements> := <statement>
|
|
| <statement> SEP <statements>
|
|
|
|
<statement> := let <id> = <expr>
|
|
| <expr>
|
|
|
|
<expr> := if <expr> then <statements> end
|
|
| if <expr> then <statements> else <statements> end
|
|
| while <expr> SEP <statements> end
|
|
| <simple_expr>
|
|
|
|
<simple_expr> := <id>
|
|
| <number>
|
|
| <string>
|
|
|
|
|
|
/* actual grammar encoded in program */
|
|
|
|
<program> := <statements> EOF
|
|
<statements> := <statement> | <statement> SEP <statements>
|
|
<let_expression> := let <identifier> = <rhs>
|
|
<rhs> := <num_literal> | <str_literal> | <identifier>
|
|
|