compile-time regex redux

BCS BCS at pathlink.com
Wed Feb 7 11:14:12 PST 2007


Walter Bright wrote:
> kenny wrote:
> 
>> I know I'm asking for a lot, but the way templates handle string are 
>> still kinda weird to me. Would string parsing in this sort of way be 
>> absolutely impossible with templates? I have not had good luck with it. 
> 
> 
> I just haven't thought about this enough. Certainly, however, solving 
> the problem in a more general, D-ish way than regex would be a much 
> bigger win. Regex works only for a subset of problems (can't do 
> recursive descent parsing with it).

As I see it the biggest problem with compile time parsing in D is that 
building non linear structure is a pain. Tuples implicitly cated when 
passed together an this make some things really hard. Allowing a tuple 
to be a member of another tuple would put D template in the same class 
as LISP.

Another things that might make things easier is some way to mark a 
template as "evaluate to value and abandon". This would cause the 
template to be processed but none of the symbols generated by it would 
be kept, only the value. Of course, suitable restrictions would apply.



More information about the Digitalmars-d mailing list