Hi All, I'm a bit lost on understanding the language compiler. One provides a lang spec that, at minimum, specifies a reader and a compiler. Say my reader is read-jvs and my compiler (to Tree-IL) is comp:jvs->til. I will call the compiler from Tree-IL to CPS comp:til->cps, and the compiler from CPS to bytecode comp:cps->bc. IIRC, compile-file finds the highest level intermediate langauage, the joint, that is able to join compiled expressions (e.g., for Scheme this is `begin'). It then reads and compiles one expression at a time down to the joint, combines the expressions together and then compiles to the target (e.g., bytecode).
Now the compile routine takes an expression, an environment and options and compiles to a triple: expression environment and continuation enviroment. Assume the chain from JVS to bytecode is JVS->Tree-IL->CPS->BC, and that CPS is the joint. (It's actually Tree-IL, but let's roll with CPS for now.) My understanding is that the sequence of calls is as follows. (let*-values ((jvs-c0) (jvs-def-env)) ;; ((til-x1 til-e1 jvs-c1) (comp:jvs->til (read-jvs port jvs-c0) jvs-c0)) ((cps-x1 cps-e1 til-c1) (comp:til->cps til-x1 til-e1)) ;; ((til-x2 til-e2 jvs-c2) (comp:jvs->til (read-jvs port jvs-c1) jvs-c1)) ((cps-x2 cps-e2 til-c2) (comp:til->cps til-x2 til-e2)) ;; ((exps) (cps-joiner (list cps-x1 cps-x2) cps-e2) ((bc bc-e5 cps-c1) (comp:cps->byt exps cps-e2)) bc) For each compile step, I'm thinking the continuation enviornment return value is only used for subsequent calls to the same stage of the compiler. Did I miss it? (See system/base/compile.scm.) Now my problem. I'm not using a module-env for my continuation env, I'm using an a-list. The compilations go fine but after combining expressions in a file the joint-to-bytecode compilation bombs with error on unrecognzied env. I would not think my top-level continuation envornment should be passed to the low level compiler. Hmm... The reason I want to do this is that I want to track what top-level variables I am generating. Remember that no `(define a 1)' expressions are being executed to update the environment. So I want to keep track somehow. Matt