Reputation:
Following code gives "IFST2 rule is useless due to conficts" error. I am trying to print different things for if part of if and if/else blocks. How can I do this?
IFST1:IF {printf("if begin");};
IFST2:IF {printf("ifelse begin");};
ELSEST:ELSE {};
singlestatement:
'{' statement '}';
|
IFST1 '(' expr ')' singlestatement ELSEST singlestatement {};
|
IFST2 '(' expr ')' singlestatement %prec IFX {};
Upvotes: 0
Views: 316
Reputation: 1728
Check this for a general help on the issue. I think you'll have to "specialize" your case to match the general form. Though this is bison, not YACC, both are LALR parser generators.
Upvotes: 1