Skip to content
Martin Carlberg edited this page Nov 17, 2021 · 4 revisions

This is the generic bootstrap steps for loading a Cappuccino application (the simplified version):

  1. index.html is read and parsed by the browser
  2. The file Frameworks/Objective-J/Objective-J.js is read and executed from the <script> tag in the index.html file. It will setup the Objective-J runtime.
  3. The file ./Info.plist is read and parsed to get stuff like path to main file (usually main.j) and is it prebuilt etc...
  4. The main file is read or extracted from the common source code file if it is prebuilt.
  5. 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.
  6. If the file does any @import then read each of the imported files.
  7. For each imported file continue on step 5 and building a dependent tree of all source files.
  8. 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.
  9. The dependency tree is walked back down to the main file.
  10. 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.