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 > Semantic Lookah...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 446 of 549
Post > Topic >>

Semantic Lookahead

by pietromas@[EMAIL PROTECTED] Jan 16, 2007 at 09:57 AM

Is there a syntax that permits methods to be used in semantic
lookahead? Instead of writing

void BC() :
{}
{
  "b"
  [ LOOKAHEAD( { getToken(1).kind == C && getToken(2).kind != C } )
    <C:"c">
  ]
}

I wanr write

void BC() :
{}
{
  "b"
  [ LOOKAHEAD( { myBoolMethod(1, C) } )
    <C:"c">
  ]
}

with

boolean myBoolMethod(int k, Token t)
{
  return getToken(k).kind == t && getToken(k+1).kind != t
}

defined somewhere, so that myBoolMethod can be reused elsewhere in the
grammar.

Thx.
 




 1 Posts in Topic:
Semantic Lookahead
pietromas@[EMAIL PROTECTE  2007-01-16 09:57:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat Jul 26 1:50:58 CDT 2008.