lives-group / APEG

2 stars 0 forks source link

Interpreter unexpected behavior #37

Open tassilucas opened 2 years ago

tassilucas commented 2 years ago

The following APEG grammar is fully consumed by the interpreter but the status received is rejected (which should've be accepted):

apeg exprdeclaration;

prog[language g]: ops<g, n> {x={| #n |};} (',' ops<g, n1> {x={| #x / #n1 |};})*
                  ' : ' {g = g << {| op[language g]: #x ; |};} var<g> ;

ops[language g] returns `s`: s='+' / s='-' / s='*' ;

var[language g]: a..z+ ' = ' expression<g> ';' ;                                              

expression[language g]: factor<g> op<g> expression<g> /                                       
                        factor<g> ;                                                           

factor[language g]: 0..9+ / a..z+ ;

op[language g]: {? false };

and an input example could be:

+,-,* : x = 10+20*30;

This grammar can also be found on the interpreter tests package.