Related articles |
---|
predictive parsing j0mbolar@engineer.com (j0mbolar) (2006-02-19) |
Re: predictive parsing oliverhunt@gmail.com (oliverhunt@gmail.com) (2006-02-19) |
Re: predictive parsing u.hobelmann@web.de (Ulrich Hobelmann) (2006-02-19) |
From: | "j0mbolar" <j0mbolar@engineer.com> |
Newsgroups: | comp.compilers |
Date: | 19 Feb 2006 02:03:03 -0500 |
Organization: | http://groups.google.com |
Keywords: | LL(1), parse, question |
Posted-Date: | 19 Feb 2006 02:03:03 EST |
I am running into an issue with my LL(1) parser
in representing some of the nonterminals.
The problem is this:
suppose that I have the following grammar:
start: A B
A: C | C A | D | D A
B: '*'
C: '!' | '@'
D: 'X' | 'Y'
Where A, B, C, D are nonterminals
that are represented by functions.
The issue arises in representing the following production:
A: C | C A | D | D A
Imagine my initial lookahead token is '!'.
C() would be called and I would get my next
token. How then could I determine if A() should
be called or if the lookahead token applies to B,
where I should return and then call B?
I would also like to generate a syntax error
if the initial lookahead token does not follow
one of the rules of A.
I think this has to do with properly computing
what should be in the FIRST() set.
--
j0mbolar
Return to the
comp.compilers page.
Search the
comp.compilers archives again.