How to feed an compilation unit obtained from ceylon.ast to the ceylon compiler -


the following example found in ceylon/ceylon.ast project shows how construct ast programmatically , have typechecked ceylon typechecker (com.redhat.ceylon.compiler.typechecker.typechecker):

https://github.com/ceylon/ceylon.ast/blob/master/source/test/ceylon/ast/samples/turingmachine/poweroftwo.ceylon

what subsequently recommended method called typed syntax tree compile typed syntax tree - considering compilation units given files not typed syntax trees (from ceylon.ast project) typechecker ?

this question linked the ceylon typechecker: how obtain typed syntax tree?.

generating ast , compiling apart context of real project doesn't seem viable option. compiler requires more information ast alone provides , providing compiler default or fake information (e.g. file names) still complicated task.

on other hand, using asts of real compilation units in context of real project sort of macro system doesn't make sense since ceylon programs may have side effects , transformation has take account. additionally, transformation rules should terminating , confluent , should expressed in form makes maintaining them easy possible opposed procedural transformers. ceylon's switch expression not right tool it. worst case procedural ast transformer transforms procedural la groovy's ast transformers.

an exeption transformation of declarative treelike structures in ceylon. , thinking of in question: reading in data (not in ceylon syntax) , making them available evaluation or optionally compilation.


Comments