@property - take it behind the woodshed and shoot it? - writefln
Philippe Sigaud
philippe.sigaud at gmail.com
Fri Jan 25 23:50:57 PST 2013
>> please give us your own code and preferred solution
>> to compile-time formatting string checking.
> I am not interested in formatting at all. I wrote about the
> general problem to incorporate expectable many DSL's into one big
> source base, as D is intended to serve large scale coding.
And what's the solution, for you? Using strings as DSL is somewhat common in D.
As for DSL, well, I have a parser generator project here
(https://github.com/PhilippeSigaud/Pegged), and I recently added the
capacity to add new rules to a grammar at runtime and modify the
resulting parse tree. I also used the existent, but unused macro
keyword in D to get source code that can define its own subsequent
grammar and parse tree transformations.
Oh, and grammars can call one another, so adding a new sublanguage to
a parent language is doable (I use this from time to time). I still
have weeks fo work on this to have it reach the level I want, but I
did not hit any wall up to now.
So adding clean-looking DSL can be done in D, I think.
> I am sure that your "stab at it" does not show any intent to
> approach the general problem.
No, indeed :) Since it's a recurring question here, I just showed it
could be done. It's also a simple example of what can be done with D
meta-programming capacities.
More information about the Digitalmars-d
mailing list