Added partial draft of grammar doc
This commit is contained in:
parent
36a7b4dba3
commit
3fbe0f482f
33
grammar.txt
Normal file
33
grammar.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
expression ->
|
||||||
|
| literal
|
||||||
|
// | IDENTIFIER
|
||||||
|
// | sequence
|
||||||
|
| unary
|
||||||
|
| binary
|
||||||
|
// | let
|
||||||
|
// | when
|
||||||
|
| if
|
||||||
|
| variant
|
||||||
|
| record
|
||||||
|
| list
|
||||||
|
| field
|
||||||
|
| index
|
||||||
|
| grouping ;
|
||||||
|
|
||||||
|
literal -> NUMBER | STRING ;
|
||||||
|
grouping -> "(" expression ")" ;
|
||||||
|
unary -> ( "-" | "!" ) expression ;
|
||||||
|
binary -> expression operator expression ;
|
||||||
|
operator ->
|
||||||
|
| "==" | "!=" | "<" | "<=" | ">" | ">="
|
||||||
|
| "+" | "-" | "*" | "/"
|
||||||
|
| "|>" | "<|" | ">>" | "<<"
|
||||||
|
| "++" ;
|
||||||
|
if -> "if" expression "then" expression "else" expression ;
|
||||||
|
variant -> "`" IDENTIFIER ( "(" ( expression ( "," expression)* )? ")" )? ;
|
||||||
|
record ->
|
||||||
|
"{" ( IDENTIFIER "=" expression ( "," IDENTIFIER "=" expression )* )? "}" ;
|
||||||
|
list -> "[" ( expression ( "," expression )* )? "]" ;
|
||||||
|
field -> expression "." identifier ;
|
||||||
|
index -> expression "[" expression "]" ;
|
||||||
|
grouping -> "(" expression ")" ;
|
Loading…
Reference in New Issue
Block a user