schala/Grammar

32 lines
633 B
Plaintext
Raw Normal View History

<program> := <statements> EOF
<statements> := <statement>
| <statement> SEP <statements>
<statement> := let <id> = <expr>
| <expr>
| <fn_block>
<fn_block> := fn <id> ( <arg_list> ) <statements> end
<arg_list> := e
2015-08-08 17:58:51 -07:00
| <id>
| <id> , <arg_list>
<expr> := if <expr> then <statements> end
| if <expr> then <statements> else <statements> end
| while <expr> SEP <statements> end
2015-07-26 01:54:55 -07:00
| ( <expr> )
| <binop>
<binop> := <simple_expr>
| <simple_expr> <id> <binop>
2015-07-25 17:43:44 -07:00
<simple_expr> := <id>
| <number>
| <string>