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 > left recursion ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 448 of 548
Post > Topic >>

left recursion - request help

by "Luch" <DarthLuch@[EMAIL PROTECTED] > Jan 30, 2007 at 06:55 PM

I have the below grammar... JavaCC complains about left-recursion in 
all the productions of Expression except Expression_Finish(). I've 
read all the previous posts on left-recursion in this group and in my 
Compilers textbook to no avail... would appreciate any suggestions on 
what I could do, for at least one of the possible productions.


void Expression():
{ Token t; }
{
 Expression() ( AND() | LESS_THAN() | PLUS() | MINUS() | MULTIPLY() ) 
Expression()
| Expression() LEFT_BRACE() Expression() RIGHT_BRACE()
| Expression() DOT() LENGTH()
| Expression() DOT() Identifier() LEFT_PAREN() ( Expression() 
( COMMA() Expression() )* )? RIGHT_PAREN()
| Expression_Finish()
}


void Expression_Finish():
{}
{
  <INTEGER_LITERAL>
| TRUE()
| FALSE()
| Identifier()
| THIS()
| NEW() INTEGER() LEFT_BRACE() Expression() RIGHT_BRACE() 
{System.out.println("My expression: new int(expression())"); }
| NEW() Identifier() LEFT_PAREN() RIGHT_PAREN() 
{System.out.println("My expression: new ID ()"); }
| EXCLAMATION() Expression()
| LEFT_PAREN() Expression() RIGHT_PAREN()
}
 




 2 Posts in Topic:
left recursion - request help
"Luch" <Dart  2007-01-30 18:55:18 
Re: left recursion - request help
Colin Paul Gloster <Co  2007-03-02 14:30:31 

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:43:21 CDT 2008.