1.8 KiB
1.8 KiB
Aims:
- Describe the pipeline, and components getting from aiken to uplc.
Air
Aiken compiles aiken code to uplc via air: Aiken Intermediate Representation.
Trace
Running aiken build...
The cli (See aiken/src/cmd/mod.rs) parses the command,
finds the context and calls Project::build (crates/aiken-project/src/lib.rs),
which in turn calls Project::compile.
Project::compile
- Check dependencies are available eg aiken stdlib.
- Read source files.
- Walk over
./liband./validatorsand push aiken modules ontoProject.sources. - Parse each source in sources:
- Generate a
ParsedModulecontaining theast,docs, etc. Theasthere is anUntypedModule, which contains untyped definitions. - Type check each parsed module.
- For each untyped module, create a
CheckedModule. This includes typed definitions. compileforks into two depending on whether it's been called withbuildorcheck.- From
CheckModulesconstruct aCodeGenerator - Pass the generator to construct a new
Blueprints. - Blueprints finds validators from checked modules.
- From each it constructs a
Validatorwith the constructorValidator::from_checked_module(which returns a vector of validators)- Its here that the magic happens: The method
generator.generate(def)is called, wheredefis the typed validator(s). This method outputs aProgram<Name>which contains the UPLC. - These are collected together.
- Its here that the magic happens: The method
- The rest is collecting and handling the errors and warnings and writing the blueprint.
CodeGenerator::generate
- Create a new
AirStack.
AirStack
Consists of:
- An Id
- A
Scope - A vector of
Air
The Scope keeps track of ... [TODO]
Air
Air is a typed language... [TODO]