more @allow troubles

2 views
Skip to first unread message

David Rush

unread,
Mar 20, 2009, 8:03:03 AM3/20/09
to gazelle-users
in the following grammar

---------- begin -------------------
STRING: /"([^\\"]|\\.)*"/;
WHITE: /[ ]+/;

@start source;

source -> toplevel;
white -> WHITE;

toplevel -> "#include" includeFile;

includeFile -> .libhdr=/<[^>"]+>/ | STRING;

@allow white in source ... includeFile;
-------------- end ---------------------

I get the following error from gzlc, which I compiled from the head of
the git repository today (2009-03-20). BTW, the 0.4 tarball wouldn't
build for me on Debian Etch.with a variety of errors.

/home/drr/bin/gzlc: compiler/bootstrap/rtn.lua:99: Error parsing
grammar: expected to match pattern %.%.%., but string is source ...
includeFile;

So what is going on here? have I missed something in the
documentation? or is this just b0rk3n? I'm going to have to switch
over to good old Lex/Yacc, otherwise.

It's worth noting that one of the advantages of having separate lexer/
parser passes is that white space can be easily eaten by the lexer, so
it doesn't pollute the parsing state machine.

david rush

Matt Brubeck

unread,
Mar 20, 2009, 12:38:45 PM3/20/09
to gazelle-users
On Mar 20, 5:03 am, David Rush <kumoy...@gmail.com> wrote:
> @allow white in source ... includeFile;

The new allow syntax has no "in":
@allow white source ... includeFile;

Joshua Haberman

unread,
Mar 21, 2009, 4:21:20 PM3/21/09
to gazelle-users
On Mar 20, 5:03 am, David Rush <kumoy...@gmail.com> wrote:
> It's worth noting that one of the advantages of having separate lexer/
> parser passes is that white space can be easily eaten by the lexer, so
> it doesn't pollute the parsing state machine.

Yes, I've definitely been keeping that in mind. I definitely want to
improve this so it doesn't look so polluted. Two specific plans I
have:
1. display the whitespace self-transitions differently (like give the
states that have them a different border, instead of explicitly
drawing the transitions).
2. remove the whitespace self-transitions that will never be taken
(it's tricky to prove exactly which ones this is though).

I definitely pine for the cleaner look of the state diagrams pre-
whitespace.

Josh
Reply all
Reply to author
Forward
0 new messages