Skip to content

Commit

Permalink
Add expressions to bnf.
Browse files Browse the repository at this point in the history
  • Loading branch information
Weltraumschaf committed Feb 9, 2013
1 parent 60e7c65 commit 934f1bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/grammar.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,15 @@ var-declaration : var-keyword '{' EOL [ identifier | declaration { identifi
const-declaration : const-keyword '{' EOL [ identifier | declaration { identifier | declaration } ] EOL '}' .
function-declaration : function-keyword '(' [ identifier { ',' identifier } ] ')' '{' EOL function-body EOL '}' .
function-body : [ var-declaration | const-declaration { var-declaration | const-declaration } ] .

binary-op = "||" | "&&" | rel_op | add_op | mul_op .
rel-op = "==" | "!=" | "<" | "<=" | ">" | ">=" .
add-op = "+" | "-" | "|" | "^" .
mul-op = "*" | "/" | "%" | "<<" | ">>" | "&" .
unary-op = "+" | "-" | "!" | "^" .

expression : term | expression add-op term .
term : factor | term mul-op factor .
factor : const | var | expression .
var : identifier .
const : identifier | value .

0 comments on commit 934f1bb

Please sign in to comment.