Finished specifying record grammar
This commit is contained in:
parent
c0767bc386
commit
e508d06b1a
@ -8,10 +8,9 @@ expression ->
|
|||||||
| control
|
| control
|
||||||
| field
|
| field
|
||||||
| index
|
| index
|
||||||
// | identifier
|
| identifier
|
||||||
| primary
|
| primary
|
||||||
|
|
||||||
identifier -> IDENTIFIER | "@" STRING ;
|
|
||||||
grouping -> "(" expression ")" ;
|
grouping -> "(" expression ")" ;
|
||||||
unary -> ( "-" | "!" ) expression ;
|
unary -> ( "-" | "!" ) expression ;
|
||||||
binary -> expression operator expression ;
|
binary -> expression operator expression ;
|
||||||
@ -26,9 +25,11 @@ control ->
|
|||||||
if -> "if" expression "then" expression "else" expression ;
|
if -> "if" expression "then" expression "else" expression ;
|
||||||
compound -> variant | record | list ;
|
compound -> variant | record | list ;
|
||||||
variant -> "`" identifier ( "(" ( expression ( "," expression)* )? ")" )? ;
|
variant -> "`" identifier ( "(" ( expression ( "," expression)* )? ")" )? ;
|
||||||
|
base_record -> expression ( "with" identifier "=" expression ( "," "with" identifier "=" expression )* )?
|
||||||
record ->
|
record ->
|
||||||
"{" ( identifier "=" expression ( "," identifier "=" expression )* )? "}" ;
|
"{" ( identifier ("=" expression)? ( "," identifier ("=" expression)? )* )? ( "|" base_record )* "}" ;
|
||||||
list -> "[" ( expression ( "," expression )* )? "]" ;
|
list -> "[" ( expression ( "," expression )* )? "]" ;
|
||||||
field -> expression "." identifier ;
|
field -> expression "." identifier ;
|
||||||
index -> expression "[" expression "]" ;
|
index -> expression "[" expression "]" ;
|
||||||
primary -> NUMBER | STRING | "(" expression ")" ;
|
identifier -> IDENTIFIER | "@" STRING ;
|
||||||
|
primary -> NUMBER | STRING | identifier | "(" expression ")" ;
|
||||||
|
Loading…
Reference in New Issue
Block a user