Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 301 lines (196 sloc) 9.696 kb
fccc685 Initial open-source release
MLstate authored
1 (*
993cac4 @BourgerieQuentin [enhance] compiler, database: Handle several backend on same Opa app
BourgerieQuentin authored
2 Copyright © 2011, 2012 MLstate
fccc685 Initial open-source release
MLstate authored
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (** The main program for the OPA compiler. S3 version. *)
20
21 (* Opening the generic pass system. *)
22 module PH = PassHandler
23
24 (* FIXME: define a module InfixOperators in PassHandler *)
25 (* this could by the only case an 'open' is allowed *)
26 let (|+>) = PH.(|+>)
27 let (|>) = PH.(|>)
28 let (<?>) = PH.(<?>)
29 let (&) = PH.(&)
30 let (|?>) = PH.(|?>)
ccded04 @BourgerieQuentin [enhance] compiler: (big) added mongo accessors generation + database…
BourgerieQuentin authored
31 let (|?|) = PH.(|?|)
fccc685 Initial open-source release
MLstate authored
32 let (or) = PH.(or)
33
34 (* Shorthands for accessing options of compilation *)
35 module If = Main_utils.If
ccded04 @BourgerieQuentin [enhance] compiler: (big) added mongo accessors generation + database…
BourgerieQuentin authored
36 module Switch = Main_utils.Switch
fccc685 Initial open-source release
MLstate authored
37
38 (* The deprecated passes *)
39 (* FIXME: adapt to the new PassHandler *)
40 module S2 = Passes
41
42 (* S3 implementations. *)
43 module S3 = S3Passes
44
45 (* Set title of generic pass system. *)
46 let _ = PH.set_title "Opa.exe"
47
48 (* Load warnings of opa s3 applications *)
49 let _ = WarningClass.load_set S3Warnings.warning_set
50
51 (* Run all passes *)
52 let () =
53 (**********************************************)
54 (* INITIALIZATION *****************************)
55 PH.init
56
57 |+> ("Welcome", S3.pass_Welcome)
58
59 |+> ("CheckOptions", S3.pass_CheckOptions)
60
61 |+> ("AddStdlibFiles", S3.pass_AddStdlibFiles)
62
63 |> PH.old_handler
64 "OpenFiles" S2.pass_OpenFiles
65
66 |+> ("PreProcess", S3.pass_PreProcess)
67
68 |+> ("Parse", S3.pass_Parse)
69
70 |+> ("RegisterAppSrcCode", S3.pass_RegisterAppSrcCode)
71
72 (**********************************************)
73 (* SURFACE AST PASSES *************************)
74 |> PH.handler ~count_time:false "LoadObjects" (S3.pass_LoadObjects (fun e -> e
75
9f38934 @BourgerieQuentin [fix] compiler, database: Some fix about database engine importation …
BourgerieQuentin authored
76 |+> ("DbEngineImportation", S3.pass_DbEngineImportation)
77
fccc685 Initial open-source release
MLstate authored
78 |+> ("BslLoading", S3.pass_BslLoading)
79
80 |+> ("ConvertStructure", S3.pass_ConvertStructure)
81
82 |> PH.old_handler
83 "CheckOptionsConsistency" Pass_CheckOptionsConsistency.process_code
84
85 |+> ("CheckServerEntryPoint", S3.pass_CheckServerEntryPoint)
86
87 |+> ("ParserGeneration", S3.pass_ParserGeneration)
88
89 |+> ("CheckDuplication", S3.pass_CheckDuplication)
90
4692879 @OpaOnWindowsNow [feature] Internationalisation: add @i18n directive and start support…
OpaOnWindowsNow authored
91 (* I18n, exit if generating template *)
92 |+> ("I18nAndComputedString", S3.pass_I18nAndComputedString)
93
fccc685 Initial open-source release
MLstate authored
94 |+> ("ConvertStructure2", S3.pass_ConvertStructure2 ())
95
51f92b4 [feature] adding: a no_client_calls directive
Hugo Heuzard authored
96 |+> ("TreatNoClientCalls",S3.pass_TreatNoClientCalls ())
97
fccc685 Initial open-source release
MLstate authored
98 |> PH.old_handler
99 "ReplaceCompileTimeDirective" S2.pass_ReplaceCompileTimeDirective
100
101 |> PH.old_if_handler
102 "StaticInclusionDirectory" S2.pass_static_inclusion_directory
103
104 |> PH.old_if_handler
105 "StaticInclusions" S2.pass_static_inclusions
106
107 |> PH.old_if_handler ~if_:If.server
108 "ServerEntryPoint" S2.pass_resolve_server_entry_point
109
110 (* inserting doctype directive for a collection later
111 currently always enable until an automated test verify that nobody breaks it
112 *)
113 |+> ((*PH.old_if_handler ~if_:If.generate_interface, *)
114 "AddDocApiDirectives", (S3.pass_AddDocApiDirectives ()))
115
116 |> PH.old_if_handler
117 "TupleTypeGeneration" S2.pass_tuple_types
118
119 |+> ("Reorder", (S3.pass_ReorderToplevel ()))
120
121 |+> ("RewriteModules", (S3.pass_RewriteModules ()))
122
123 |> PH.old_if_handler ~if_:If.server
124 "AddingServer" S2.pass_adding_server
125
126 (**********************************************)
127 (* QML AST PASSES *****************************)
128 |+> ("SAtoQML", S3.pass_SaToQml)
129
130 |+> ("AddCSS", S3.pass_AddCSS)
131
132 |+> ("FunActionLifting", S3.pass_FunActionLifting)
133
134 |+> ("TypesDefinitions", S3.pass_TypesDefinitions)
135
136 |+> ("DbSchemaGeneration", S3.pass_DbSchemaGeneration)
137
138 |+> ("DbPathCoercion", S3.pass_DbPathCoercion)
139
140 |+> ("MacroExpansion", S3.pass_MacroExpansion)
141
142 |+> ("Typing", S3.pass_Typing)
143
144 (* Extracting interesting types for documentation *)
145 |+> ("DocApiGeneration", S3.pass_DocApiGeneration)(*~if_:If.generate_interface*)
146
147 |+> ("CheckPatternMatching", S3.pass_CheckPatternMatching)
148
149 |+> ("WarnCoerce", S3.pass_WarnCoerce)
150
151 |+> ("CompileRecursiveValues", S3.pass_CompileRecursiveValues)
152
8edc001 [feature] adding: an @async directive on bindings to perform asynchro…
Valentin Gatien-Baron authored
153 |+> ("RewriteAsyncLambda", S3.pass_RewriteAsyncLambda)
154
fccc685 Initial open-source release
MLstate authored
155 (*|+> ("Retyping", S3.pass_Retyping)*)
156
993cac4 @BourgerieQuentin [enhance] compiler, database: Handle several backend on same Opa app
BourgerieQuentin authored
157 |?> (If.database `db3,
158 "BadopCodeGeneration", S3.pass_BadopCodeGeneration)
e337a3b @BourgerieQuentin [enhance] compiler, database: typing + code generation for the new wa…
BourgerieQuentin authored
159
993cac4 @BourgerieQuentin [enhance] compiler, database: Handle several backend on same Opa app
BourgerieQuentin authored
160 |?> (If.database `mongo,
161 "MongoCodeGeneration", S3.pass_MongoCodeGeneration)
fccc685 Initial open-source release
MLstate authored
162
00818f9 [refactor] removing most typing directives sooner
Valentin Gatien-Baron authored
163 (* could be just after typing, if dbgen didn't complain that it can't find its coercions :/ *)
164 |+> ("PurgeTypeDirectivesAfterTyping", S3.pass_PurgeTypeDirectiveAfterTyping)
165
fccc685 Initial open-source release
MLstate authored
166 |> PH.handler ~count_time:false "EndOfSeparateCompilation" (S3.pass_EndOfSeparateCompilation (fun e -> e
167
168 |+> ("BypassHoisting", S3.pass_BypassHoisting)
169
170 |+> ("RegisterFields", S3.pass_RegisterFields)
171
172 |?> (If.undot,
173 "Undot", S3.pass_QmlUndot)
174
175 |+> ("CodingDirectives", S3.pass_CodingDirectives)
176
177 <?> (If.closure,
178 ("EnrichMagic", S3.pass_EnrichMagic),
179 ("EnrichMagicPurge", S3.pass_EnrichMagicPurge))
180
181 |+> ("SimplifyEquality", S3.pass_SimplifyEquality)
182
183 |+> ("SimplifyMagic", S3.pass_SimplifyMagic)
184
185 |+> ("JustReorder1", S3.pass_ReorderEnvGen)
186
187 |> PH.old_if_handler
188 "EarlyLambdaLifting" S2.pass_EarlyLambdaLifting
189
936d60a [feature] closure serialisation: adding closure instrumentation (comp…
Valentin Gatien-Baron authored
190 |+> ("InstrumentForClosureSerialization", S3.pass_InstrumentForClosureSerialization)
191
fccc685 Initial open-source release
MLstate authored
192 (**********************************************)
193 (* SLICED PASSES ******************************)
194 <?> (If.server or If.separated or If.slicer_test,
195 ("Slicing" , S3.pass_SimpleSlicer),
196 ("NoSlicing", S3.pass_NoSlicer))
197
198 |+> ("Assertion", S3.pass_Assertion)
199
200 |?> (PH.neg (If.no_discard_of_unused_stdlib or If.separated),
201 "SlicedCleaning", S3.pass_SlicedCleaning)
202
203 (* Fun action resolution, step 2/3 *)
204 |?> (If.server or If.separated,
205 "FunActionEnvSerialize", S3.pass_FunActionEnvSerialize)
206
207 (* Explicit instantiation *)
208 |?> (If.explicit_instantiation,
209 "ExplicitInstantiation", S3.pass_ExplicitInstantiation)
210
211 |?> (If.explicit_instantiation,
212 "OptimizeExplicitInstantiation", S3.pass_OptimizeExplicitInstantiation)
213
214 (* Fun action resolution, step 3/3 *)
215 |?> (If.server or If.separated,
216 "FunActionJsCallGeneration", S3.pass_FunActionJsCallGeneration)
217
00818f9 [refactor] removing most typing directives sooner
Valentin Gatien-Baron authored
218 |+> ("PurgeTypeDirectivesAfterEi", S3.pass_PurgeTypeDirectiveAfterEi)
fccc685 Initial open-source release
MLstate authored
219
220 |?> (If.explicit_instantiation & (If.server or If.separated),
221 "ResolveRemoteCalls", S3.pass_ResolveRemoteCalls)
222
223 |?> (If.explicit_instantiation,
224 "InsertMemoizedTypes", S3.pass_InsertMemoizedTypes)
225
226 |+> ("JustReorder2", S3.pass_SlicedReorder)
227
228 (* ***********************************************)
229 (* FINAL COMPILATION *****************************)
230 |+> ("SlicedToFinal", S3.pass_SlicedToFinal)
231
232 (* ***********************************************)
233 (* FINAL CLIENT COMPILATION **********************)
234 (* ~precond:[check_ident_final_client] *)
235
236 |?> (If.cps_client,
237 "ClientQmlCpsRewriter", S3.pass_ClientCpsRewriter)
238
239 |?> (If.closure,
240 "ClientQmlLambdaLifting", S3.pass_ClientLambdaLifting)
241
242 (* |?> (If.closure,
243 "ClientQmlUncurry", S3.pass_ClientQmlUncurry)
244
245 |?> (If.closure,
246 "ClientQmlClosure", S3.pass_ClientQmlClosure)*)
247
248 |?> (If.constant_sharing_client,
249 "QmlClientConstantSharing", S3.pass_ClientQmlConstantSharing)
250 (* Insert client code like a js string on server (if
251 necessary) - After that client qml code have no more
252 place to exist and it dropped *)
253 |+> ("JavascriptCompilation", S3.pass_JavascriptCompilation)
254
255 |?> (If.server or If.separated,
256 "ResolveJsIdent", S3.pass_ResolveJsIdent)
257
258 <?> (If.server or If.separated,
259 ("GenerateServerAst", S3.pass_GenerateServerAst true),
260 ("DontGenerateServerAst", S3.pass_GenerateServerAst false))
261
262 (* ***********************************************)
263 (* FINAL SERVER COMPILATION **********************)
264
265 |+> ("CleanLambdaLiftingDirectives", S3.pass_CleanLambdaLiftingDirectives)
266
267 |?> (If.init,
268 "InitializeBslValues", S3.pass_InitializeBslValues)
269
270 |+> ("ServerQmlCpsRewriter", S3.pass_ServerCpsRewriter)
271
272 |> PH.old_if_handler ~if_:If.closure (* ~precond:[check_ident_final] *)
273 "ServerQmlLambdaLifting" (S2.pass_LambdaLifting2 ~typed:false ~side:`server)
274
275 |> PH.old_if_handler ~if_:If.closure
276 "ServerQmlUncurry" (S2.pass_QmlUncurry2 ~typed:false ~side:`server)
277
278 |?> (If.closure,
279 "ServerQmlClosure", S3.pass_ServerQmlClosure)
280
281 |?> (If.constant_sharing,
282 "QmlConstantSharing", S3.pass_QmlConstantSharing)
283
284 |+> ("QmlCompilation", S3.pass_QmlCompilation)
285
286 |+> ("OcamlSplitCode", S3.pass_OcamlSplitCode)
287
288 |+> ("OcamlGeneration", S3.pass_OcamlGeneration)
289
290 |+> ("OcamlCompilation", S3.pass_OcamlCompilation)
291
292 |+> ("CleanUp", S3.pass_CleanUp)
293
294 |+> ("ByeBye", S3.pass_ByeBye)
295
296 |> PH.return )) (* end of the pass endOfSeparateCompilation *)
297 |> PH.return )) (* end of the pass loadObjects *)
298 |> PH.return
299
300 let () = OManager.exit 0
Something went wrong with that request. Please try again.