2019-06-04 17:55:37 +03:00
|
|
|
# Semantic Core grammar
|
|
|
|
|
|
|
|
This is an EBNF grammar for the (experimental) core IR language.
|
|
|
|
|
|
|
|
```
|
2019-06-04 21:19:12 +03:00
|
|
|
expr ::= expr '.' expr
|
|
|
|
| expr ' '+ expr
|
|
|
|
| '{' expr (';' expr)* ';'? '}'
|
|
|
|
| 'if' expr 'then' expr 'else' expr
|
|
|
|
| ('lexical' | 'import' | 'load') expr
|
|
|
|
| lit
|
|
|
|
| 'let'? lvalue '=' expr
|
|
|
|
| '(' expr ')'
|
2019-06-04 17:55:37 +03:00
|
|
|
|
2019-06-04 21:19:12 +03:00
|
|
|
lvalue ::= ident
|
|
|
|
| parens expr
|
2019-06-04 17:55:37 +03:00
|
|
|
|
2019-06-04 21:19:12 +03:00
|
|
|
lit ::= '#true'
|
|
|
|
| '#false'
|
|
|
|
| 'unit'
|
|
|
|
| 'frame'
|
|
|
|
| lambda
|
|
|
|
| ident
|
2019-06-04 17:55:37 +03:00
|
|
|
|
2019-06-04 21:19:12 +03:00
|
|
|
lambda ::= ('λ' | '\') ident ('->' | '→') expr
|
2019-06-04 17:55:37 +03:00
|
|
|
|
2019-06-04 21:19:12 +03:00
|
|
|
ident ::= [A-z_] ([A-z0-9_])*
|
|
|
|
| '#{' [^{}]+ '}'
|
|
|
|
| '"' [^"]+ '"'
|
|
|
|
```
|