nonterminal ParseNode compare;
nonterminal ParseNode expr;
-nonterminal ParseNode operator;
+nonterminal ParseNode addsuboperator;
+nonterminal ParseNode multdivoperator;
RESULT = relation.getRoot();
:}
- | expr:expr1 operator:operator expr:expr2
+ | expr:expr1 addsuboperator:operator expr:expr2
{:
debugMessage(PRODSTRING);
ParseNode op = (new ParseNode("expr", parser.curLine(3))).addChild("operator");
op.addChild("right", parser.curLine(1)).addChild(expr2);
RESULT = op.getRoot();
:}
-
+ %prec ADD
+ | expr:expr1 multdivoperator:operator expr:expr2
+ {:
+ debugMessage(PRODSTRING);
+ ParseNode op = (new ParseNode("expr", parser.curLine(3))).addChild("operator");
+ op.addChild("op").addChild(operator);
+ op.addChild("left", parser.curLine(3)).addChild(expr1);
+ op.addChild("right", parser.curLine(1)).addChild(expr2);
+ RESULT = op.getRoot();
+ :}
+ %prec MULT
| SIZEOF OPENPAREN setexpr:setexpr CLOSEPAREN
{:
ParseNode sizeof = (new ParseNode("expr", parser.curLine(4))).addChild("sizeof");
:}
;
-operator ::=
+addsuboperator ::=
ADD
{:
debugMessage(PRODSTRING);
RESULT = new ParseNode("sub", parser.curLine(1));
:}
-
- | MULT
+ ;
+multdivoperator ::=
+ MULT
{:
debugMessage(PRODSTRING);
RESULT = new ParseNode("mult", parser.curLine(1));
:}
-
| DIV
{:
debugMessage(PRODSTRING);
VarDescriptor newset=VarDescriptor.makeNew("newset");
writer.addDeclaration("struct SimpleHash *",newset.getSafeSymbol());
- writer.outputline(newset.getSafeSymbol()+"=SimpleHashimageSet("+rd.getSafeSymbol()+"_hash, "+keyvd.getSafeSymbol()+", &"+tmpvar.getSafeSymbol()+");");
+ writer.outputline(newset.getSafeSymbol()+"=SimpleHashimageSet("+rd.getSafeSymbol()+"_hash, "+keyvd.getSafeSymbol()+");");
VarDescriptor itvd2=VarDescriptor.makeNew("iterator");
writer.addDeclaration("struct SimpleIterator",itvd2.getSafeSymbol());