-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
This is a starting point but it would be nice to accurately define the grammar, and generate a railroad diagram for the manual.
Program ::= ( FunctionDecl | VarDecl )*
Identifier ::= [a-fA-F_] [0-9a-fA-F_]*
Number ::= [0-9]+
Expression ::= Identifier
| Number
| FunctionCall
ExpressionList ::= Expression ( ',' Expression )*
VarDecl ::= 'var' Identifier ( '=' Number )?
ArgDeclList ::= Identifier ( ',' Identifier )+
FunctionCall ::= Identifier '(' ExpressionList? ')'
FunctionDecl ::= 'function' Identifier '(' ArgDeclList? ')' ( Statement )* 'end'
IfStatement ::= 'if' '(' Expression ')' ( Statement )* 'end'
WhileStatement ::= 'while' '(' Expression ')' ( Statement )* 'end'
Statement ::= ( 'return' Expression )
| IfStatement
| WhileStatement
| VarDecl
| FunctionCall