コード例 #1
0
 public void visit(AbsVarDecl acceptor) {
   // Lokalna spremenljivka.
   // Parametre obdelamo pri AbsFunDecl.
   // Komponente obdelamo pri AbsRecType.
   Frame frame = frms.peek();
   SemType type = TypeResolver.getType(acceptor.name);
   int offset = frame.addVariable(type.size());
   Access access = new Access(frame.level, offset);
   setAccess(acceptor, access);
   acceptor.type.accept(this);
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 public void visit(AbsFunCall acceptor) {
   Frame frame = frms.peek();
   frame.ensureOutArgsSize(acceptor.args.exprs.size() * 4 + 4);
   for (AbsExpr arg : acceptor.args.exprs) arg.accept(this);
 }