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
./lib
and./validators
and push aiken modules ontoProject.sources
. - Parse each source in sources:
- Generate a
ParsedModule
containing theast
,docs
, etc. Theast
here is anUntypedModule
, which contains untyped definitions. - Type check each parsed module.
- For each untyped module, create a
CheckedModule
. This includes typed definitions. compile
forks into two depending on whether it's been called withbuild
orcheck
.- From
CheckModules
construct aCodeGenerator
- Pass the generator to construct a new
Blueprints
. - Blueprints finds validators from checked modules.
- From each it constructs a
Validator
with the constructorValidator::from_checked_module
(which returns a vector of validators)- Its here that the magic happens: The method
generator.generate(def)
is called, wheredef
is 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]