1 20 21 22 28 class Tdekl implements AST { 29 Tident ident; Tparlist parlist; Texp exp; 33 public Tdekl(Tident i, Tparlist p, Texp e) { 34 parlist=p; 35 ident=i; 36 exp=e; 37 } 38 39 public String toString() { 40 return(ident+"("+parlist+") = \n "+exp); 41 } 42 43 SymTab params; int arity; 45 46 public void setSymtab(SymTab st) { 47 params = new SymTab(st); 48 parlist.setSymtab(params,false,0); 49 arity = params.size(); 50 51 boolean isNew = st.enter(ident.toString(), 52 new STEfun(ident.toString(),this,arity)); 53 if(!isNew) Main.error("funktion "+ident+" defined twice!"); 55 } 56 57 public void printSymtabs() { 58 System.out.print("funktion "+ident.toString()+"\n"+params); 59 } 60 61 public void checkcontext() { 62 exp.checkcontext(params); } 64 65 public void prepInterp(SymTab st) { exp.prepInterp(params); 67 } 68 69 public int interpret(int[] in, int[] par) { 70 return(exp.interpret(in,par)); 71 } 72 73 public int arity() { return(arity); } 74 } 75 76 | Popular Tags |