|
|
1.1 root 1: (* Copyright 1989 by AT&T Bell Laboratories *)
2: (* Modules compiler for New Jersey ML. Nick Rothwell, LFCS, January 1989. *)
3:
4: (* Generic signature to encompass the current slot-based representation, as well
5: as the still-to-be-written lambda-based representation. *)
6:
7: signature MODULE_COMPILER =
8: sig
9: type lvar sharing type lvar = int
10:
11: structure Absyn: BAREABSYN
12: sharing Absyn = BareAbsyn
13: (* Needed because Translate is hard-wired. *)
14:
15: structure Lambda: LAMBDA
16:
17: type LambDynModule (* Dynamic module with lambdas, lvars, etc. *)
18: type CodeDynModule (* Compiled (native code) module - no lvars. *)
19:
20: val emptyDynModule: LambDynModule (* Starting state. *)
21:
22: exception AddDeclaration
23: val addDeclaration: Absyn.dec * lvar list * LambDynModule -> LambDynModule
24:
25: val abstractDynModule: CodeDynModule * lvar list -> LambDynModule
26: (* abstractDynModule takes a compiled module (presumably from an
27: "import"), and returns a lambda-based module with the code
28: module treated as an argument. We attach the lvars to the code
29: module, to allow reference from declarations below the
30: "import". *)
31:
32: exception CompileDynModule
33: val compileDynModule:
34: (Lambda.lexp -> Lambda.lexp) -> LambDynModule -> CodeDynModule
35: (* Close and fold down all the lambdas, generate code. Takes
36: a lambda-optimising function as argument. *)
37:
38: val executeDynModule: CodeDynModule ->
39: (lvar -> System.Unsafe.object) -> System.Unsafe.object array
40: (* Execute the module, given the lookup function
41: (which I'll use to get at true globals like the
42: pervasives). *)
43:
44: val importDynModule: (LambDynModule * LambDynModule) -> LambDynModule
45: (* importDynModule takes a module state, and embeds it
46: into an enclosing module state. *)
47: end;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.