[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SableCC equivalent to %prec from yacc



Hi Stephen,

If you are truely trying to parse C++, then you are very brave.  People
have written theses about different techniques to do it.  C++ has, to
start with, an ambiguous grammar.  In other words, there are C++ code
fragments that could be parsed in at least 2 ways; the most commonly
acknowledged ambiguity is the declaration vs. statement ambiguity.  To
"resolve" the ambiguity, the C++ specification simply states that
declarations win over statements.

For more information about the state of the art, I encourage you to
search through the comp.compilers newsgroup FAQ and archives:

 http://compilers.iecc.com/

Have fun!

Etienne

Stephen Torri wrote:
> What is the SableCC equivalent to %prec in yacc? I am trying to get the
> following rule for an if statement to take the first if statement
> otherwise try the ifelse statement.
>... 

-- 
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/

Attachment: signature.asc
Description: OpenPGP digital signature