RE: Announcing The Grammar Forge Visual Grammar Development Environment

Quinn Tyler Jackson <quinn-j@shaw.ca>
23 Oct 2004 22:33:33 -0400

          From comp.compilers

Related articles
Re: Announcing The Grammar Forge Visual Grammar Development Environmen cfc@shell01.TheWorld.com (Chris F Clark) (2004-10-21)
RE: Announcing The Grammar Forge Visual Grammar Development Environmen quinn-j@shaw.ca (Quinn Tyler Jackson) (2004-10-23)
| List of all articles for this month |

From: Quinn Tyler Jackson <quinn-j@shaw.ca>
Newsgroups: comp.compilers
Date: 23 Oct 2004 22:33:33 -0400
Organization: Compilers Central
References: 04-10-160
Keywords: tools
Posted-Date: 23 Oct 2004 22:33:33 EDT

> Quinn Tyler Jackson,
>
> I think here is a reasonable point to offer my congratulations. The
> tool that was once, LPM, has now grown-up. It looks quite
> impressive. There is a lot to be said for staying with something for
> the long-term. This tool is proof of that. It makes it clear that
> you have a vision of how you think parsing "should be done" and how
> parser generators "should work" and your tool is a fine example of
> materializing that vision.
>
> -Chris


Thank you, Chris. Coming from another parser generator author, that means a
lot to me.


In exchange for that, I'm going to tell you a story only a parser generator
author would find funny, but I think you'll get the punch line.


While I was putting together the $-grammar for Perl (OUCH!), I was somehow
under the mistaken belief that:


s/abc/123/x


meant that the regular expression denoted abc above could be in "extended"
form (extended Perl regular expression can contain comments, for instance.


This seemed to me to be quite a challenge to implement in a grammar without
any code, but I wanted to prove it could be done with $-grammars.


And so, I twiddled and fiddled for a while, until, indeed, I had a grammar
that would parse:


s/[a-z]+(?# comment)/123/ix


differently than it would parse


s/[a-z]+(?# comment)/123/i


(Note the lack of an x in the modifier list.)


Well, lo and behold, turns out my work was for naught, since someone told me
that I'd misunderstood the whole concept of /x


:-\


It did this bit of foo without any code, BTW, by storing the expression in a
local trie until it encountered the end of the whole s/// expression, and
then used a delayed predicate to do the actual parse of the expression,
based upon whether or not it saw an x in the modifiers. It was quite a
horror.


--
Quinn Tyler Jackson
http://members.shaw.ca/grammarforge/



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.