[antlr-interest] New user

Greg Lindholm glindholm at yahoo.com
Thu Aug 29 09:56:55 PDT 2002


A couple other important points about predicates:

- Semantic predicates are written in the host language (Java, C++,
etc.) and provide a break-out hook at that point in the parsing.
You have full access to the internals of the parser plus access
to symbol tables and any external resources you've setup.

- Syntactic predicates are written in and use the "syntax" grammer 
of the parser to provide unlimited look ahead.

- Syntactic predicates are used to select between one of several 
alternatives (usually with a common prefix)

- Syntactic predicates are "ordered" they are checked in the order 
that they are written in.  I believe this is the only way to do
an ordered series of tests.

--- mzukowski at yci.com wrote:
> 
> 5. When do I use syntatic predicate and semantic predicate? Why does
> this
> semantic make sense: ( set_clause ) => set_clause ??!! 
> 
> It doesn't make sense like that because you're not using it in
> context.
> What it is saying is choose this alternative if the syntactic
> predicate
> matches.  Sometimes you have things that need "infinite
> lookahead"--you
> can't always decide in "k" tokens what is happening.  When you have
> that
> situation you use a syntactic predicate.  Semantic predicates are for
> things
> like checking symbol tables--the actual semantics of the program.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list