Niklas Matthies wrote: > On Sun 2006-10-29 at 12:13h, Etienne Gagnon wrote on sablecc-user: >>an interesting M.Sc. project... Just send me an interested student to >>work on it. ;-) > Well, I finished my thesis this year, so it's too late now. ;) Have any Ph.D. plans? ;-) [If yes, contact me privately...] > Thanks. I discarded this solution earlier on, mostly because it > creates a discrepancy between the intended syntax and the one > specified by the grammer, but maybe it's simpler to take this route > after all. > > One thing that is not so nice about it is that something like > > ((((a)), +b)) -> a + b > > would become valid, because parentheses and unary plus are discarded > by the CST->AST transformation. I have to think about that. This is because you're getting rid of these simple expressions too early on (in case of weeding). These are easy to get rid of "manually" after the initial lambda weeding+transformation. In my opinion, the approach of wider parse grammars is really recommended, in general, specially when it allows for clearer error messages for users. Parsing and lexical errors are often cryptic to users when they are due to "clever" grammars distinguishing between similar constructs. Semantic errors are almost always easier to understand than parsing and lexical ones. I know, it is frustrating for clever grammar writers that like the challenge of solving conflicts and ambiguities... :-P It might seem like a dirtier approach (because of the manual checking and transformation), yet, when used sparingly, it is actually a "clever" approach. Etienne -- 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