Using DMD as a library, how do I convert a string into a parse tree?

81 Views Asked by At

I am working on a project that will have its own AST representation of the D Programming Language. How do I use DMD as a library to get a parse tree (a tree of lexed tokens) from a string?

dmd.parse seems to return an AST, while dmd.lexer seems to return a sequence of lexed tokens. How do I get a parse tree? (Or does DMD merge the lexing, parsing, and AST generation phases together, such that getting a true parse tree is impossible? If so, is the D Grammar as listed in the specification complete enough to be pasted into a program such as lex or yacc?)

0

There are 0 best solutions below