public void visit(AbsFunDecl acceptor) { Frame frame = frms.peek(); Frame newFrame = new Frame(acceptor.name.identifier.getLexeme(), frame.level + 1); setFrame(acceptor, newFrame); frms.push(newFrame); int offset = +4; for (AbsDecl decl : acceptor.pars.decls) { AbsVarDecl varDecl = (AbsVarDecl) decl; Access access = new Access(frame.level + 1, offset); offset += 4; setAccess(varDecl, access); } acceptor.type.accept(this); acceptor.expr.accept(this); frms.pop(); }
public FrameResolver() { mainFrame = new Frame("", 0); frms = new Stack<Frame>(); frms.push(mainFrame); }