The pipeline
The stages that take a source to a checked term, where the cache and the kernel come in, and how a contract becomes EVM bytecode.
The pipeline and the kernel follows one program through the stages. This page lists them, with the modules that implement them.
From a source to a checked term
source text
| Omegyu.Syntax.Parser parse
syntax tree
| Omegyu.Load.load the file and its imports, dependencies first
| Omegyu.Import where each import is, and its text, through the host
| Omegyu.Cache a module read back from the cache
| Omegyu.Elab.Program.elabModule inference, unification, implicit arguments
| Omegyu.Elab.Program.certify one closed kernel term, checked by Omegyu.Core.Check
checked program: a kernel term and its type
|- Omegyu.Driver.typeOf, normalForm print a type or a normal form
|- Omegyu.Driver.execute carry out an action, with Omegyu.Runtime
`- Omegyu.Compile.stageFile compile a contractThe parser reads the text into a syntax tree, and reports the syntax errors that it finds.
The loader reads the imports of the source, and theirs, dependencies first. A host locates and reads each import: the native host reads files and sends HTTP requests, and the WebAssembly build that runs in the playground is given its files in memory and sends requests with
fetch. A module in the cache is read back instead of being checked again.The elaborator infers types, solves implicit arguments and expands the conveniences of the language:
doblocks,assert, rows, and the descriptions of types that reflection derives.certifyturns everything that the elaborator produced into one closed term of the kernel, and the kernel, incore/, type-checks it from scratch. It assumes the definitions read from the cache, unless--recheckis given.Only a checked term is printed, normalised, run or compiled. The cache is written after the kernel has accepted the whole program.
From a checked term to bytecode
checked term of std:EVM/Contract.lower C.contract
| Omegyu.Contract.Stage.Specialize kernel evaluation that keeps word operations symbolic
the contract's code, over an abstract record of run-time operations
| Omegyu.Contract.Stage the residual value read as IR, choosing representations
| Omegyu.Evm.Ir.Simplify keep or copy each join point by the generator's cost
Omegyu.Evm.Ir.Code: the runtime and the constructor
| Omegyu.Evm.Ir.Validate, Omegyu.Evm.Optimize
| Omegyu.Evm.Codegen bytecode, when it fits one contract
| Omegyu.Evm.Package otherwise a package of contracts and its deployment plan
bytecode, ABI, native interface, manifestThe contract library runs at compile time: its codecs, capabilities and layouts compute away during staging, and only the operations of the EVM remain. The EVM back end describes the command that runs these stages.
The libraries
| Library | Directory | Contents |
|---|---|---|
omegyu-core | core/ | the kernel: its terms, evaluation, conversion and type checking |
omegyu-syntax | src/syntax | lexing, parsing, printing, formatting, highlighting and diagnostics |
omegyu-lang | src/lang | loading, imports, the cache, elaboration, the driver, the interpreter of actions and the standard library |
omegyu-system | src/system | the native host: files, HTTP and the cache on disk |
omegyu-evm | src/evm | the IR, its optimisation, code generation and packages |
omegyu-contract | src/contract | the staging of contracts: schemas, codecs, storage and boundaries |
omegyu | src/compile | Omegyu.Compile, which stages a contract file |
The omegyu executable is in app/. The WebAssembly build, in web/wasm, uses the same libraries
without omegyu-system. docs/architecture.md
describes the layers and their dependencies.