dws@cs.wisc.edu (DaviD W. Sanderson) (02/01/91)
I am looking for references to tools for manipulating or debugging yacc grammars. For instance, one such tool might illustrate ambiguities in a grammar by exhibiting sequences of grammar symbols that can be parsed more than one way (and hopefully showing at least two derivation trees). It can be hard to debug a grammar with the y.output file that yacc produces since conflicts can occur in a very different part of the grammar than where the fix "really should" be made. I would appreciate ideas for other sorts of tools for grammar debugging or manipulating. DaviD W. Sanderson (dws@cs.wisc.edu) -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
grosch@gmdka.uucp (Josef Grosch) (02/07/91)
DaviD W. Sanderson (dws@cs.wisc.edu) writes: > I am looking for references to tools for manipulating or debugging > yacc grammars. > For instance, one such tool might illustrate ambiguities in a grammar > by exhibiting sequences of grammar symbols that can be parsed more than > one way (and hopefully showing at least two derivation trees). The following article describes a solution to this problem: %A Frank DeRemer %A Thomas Pennello %T Efficient Computation of LALR(1) Look-Ahead Sets %J TOPLAS %V 4 %N 4 %P 615-649 %D OCT 1982 In case of ambiguities in the grammar, derivation trees can be printed that illustrate the conflict. We have implemented this algorithm in our parser generator Lalr. Using a preprocessor, yacc input can be directly processed by this tool. Our experiences are very satisfying. Looking at the derivation trees printed for conflicts you can more or less locate the problem immediately. The time for debugging grammars is reduced significantly. Josef Grosch (grosch@gmdka) -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.