DeRailed DSL (was Re: compile-time regex redux)

kris foo at bar.com
Fri Feb 9 18:05:51 PST 2007


Andrei Alexandrescu (See Website For Email) wrote:
> Tom S wrote:
> 
>> When the compiler is used for the processing of a DSL, it simply masks 
>> a simple step that an external tool would do. It's not much of a 
>> problem to run an external script or program, that will read the DSL 
>> and output D code, while perhaps also doing other stuff, connecting 
>> with databases or making coffee.
> 
> 
> This is a misrepresentation. Code generation with external tools has 
> been done forever; it is never easy (unless all you need is a table of 
> logarithms), and it always incurs a non-amortized cost of parsing the 
> DSL _plus_ the host language. Look at lex and yacc, the prototypical 
> examples. They aren't small or simple nor perfectly integrated with the 
> host language. And their DSL is extremely well understood. That's why 
> there's no proliferation of lex&yacc-like tools for other DSLs (I seem 
> to recall there was an embedded SQL that got lost in the noise) simply 
> because the code generator would basically have to rewrite a significant 
> part of the compiler to do anything interesting.

Are you stating that D will address all these concerns? Without any 
detrimental side-effects?

[snip]

> I think there is a lot of apprehension and misunderstanding surrounding 
> what metacode is able and supposed to do or simplify. Please, let's 
> focus on understanding _before_ forming an opinion.

If that's the case, then perhaps it's due to a lack of solid & practical 
examples for people to examine? There's been at least two requests 
recently for an example of how this could help DeRailed in a truly 
practical sense, yet both of those requests appear to have been ignored 
thus far.

I suspect that such practical examples would help everyone understand 
since, as you suggest, there appears to be "differences" in perspective? 
Since Walter brough RoR up, and you apparently endorsed his point, 
perhaps one of you might enlighten us via those relevant examples?

There's a request in the original post on "The DeRailed Challenge" for 
just such an example ... don't feel overtly obliged; but it might do 
something to offset the misunderstanding you believe is prevalent.

- Kris



More information about the Digitalmars-d mailing list