VarList paramList() { VarList v; tok.scan(); if (tok.getFirstChar() != '(') { io.Abort("Expected '('"); } v = new VarList(); /* init the param list */ tok.scan(); /* get the next token */ while (tok.getFirstChar() != ')') { Var e = new Var(); e.setClassId(Tok.T_PARAM); /* mark this as a parameter */ dataType(e); /* get the specified datatype */ e.setName(tok.getValue()); /* copy the variable name */ v.add(e); /* add parameter to param list */ tok.scan(); if (tok.getFirstChar() == ',') /* if more params */ { tok.scan(); /* get the next token */ } } tok.scan(); /* move to the next token */ return(v); }
/* * Emit exe instructions now * this flushes the istream */ public void IL() { IAsm a = iroot; IAsm p; while (a != null) { switch (a.getIType()) { case IAsm.I_INSN: exe.Insn(a); break; case IAsm.I_LABEL: exe.Label(a); break; case IAsm.I_BRANCH: exe.Branch(a); break; case IAsm.I_INSN_STORE: exe.Store(a); break; case IAsm.I_INSN_LOAD: exe.Load(a); break; case IAsm.I_INSN_LOAD_CONST: exe.LoadConst(a); break; case IAsm.I_FUNC_BEGIN: exe.FuncBegin(a); /* Emit function beginning */ break; case IAsm.I_FUNC_END: exe.FuncEnd(); break; case IAsm.I_CALL: exe.Call(a); break; case IAsm.I_RET: exe.Ret(a); break; case IAsm.I_FIELD: exe.FieldDef(a); break; case IAsm.I_LOCALDEF: exe.LocalVars(localvars); break; case IAsm.I_COMMENT: exe.Comment(a); break; default: io.Abort("Unhandled instruction type " + a.getIType()); break; } p = a; a = a.getNext(); } }