Semantics of XL1
The XL1 phase is defined as a sequence of operations on the XL0 parse tree. These operations are provided by various compiler plug-ins, that are triggered based on the shape of the parse tree.
Special constructs, translate
and translation
, are provided by a plug-in designed to facilitate the writing of other plug-ins. The quote
construct generates a parse tree. Here is how these notations can be used to implement a plug-in called ZeroRemoval
that eliminates superfluous additions and multiplications by zero.
A plug-in can be invoked on a whole file from the command line, or more locally in the source code using the pragma notation, as follows:
X := {Differentiate} d(sin(omega * T) * exp(-T/T0)) / dTThe XL1 phase contains a large set of plug-ins, notably XLSemantics
, that provide common abstractions like subroutine, data type and variable declaration and definition, as well as basic structured programming statements, like conditionals or loops.
Read more about this topic: XL (programming Language)