We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Below are two grammars.
In this grammar, semantic predicates do "work". I.e. if they are false, rules don't match and if they are true, rules do match:
parser grammar MyParser; options { tokenVocab=MyLexer; } expr : term | expr asterisk expr (asterisk expr)* | expr plus expr (plus expr)* ; plus: {_input.LT(1).getText().equals("+")}? SPECID; asterisk: {_input.LT(1).getText().equals("*")}? SPECID; term : ALNUMID | STRID | LPAREN expr RPAREN ;
and in this grammar, semantic predicates don't work. I.e. if they are false, rules still match bu error is printed.
expr : add | mult | term ; mult : term (asterisk) term ((asterisk) term)* ; add : (term|mult) plus (term|mult) (plus (term|mult))* ; plus: {_input.LT(1).getText().equals("+")}? SPECID; asterisk: {_input.LT(1).getText().equals("*")}? SPECID; term : ALNUMID | STRID | LPAREN expr RPAREN ;
In both cases I am trying to run simple tests to parse 2 + 2 and 2 * 2.
Is it possible to understand beforehand, will definition work or not? What is the logic here?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Below are two grammars.
In this grammar, semantic predicates do "work". I.e. if they are false, rules don't match and if they are true, rules do match:
and in this grammar, semantic predicates don't work. I.e. if they are false, rules still match bu error is printed.
In both cases I am trying to run simple tests to parse 2 + 2 and 2 * 2.
Is it possible to understand beforehand, will definition work or not? What is the logic here?
The text was updated successfully, but these errors were encountered: