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 > LOOKAHEAD usage
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 475 of 548
Post > Topic >>

LOOKAHEAD usage

by amathew@[EMAIL PROTECTED] Sep 18, 2007 at 09:57 AM

I am a newbie to JavaCC and am trying to translate the following set
of prolog production

Phrase(not av(Attr,yes))- - > [not, Attr].
Phrase(not av(Attr,yes)) - - > [not, a, Attr].
Phrase(not av(Attr,yes)) - - >  [not, an, Attr].
Phrase(not av(Attr,Val)) - - > [not, Attr, is, Val].
Phrase(not av(Attr, Val)) - - > [not,Attr, are, Val].
Phrase(av(Attr, Val)) - - > [Attr, is, Val].
Phrase(av(Attr, Val)) - - > [Attr, are, Val].
Phrase( av(Attr,yes)) - - > [Attr].


I came up with

<NOT> (<_A>|<_AN>) <IDENTIFIER>
|
 [<NOT>] <IDENTIFIER>  [[<IS>|<ARE>] <IDENTIFIER>]


it gives a warning

     [exec] Java Compiler Compiler Version 4.0 (Parser Generator)
     [exec] (type "javacc" with no arguments for help)
     [exec] Reading from file rule.jj . . .
     [exec] Warning: Choice conflict involving two expansions at
     [exec] line 347, column 9 and line 349, column 3 respectively.
     [exec] A common prefix is: "not"
     [exec] Consider using a lookahead of 2 for earlier expansion.

Whats the right way do do this?
 




 3 Posts in Topic:
LOOKAHEAD usage
amathew@[EMAIL PROTECTED]  2007-09-18 09:57:17 
Re: LOOKAHEAD usage
AC <user@[EMAIL PROTEC  2007-09-19 07:40:01 
Re: LOOKAHEAD usage
amathew@[EMAIL PROTECTED]  2007-09-19 09:42:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Wed Jul 23 23:42:18 CDT 2008.