Where to make AST -> AST backend for DMD?
James Lu
jamtlu at gmail.com
Fri Oct 2 19:50:07 UTC 2020
Context: I'm experimenting with lowering D to a JITed language
such as Lua or JavaScript for faster compilation to machine code,
potential as a CTFE engine, and other reasons.
I want to cut in after opDispatch, after alias resolution, after
alias this, after UFCS is reduced to a normal function call, and
probably after template resolution.
Where (file) and how (methods, example code) do I get D's AST so
I can traverse and lower it into another language's AST?
I imagine using a recursive stringification method to generate
the code from the target language's AST as represented in the
compiler, and replacing D's AST nodes with the target language's
AST nodes, where the target language's nodes are subclasses of D
nodes, pretending to be D language nodes.
More information about the Digitalmars-d
mailing list