1 20 21 22 29 class Texplist implements AST { 30 Texplist explist; Texp exp; 33 public Texplist(Texplist p, Texp e) { 34 explist=p; 35 exp=e; 36 } 37 38 public Texplist(Texp e) { 39 explist=null; 40 exp=e; 41 } 42 43 public String toString() { 44 if (explist!=null) 45 return explist+","+exp; 46 else 47 return exp.toString(); 48 } 49 50 public void checkcontext(SymTab st) { 51 if (explist!=null) 52 explist.checkcontext(st); 53 exp.checkcontext(st); } 56 public int length() { 57 if (explist!=null) 58 return 1+explist.length(); 59 else 60 return 1; 61 } 62 63 public void prepInterp(SymTab st) { exp.prepInterp(st); 65 if (explist!=null) explist.prepInterp(st); 66 } 67 68 public void interpret(int[] in, int[] par, int[] res, int index) { 69 res[index] = exp.interpret(in,par); 70 if (explist!=null) explist.interpret(in,par,res,index+1); 71 } 72 } 73 74 | Popular Tags |