D parsing

Philippe Sigaud philippe.sigaud at gmail.com
Tue Nov 5 08:55:07 PST 2013


On Tue, Nov 5, 2013 at 3:54 PM, Dmitry Olshansky <dmitry.olsh at gmail.com>wrote:

>
>
>
> I was also toying with the idea of exposing Builder interface for
> std.regex. But push/pop IMHO are better be implicitly designed-out:
>
> auto re = atom('x').star(charClass(unicode.Letter),atom('y')).build();
>
> ... and letting the nesting be explicit.
>
> Is the same as:
> auto re = regex(`x(?:\p{L}y)*`);
>
> Aimed for apps/libs that build regular expressions anyway and have no need
> in textual parser.
>
>
Another possible advantage is to reference external names inside your
construction, thus naming other regexen or refencing external variables to
deposit backreferences inside them. All in all, to get a regex construct
that can interact with the external word.



>
> What ANTLR does is similar technique - a regular lookahead to resolve
> ambiguity in the grammar (implicitly). A lot like LL(k) but with unlimited
> length (so called LL(*)). Of course, it generates LL(k) disambiguation
> where possible, then LL(*), failing that the usual backtracking.
>

I liked that idea since the author added it to ANTLR, but I never used it
since.
I wonder whether that can be implemented inside another parser generator or
if it uses some specific-to-ANTLR internal machinery.



>
>
>> *sigh*, I feel like I could write a paper on this stuff if I were in
>> grad school right now.  Alas, I am stuck doing 50-60 hours a week of
>> soul-sucking business programming.
>>
>
> I heard Sociomantic is hiring D programmers for coding some awesome stuff,
> you may as well apply :)




Well, I do 50-60 hours a week of fulfilling and challenging work, but the
free time at the end is the same ;) I feel Chad's pain, though.




>  Well, then again, my understanding
>> is that even though I can think of things that seem like they would make
>> interesting topics for publishable papers, reality would have the profs
>> conscript me to do completely different things that are possibly just as
>> inane as the business programming.
>>
>> Speaking for my limited experience - at times it's like that.
>
>
> I worry that the greater threat to good AST manipulation tools in D is a
>> lack of free time, and not the DMD bugs as much.
>>
>
> Good for you I guess, my developments in related area are blocked still :(
>
>

Walter is far from convinced that AST manipulation is a good thing. You
would have to convince him first. His fear is that it will lead to
unreadable code, and everyone using her own personnal version of D.

AFAICT, nothing of the sort happened in Lisp (I mean, Lispers have
balkanization, but *not* due to AST manipulation).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131105/d193102f/attachment.html>


More information about the Digitalmars-d mailing list