Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools JavaCC > Re: Empty token...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 471 of 555
Post > Topic >>

Re: Empty token sequence

by AC <user@[EMAIL PROTECTED] > Sep 1, 2007 at 08:06 AM

Cesare Zecca wrote:
> ID and GROUP_ID share a common prefix and cause a lookahead problem.

Actually, the problem is that there are two ways to parse an <ID>,
either
   Factor() -> Id() -> <ID>
or
   Factor() -> GroupId() -> <ID>
The parser doesn't know which one to choose.

For the example grammar, this is unnecessary, so the fix is to
eliminate the redundancy.

Approach 1: Eliminate Id() and GroupId() and replace the body of
Factor() with the body of GroupId().  This results in the simplest
grammar.  Then <ID> would be parsed via
   Factor() -> <ID>

Approach 2: Remove <ID> from GroupId(), since it is already covered by
the Id() call in Factor().  Then <ID> would be parsed via
   Factor() -> Id() -> <ID>

Hope this helps!
 




 4 Posts in Topic:
Emtpy token sequence
Cesare Zecca <Cesare.Z  2007-08-30 10:31:20 
Re: Empty token sequence
AC <user@[EMAIL PROTEC  2007-08-30 08:52:16 
Re: Empty token sequence
Cesare Zecca <Cesare.Z  2007-08-31 15:26:08 
Re: Empty token sequence
AC <user@[EMAIL PROTEC  2007-09-01 08:06:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 7:44:57 CDT 2008.