Re: Ways to parse D code.

2020-11-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-11-25 17:27, Jan Hönig wrote: dmd has to do it somewhere as well. Although I don't know exactly where. I do know ldc uses dmd's frontend for parsing. https://dlang.org/phobos/dmd_parse.html Using DMD as a library will be most accurate and up to date. Because it's the same code as the

Re: Ways to parse D code.

2020-11-25 Thread Dennis via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 16:27:41 UTC, Jan Hönig wrote: What is the "easiest" way to parse D code? (...) libdparse seems to do it as well with `parseModule` function. https://github.com/dlang-community/libdparse/blob/master/src/dparse/parser.d I recommend libdparse. dmd has to do it s

Ways to parse D code.

2020-11-25 Thread Jan Hönig via Digitalmars-d-learn
What is the "easiest" way to parse D code? Given an Expression/Statement/Function/Template I want to put it into a program, and it returns me an AST. D-Scanner seems to do that with `--ast` argument. I would need to dig into it, to get it programmatically, instead of as XML on the stdout