Hi Stephen, Right! SableCC only accepts pure LALR(1) grammars, without any conflict resolution primitives. So, you have to rewrite your grammar using the usual tricks for if/else and expressions. The decision not to provide the traditional yacc %prec primitive and default shift/reduce & reduce/reduce actions is intentinal. These primitive modify the parsed language. In other words, the language accepted by the resulting yacc-built parser does not always correspond to the language defined by source grammar (ignoring conflict resolution primitives, as they should, in my opinion, only affect the parse tree, not the acceptability of a token stream). FYI, SableCC 4 will introduce some operators to handle some common ambiguities. These operators will not modify the parsed languages; they will only resolve these ambiguities according to the grammar designer's preference. If you wish to attack C++ parsing with SableCC, I recommend that you look at James A. Roskind's grammar: ftp://ftp.iecc.com/pub/file/c++grammar/ I would also highly recommend that you read Edward D. Willink's Ph.D. thesis: http://www.computing.surrey.ac.uk/research/dsrg/fog/ Have fun! Etienne Stephen Torri wrote: > I appreciate the link to the compilers newsgroup. I will certainly take > a look at it but your words did not answer my question. -- 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