34 lines
807 B
Plaintext
34 lines
807 B
Plaintext
|
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 ")" ;
|