void ALELA() { List <AST> liste = new List <AST>(); List <AST> elist = new List <AST>(); AST e; SymDeclaring e1 = null; AST idval; DECL(out e); liste.Add(e); while (StartOf(1)) { DECL(out e); liste.Add(e); } Expect(8); BLOCK(out elist); liste.Add(new ProgSetup(elist)); Expect(9); BLOCK(out elist); liste.Add(new ProgLoop(elist)); while (StartOf(1)) { DCL(out e1, out idval); FUNCDECL(out e, e1); liste.Add(e); } ProgramAST = new Prog(liste); }
void FUNCDECL(out AST eo, SymDeclaring e1) { AST e = null; AST rv = null; SymDeclaring e11; List <SymDeclaring> e2 = new List <SymDeclaring>(); List <AST> e3 = new List <AST>(); Expect(17); if (StartOf(1)) { TYPE(out e11); Expect(3); e11.id = t.val; e2.Add(e11); while (la.kind == 14) { Get(); TYPE(out e11); Expect(3); e11.id = t.val; e2.Add(e11); } } Expect(18); Expect(10); while (StartOf(2)) { STMT(out e); e3.Add(e); } if (la.kind == 28) { Get(); EXPR(out rv); Expect(11); } Expect(13); eo = new FuncDecl(e1, e2, e3, rv); }
public FuncDecl(SymDeclaring Declaring, List <SymDeclaring> Declarings, List <AST> Statments, AST ReturnValue) { declaring = Declaring; declarings = Declarings; statments = Statments; returnValue = ReturnValue; }
void TYPE(out SymDeclaring e) { e = null; SymDeclaring lt = null; switch (la.kind) { case 43: { Get(); e = new VoidDcl(); break; } case 44: { Get(); e = new IntDcl(); break; } case 45: { Get(); e = new FloatDcl(); break; } case 46: { Get(); e = new StringDcl(); break; } case 47: { Get(); e = new BooleanDcl(); break; } case 48: { Get(); e = new StructDcl(); break; } case 49: { Get(); Expect(36); TYPE(out lt); Expect(34); e = new ListDcl(lt); break; } default: SynErr(52); break; } }
public abstract void Visit(SymDeclaring n);
void DCL(out SymDeclaring e, out AST idval) { TYPE(out e); Expect(3); idval = new SymReferencing(t.val); e.id = t.val; }
public Decl(SymDeclaring Declaring, AST Assigning) { declaring = Declaring; assigning = Assigning; }
public ListDcl(string i, SymDeclaring ListType) { id = i; listType = ListType; }
public ListDcl(SymDeclaring ListType) { listType = ListType; }