Bootstrap
Martin Carlberg edited this page Nov 17, 2021
·
4 revisions
This is the generic bootstrap steps for loading a Cappuccino application (the simplified version):
- index.html is read and parsed by the browser
- The file
Frameworks/Objective-J/Objective-J.js
is read and executed from the<script>
tag in theindex.html
file. It will setup the Objective-J runtime. - The file
./Info.plist
is read and parsed to get stuff like path to main file (usuallymain.j
) and is it prebuilt etc... - The main file is read or extracted from the common source code file if it is prebuilt.
- The file is parsed to create an AST tree of the code by the Objective-J compiler if not yet compiled. If it is pre built each source file in the bundle is stored together precompiled in one file. Each file will then be extracted from the common file instead of loaded separately. For example
Frameworks/Foundation.sj
etc. - If the file does any
@import
then read each of the imported files. - For each imported file continue on step 5 and building a dependent tree of all source files.
- When the last files without any imports are read and if needed parsed by the Objective-J compiler. Usually
Foundation/CPObject.j
and some other similar classes. The load system now starts execute each source file from the leafs of the recursive tree that is built when loading all the imported files above. If the source files are not pre built the compiler will generate the compiled javascript code from the previously generated AST tree before executing it. - The dependency tree is walked back down to the main file.
- When the main file is executed as the last file the load system will check if there exists a
main
function. The function is called.