mirror of
https://github.com/github/semantic.git
synced 2024-11-25 02:58:36 +03:00
31 lines
629 B
Markdown
31 lines
629 B
Markdown
|
# Semantic Core grammar
|
||
|
|
||
|
This is an EBNF grammar for the (experimental) core IR language.
|
||
|
|
||
|
```
|
||
|
expr ::= expr '.' expr
|
||
|
| expr ' '+ expr
|
||
|
| '{' expr (';' expr)* ';'? '}'
|
||
|
| 'if' expr 'then' expr 'else' expr
|
||
|
| ('lexical' | 'import' | 'load') expr
|
||
|
| lit
|
||
|
| 'let'? lvalue '=' expr
|
||
|
| '(' expr ')'
|
||
|
|
||
|
lvalue ::= ident
|
||
|
| parens expr
|
||
|
|
||
|
lit ::= '#true'
|
||
|
| '#false'
|
||
|
| 'unit'
|
||
|
| 'frame'
|
||
|
| lambda
|
||
|
| ident
|
||
|
|
||
|
lambda ::= ('λ' | '\') ident ('->' | '→') expr
|
||
|
|
||
|
ident ::= [A-z_] ([A-z0-9_])*
|
||
|
| '#{' [^{}]+ '}'
|
||
|
| '"' [^"]+ '"'
|
||
|
```
|