public void visit(ProcCall procCall) { if (stack.level >= Dictionary.MAX_NEST_LEVEL) { throw new Exception(Dictionary.max_nest_level_exc); } if (!stack.containsProcedure(procCall.procName)) { throw new Exception("Don't know how to " + procCall.procName); } ProcDecl returnedProcedure = stack.getProcedure(procCall.procName); if (procCall.arguments.Count != returnedProcedure.parameters.Count) { throw new Exception("Arguments number mismatch in " + procCall.procName); } stack.levelUp(); pushParams(returnedProcedure, procCall); procCall.output = returnedProcedure; foreach (IAST child in procCall.output.children) { child.accept(this); } stack.clearParams(); stack.levelDown(); }
private void pushParams(ProcDecl declaration, ProcCall call) { for (int i = 0; i < declaration.parameters.Count; i++) { call.arguments[i].accept(this); stack.pushLocal(declaration.parameters[i].varNode.name, call.arguments[i].output); } }
public void visit(ProcCall procCall) { }