Lexer and parser generators using CTFE

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Feb 28 17:38:57 PST 2012


On Tue, Feb 28, 2012 at 08:25:21PM -0500, Jonathan M Davis wrote:
> On Wednesday, February 29, 2012 02:16:12 Christopher Bergqvist wrote:
> > I agree that the current direction of D in this area is impressive.
> > However, I fail to see a killer-feature in generating a lexer-parser
> > generator at compile-time instead of run-time.
> > 
> > A run-time generator would benefit from not having to execute within
> > the limited CTFE environment and would always be on-par in that
> > respect. A compile time generator would internalize the generation
> > and compilation of the result (with possible glue-code), simplifying
> > the build process somewhat.
> > 
> > What am I failing to pick up on?
> 
> Well, one cool thing would be that a compiler could effectively
> compile itself - or at least the lexer and parser would compile
> themselves. You wouldn't have to run a program to generate them. It
> could be self-contained.
[...]

You also eliminate possibly lengthy program startup initialization.
Which can add up, if the program is run many times. Plus, if something
can already be computed at compile-time, why waste time & resources
doing it at runtime?


T

-- 
Без труда не выловишь и рыбку из пруда. 


More information about the Digitalmars-d mailing list