| ID | 66209949-56cb-4c10-a572-eea8fe65fdd1 |
|---|---|
| DeertopiaVisibility | public |
The pass parameter
Many of the data structures used in Sydc are given a p parameter, identifying
the current pass. It's essentially an ad hoc implementation of Trees That Grow,
justified by the fact that we have no downstream consumers of our ASTs.
Sydc's use of pass parameters boils down to littering the syntax tree with various extension points, which can change types per pass via type family instances for the pass parameter.
Examples
Lifting join points
data ScDef p = ScDef Ident !(PassTerm p) !(PassScDefAnnotation p)
-- After the initial lowering to ANF, join points are not yet lifted.
type instance PassScDefAnnotation ToANF = ()
type instance PassTerm ToANF = LocatedTerm
-- After lambda-lifting, we have a list of join points attatched to each ScDef.
type instance PassScDefAnnotation LambdaLift = List Join
type instance PassTerm LambdaLift = LocatedTerm