experimenter_manifest.rs |
|
5734 |
frontend_manifest.rs |
|
4111 |
info.rs |
|
2695 |
kotlin |
|
|
mod.rs |
# Backend traits
This module provides a number of traits useful for implementing a backend for FML structs.
A [CodeType] is needed for each type that is referred to in the feature definition (i.e. every [TypeRef]
instance should have corresponding `CodeType` instance). Helper code for types might include managing how merging/overriding of
defaults occur.
A [CodeDeclaration] is needed for each type that is declared in the manifest file: i.e. an Object classes, Enum classes and Feature classes.
This has access to intermediate structs of the [crate::intermediate_representation::FeatureManifest] so may want to do some additional lookups to help rendering.
`CodeDeclaration`s provide the target language's version of the type defined in the feature manifest. For objects and features, this would
be objects that have properties corresponding to the FML variables. For enums, this would mean the Enum class definition. In all cases, this will
likely be attached to an [askama::Template].
`CodeDeclaration`s can also be used to conditionally include code: e.g. only include the CallbackInterfaceRuntime
if the user has used at least one callback interface.
Each backend has a wrapper template for each file it needs to generate. This should collect the `CodeDeclaration`s that
the backend and `FeatureManifest` between them specify and use them to stitch together a file in the target language.
The [CodeOracle] provides methods to map the `TypeRef` values found in the `FeatureManifest` to the `CodeType`s specified
by the backend.
Each backend will have its own `filter` module, which is used by the askama templates used in all `CodeType`s and `CodeDeclaration`s.
This filter provides methods to generate expressions and identifiers in the target language. These are all forwarded to the oracle. |
10796 |
swift |
|
|