infix-to-egg-alejandrolf
v1.0.2
Published
```Yacc
Downloads
3
Readme
IGG (Infix EGG)
Grammar
expressions: (declaration | expression) (';' declaration | expression)*
declaration: 'var' WORD
| 'var' WORD '=' expression
expression: or
or: and ('||' and)*
and: comparison ('&&' comparison)*
comparison: assign (COMP_OP assign)?
assign: sum ('=' assign)?
sum: product (ADD_OP product)*
product: factor (MUL_OP factor)*
factor: '(' expression ')'
| STRING
| NUMBER
| apply
apply: WORD
| 'if' '(' expression ')' scopedExpressions ('else' scopedExpressions)?
| ('while' | 'fun' | 'method') '(' expression ')' scopedExpressions
| WORD ('.' WORD | '(' expressionList ')')+
expressionList: (expression (COMMA expression)*)?
scopedExpressions: expression
| '{' expressions '}'
WHITES = /^(\s|[#].*|\/\*(.|\n)*?\*\/)*/;
STRING = /^"((?:[^"\\]|\\.)*)"/;
NUMBER = /^([-+]?\d*\.?\d+([eE][-+]?\d+)?)/;
WORD = /[^\\s(),;\\[\\]{}"\\:\\.]+|\\.\\.\\.[^\\s(),\\[\\]{}"\\:\\.]+/;
COMP_OP = /[<>]=?|[!=]=/;
ADD_OP = /[+-]/;
MUL_OP = /[*\/]/;
COMMA = /[,\:]/;