first shot for a combinator library for d
Christian Köstlin
christian.koestlin at gmail.com
Mon Dec 13 01:19:08 PST 2010
thanks for your feedback!
> Maybe add support for predicated alternatives?
what is this :) ?
> If you *really* want to make it more convenient, you could make a string
> mixin front for it, so that one could do something like
>
> mixin(maek_parser("
> start -> s1 s2;
>
> s1 -> (`ab`|`cd`) `ef`;
>
> s2 -> (`1`|`2`|`3`);
> "));
>
> I don't recommend you do that, though, given D's current state of
> affairs regarding ctfe.
>
> Though a runtime version would be doable.
>
> Instead of adding support for char[], wchar[], string, etc, I would
> recommend you just make it support a dchar range interface. This hits
> all of the above, and then some.
yes ... i also think so ... i will try this today (but i want to go
first with arrays of objects (templated) because then you could put a
lexer in front of the parsers).
> I looked at your code a bit, but I'm lazy. Why is ParseSuccess.fResults
> a Variant[] ?
mhh .. thats one of the things i was not sure of. i wanted to be able to
return different types from the parsers. e.g. an integer parser should
return an array of ints (or in my case a variantarray containing ints).
the use of the variants was the second thing which came to my mind and
allowed for mixed returns from the parsers ... e.g. the result of
parsing "private int i = 5" could be (by classes) [Modifier, Type,
string, int].
> Lastly, I can't help you with naming :)
sure :) i just dont get it right now how people have their sources and
libraries organized. because it seems that dsss is not any more for d2?
regards
christian
More information about the Digitalmars-d-learn
mailing list