Add intended grammar for expression syntax
This commit is contained in:
parent
9e1ef93990
commit
6ac4a512c2
1 changed files with 10 additions and 0 deletions
10
expr_grammar
Normal file
10
expr_grammar
Normal file
|
@ -0,0 +1,10 @@
|
|||
expression -> equality ;
|
||||
equality -> comparison ( ( "!=" | "==" ) comparison )* ;
|
||||
comparison -> term ( ( ">" | ">=" | "<" | "<=" ) term )* ;
|
||||
term -> factor ( ( "-" | "+" ) factor )* ;
|
||||
factor -> exponent ( ( "/" | "*" | "/." | "/_" | "%" | "/%" ) exponent )* ;
|
||||
exponent -> unary ( ( "**" ) unary )* ;
|
||||
unary -> ( "!" | "-" ) unary
|
||||
| primary ;
|
||||
primary -> NUMBER | STRING | "true" | "false" | "nil"
|
||||
| "(" expression ")" ;
|
Loading…
Add table
Reference in a new issue