inkytonik / cooma

The Cooma project is investigating secure programming language design based on fine-grained object capabilities.
Mozilla Public License 2.0
3 stars 2 forks source link

Add support for prelude #41

Closed inkytonik closed 3 years ago

inkytonik commented 3 years ago

We can now separately process a prelude Cooma definition and read its information in to the execution of a different Cooma program (or REPL). This mechanism constitutes a simple form of separate compilation.

It all works via the new -P option which processes a prelude and generates:

The new -p option specifies the prelude to use in a run. The corresponding static and dynamic files will be loaded into the compiler and runtime before analysing and executing the user's code. The static file provides an initial environment for semantic analysis. The IR code in the dynamic file is executed to produce an initial environment for execution. Thus, all of the entities defined in the prelude are available automatically in user code.

The default prelude is prelude/prelude.cooma. After any changes, we need to reprocess it with -P to get the default static and dynamic files.

The new -Q option can be used to run without using a prelude.

Details of main changes: