dmd Lexer and Parser in D

H. S. Teoh hsteoh at
Sat Feb 4 15:39:41 PST 2012

On Sat, Feb 04, 2012 at 01:56:50PM -0800, Jonathan M Davis wrote:
> The intention is to have a lexer and parser for D in Phobos at some
> point, but I don't know how much we gain by having the whole compiler
> in D. It's not a bad idea in the least, and it would be a great
> project for someone to tackle, but of all of the things that a
> contributor could be doing, I'm not sure that that's really all that
> high on the list as far as value goes.

I'm actually thinking about writing a D pretty printer as a little
exercise in D programming. I haven't decided whether or not to simply
adapt the existing dmd frontend. One of Walter's stated advantages of D
is that it's easily lexed and parsed, even if semantics are disregarded.
I'm considering to prove that statement by building a lexer/parser from
ground up, though of course lacking most of the complexity of the real
compiler since I only need to do just enough to be able to pretty-print
D code.

If it's done correctly, it might even be useful in automated conversions
between different preferred indentation styles, etc..


This is a tpyo.

More information about the Digitalmars-d mailing list