forked from Lambda-Mountain-Compiler-Backend/lambda-mountain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile-program-ordered.lsts
More file actions
22 lines (21 loc) · 859 Bytes
/
compile-program-ordered.lsts
File metadata and controls
22 lines (21 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let compile-program-ordered(global-ctx: FContext, program: AST): Nil = (
for vector g in program.unroll-seq { match g {
Glb{ key=key, val=val } => (
config-hot-path = key.key == c"std-bind-term";
if not(typeof-term(def-to-sym(g)).is-open)
or not(typeof-term(val).is-open) then {
std-c-compile-global(global-ctx, key.key, val);
};
);
ASTEOF{} => ();
ASTNil{} => ();
AType{} => ();
Meta{} => ();
t => (
let e = std-c-compile-expr(global-ctx, t, false);
let text = e.get(c"frame") + e.get(c"expression") + SAtom(c";\n");
assemble-global-initializer-section = assemble-global-initializer-section + text;
);
}};
if non-zero(compile-global-c-main-term) then std-c-compile-global(global-ctx, c"main", compile-global-c-main-term);
);