package Semant; import ErrorMsg.ErrorMsg; public class Semant { Env env; public Semant (ErrorMsg err) { this (new Env(err)); } Semant (Env env) { this.env = env; } ExpTy transVar (Absyn.Var v) { ... } ExpTy transExp (Absyn.Exp e) { ... } Translate.Exp transDec (Absyn.Dec d) { ... } Types.Type transTy (Absyn.Ty t) { ... } }
Translate.Exp transDec (Absyn.VarDec d) { env.venv.put (d.name, new VarEntry (transExp(d.init).ty)); return null; }The code for type declarations on the same page should be:
Translate.Exp transDec (Absyn.TypeDec d) { env.tenv.put(d.name, transTy(d.ty)); return null; }The code for function declarations on the next page (p.125) has an extra occurrence of `null' as the first argument to VarEntry in the first line of the for-loop.
For extra credit, do Exercise 5.3 on p.129.
sabry@cs.uoregon.edu