Initial commit
[jwcc.git] / grammar.txt
CommitLineData
933e60e3
JW
1GLOBAL := ( FUNCTION | VARIABLE )*
2FUNCTION := TYPE MODIFIERS _IDENTIFIER ARGSLIST ( ';' | STMTLIST )
3TYPE := 'int'
4MODIFIERS := '*'*
5ARGSLIST := '(' [ TYPE _IDENTIFIER ( ',' TYPE _IDENTIFIER)]* ] ')'
6STMTLIST := '{' ( VARIABLE | STATEMENT | STMTLIST )* '}'
7VARIABLE := TYPE MODIFIERS _IDENTIFIER [ = EXPRESSION ] ';'
8STATEMENT := ( ';' | EXPRESSION ';' | WHILE | IF | RETURN )
9WHILE := 'while' '(' EXPRESSION ')' CHUNK
10IF := 'if' '(' EXPRESSION ')' CHUNK
11RETURN := 'return' EXPRESSION ';'
12CHUNK := ( STMTLIST | STATEMENT )
13EXPRESSION := P13EXPR
14P13EXPR := P6EXPR ( '=' P6EXPR )*
15P6EXPR := P5EXPR ( '==' P5EXPR )*
16P5EXPR := P3EXPR ( ( '<' | '>' ) P3EXPR )*
17P3EXPR := P2EXPR ( ( '+' | '-' ) P2EXPR )*
18P2EXPR := _NUMBER ( ( '*' | '/' ) _NUMBER )*
This page took 0.017619 seconds and 4 git commands to generate.