} // NT_SimpleExpr private static void NT_Term(out Expr t) { Expr f = null; SrcPos sp = null; BinaryOperator.Operation binOp = BinaryOperator.Operation.undefOp; t = null; for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_NotFact(out f); break; case 2: // SEM t = f; break; case 3: // SEM binOp = BinaryOperator.Operation.mulOp; sp = new SrcPos(); break; case 4: // SEM binOp = BinaryOperator.Operation.divOp; sp = new SrcPos(); break; case 5: // SEM binOp = BinaryOperator.Operation.modOp; sp = new SrcPos(); break; case 6: NT_NotFact(out f); break; case 7: // SEM t = new BinaryOperator(sp, binOp, t, f); break; } // switch } // for } // NT_Term
} // NT_OrExpr private static void NT_AndExpr(out Expr ae) { Expr re = null; SrcPos sp = null; BinaryOperator.Operation binOp = BinaryOperator.Operation.undefOp; ae = null; for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_RelExpr(out re); break; case 2: // SEM ae = re; break; case 3: // SEM binOp = BinaryOperator.Operation.andOp; sp = new SrcPos(); break; case 4: NT_RelExpr(out re); break; case 5: // SEM ae = new BinaryOperator(sp, binOp, ae, re); break; } // switch } // for } // NT_AndExpr
} // NT_Expr private static void NT_OrExpr(out Expr oe) { Expr ae = null; SrcPos sp = null; BinaryOperator.Operation binOp = BinaryOperator.Operation.undefOp; oe = null; for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_AndExpr(out ae); break; case 2: // SEM oe = ae; break; case 3: // SEM binOp = BinaryOperator.Operation.orOp; sp = new SrcPos(); break; case 4: NT_AndExpr(out ae); break; case 5: // SEM oe = new BinaryOperator(sp, binOp, oe, ae); break; } // switch } // for } // NT_OrExpr
} // NT_RelExpr private static void NT_SimpleExpr(out Expr se) { Expr t = null; SrcPos sp = null; UnaryOperator.Operation unOp = UnaryOperator.Operation.undefOp; BinaryOperator.Operation binOp = BinaryOperator.Operation.undefOp; se = null; for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: // SEM unOp = UnaryOperator.Operation.posOp; sp = new SrcPos(); break; case 2: // SEM unOp = UnaryOperator.Operation.negOp; sp = new SrcPos(); break; case 3: NT_Term(out t); break; case 4: // SEM if (unOp != UnaryOperator.Operation.undefOp) { se = new UnaryOperator(sp, unOp, t); } else { se = t; } break; case 5: // SEM binOp = BinaryOperator.Operation.addOp; sp = new SrcPos(); break; case 6: // SEM binOp = BinaryOperator.Operation.subOp; sp = new SrcPos(); break; case 7: NT_Term(out t); break; case 8: // SEM se = new BinaryOperator(sp, binOp, se, t); break; } // switch } // for } // NT_SimpleExpr
} // NT_AndExpr private static void NT_RelExpr(out Expr re) { Expr se = null; SrcPos sp = null; BinaryOperator.Operation binOp = BinaryOperator.Operation.undefOp; re = null; for (;;) { switch (Syn.Interpret()) { case 0: return; case 1: NT_SimpleExpr(out se); break; case 2: // SEM re = se; break; case 3: // SEM binOp = BinaryOperator.Operation.eqOp; sp = new SrcPos(); break; case 4: // SEM binOp = BinaryOperator.Operation.neOp; sp = new SrcPos(); break; case 5: // SEM binOp = BinaryOperator.Operation.ltOp; sp = new SrcPos(); break; case 6: // SEM binOp = BinaryOperator.Operation.leOp; sp = new SrcPos(); break; case 7: // SEM binOp = BinaryOperator.Operation.gtOp; sp = new SrcPos(); break; case 8: // SEM binOp = BinaryOperator.Operation.geOp; sp = new SrcPos(); break; case 9: NT_SimpleExpr(out se); break; case 10: // SEM re = new BinaryOperator(sp, binOp, re, se); break; } // switch } // for } // NT_RelExpr