-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCompileModules.sml
More file actions
131 lines (110 loc) · 6.03 KB
/
CompileModules.sml
File metadata and controls
131 lines (110 loc) · 6.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
load "Process";
local
val arglist = List.foldr (fn (x,r) => x^(if r = "" then "" else " ")^r) ""
val arglistc = List.foldr (fn (x,r) => x^(if r = "" then "" else ",")^r) ""
val modsl = arglistc o (List.map (fn s => "\""^s^"\""))
val mods = arglist o (List.map (fn s => s^".ui"))
val opts = arglist o (List.map (fn s => "-"^s))
fun compile modlist optlist file =
let open Process
val cmd = "mosmlc -c "^(arglist [mods modlist,opts optlist,file])
val _ = print ("\""^cmd^"\"")
in ignore (system cmd);
print "\n"
end
in
fun compToplevelHere modlist file =
let val cmd = "Meta.compileToplevel ["^(modsl modlist)^"] \""^file^"\""
val _ = print (""^cmd^"")
val _ = Meta.orthodox()
in Meta.compileToplevel modlist file;
print "\n"
end
fun compStructureHere modlist file =
let val cmd = "Meta.compileStructure ["^(modsl modlist)^"] \""^file^"\""
val _ = print (""^cmd^"")
val _ = Meta.orthodox()
in Meta.compileStructure modlist file;
print "\n"
end
val allhere = true
fun compToplevel modlist file =
if allhere then compToplevelHere modlist file
else compile modlist ["orthodox","toplevel"] file
fun compStructure modlist file =
if allhere then compStructureHere modlist file
else compile modlist ["orthodox","structure"] file
fun rebuild () =
let
val _ = compToplevel [] "AbstractExp.sml"
val _ = compToplevel [] "AbstractBind.sml"
val _ = compToplevel [] "AbstractInfixop.sml"
val _ = compToplevel [] "AbstractPat.sml"
val _ = compToplevel [] "AbstractAtype.sml"
val _ = compToplevel [] "AbstractStr.sml"
val _ = compToplevel [] "AbstractRepr.sml"
val _ = compToplevel [] "AbstractReprRepr.sml"
val abstract_deps = ["AbstractExp","AbstractBind","AbstractInfixop","AbstractPat",
"AbstractAtype","AbstractStr","AbstractRepr","AbstractReprRepr"]
val _ = compToplevel abstract_deps "Induction.sml"
val _ = compToplevel ["Induction"] "Deconstructor.sml"
val _ = compToplevel ["Induction"] "Constructor.sml"
val _ = compToplevel ["Induction","Constructor"] "ReprPrinters.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor"] "ReprPrinter.sml"
val systemF_deps = abstract_deps@["Induction","Constructor","Deconstructor",
"ReprPrinters","ReprPrinter"]
val _ = compStructure systemF_deps "SystemF.sig"
val _ = compStructure systemF_deps "SystemF.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor"] "ReprEmbedding.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor"] "ReprEmbedding2.sml"
val _ = compToplevel ["Induction","Deconstructor"] "Variables.sml"
val _ = compToplevel ["Induction","Deconstructor"] "OccursCheck.sml"
val _ = compToplevel ["Induction","Deconstructor"] "BoundVariables.sml"
val _ = compToplevel [] "Semantics.sml"
val _ = compToplevel ["Induction","Deconstructor","Constructor","Semantics"] "MapJoinSemantics.sml"
val _ = compToplevel [] "SubsConvention.sml";
val _ = compToplevel ["Semantics","Induction","SubsConvention"] "SimpleSubs.sml";
val _ = compToplevel ["Induction","BoundVariables","Deconstructor"] "FreeVariables.sml"
val _ = compToplevel ["Induction","Deconstructor","Variables",
"Semantics","SubsConvention"] "Barendregt.sml"
val _ = compToplevel ["Induction","Deconstructor","Variables", "Semantics"] "SubsSemantics.sml"
val _ = compToplevel ["Induction","Deconstructor",
"Constructor","FreeVariables","Barendregt","SubsConvention",
"Semantics","SubsSemantics","SimpleSubs"] "Substitute.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor",
"Substitute","Semantics"] "UnifySemantics.sml"
val _ = compToplevel ["Induction","Deconstructor"] "OccursCheck.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor",
"Substitute","Semantics","UnifySemantics","OccursCheck"] "Unification.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor","Unification",
"Semantics","MapJoinSemantics","SubsSemantics","SubsConvention",
"SimpleSubs","FreeVariables","Substitute","OccursCheck",
"ReprEmbedding","UnifySemantics","Unification"] "Unifier.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor","Unification",
"Semantics","MapJoinSemantics","SubsSemantics","SubsConvention",
"SimpleSubs","FreeVariables","Substitute","OccursCheck",
"ReprEmbedding","UnifySemantics","Unification"] "Matcher.sml"
val _ = compToplevel ["Induction","FreeVariables","Semantics"] "TypeCheck.sml"
val _ = compToplevel ["Induction","Constructor","Deconstructor"] "Unit.sml"
val _ = compStructure [] "UTF8.sig"
val _ = compStructure [] "UTF8.sml"
val _ = compStructure [] "Parser.sig"
val _ = compStructure [] "Parser.sml"
val _ = compStructure [] "Parser2.sig"
val _ = compStructure [] "Parser2.sml"
val _ = compStructure [] "ParserMonad.sig"
val _ = compStructure [] "ParserMonad.sml"
val _ = compStructure [] "ParserTerminals.sig"
val _ = compStructure [] "ParserTerminals.sml"
val _ = compStructure [] "TerminalParsers.sig"
val _ = compStructure [] "TerminalParsers.sml"
val _ = compToplevelHere ["ParserMonad","ParserTerminals"] "SemanticParserModule.sml"
val _ = compToplevelHere ["Int","ListPair","Parser","SemanticParserModule",
"Induction", "Constructor",
"Deconstructor"] "ProtoParser.sml"
val _ = compStructure [] "TextFile.sig"
val _ = compStructure ["TextIO","String"] "TextFile.sml"
val _ = compToplevel ["Induction","Deconstructor","Constructor",
"ProtoParser","ReprPrinter","ReprPrinters"] "Syntax.sml"
in print "Done\n" end
end