[erlang-questions] Debugging yecc grammars: what techniques are available?

Mikael Pettersson mikpelinux@REDACTED
Sun Feb 5 11:18:39 CET 2017


Hugo Mills writes:
 >    I'm in the process of writing a domain-specific language, using a
 > custom lexer and a yecc parser. In the process of attempting to add a
 > new feature to the grammar, I've managed to break what appears to me
 > to be a completely unrelated piece of the grammar: I'm adding a
 > structure similar to a list comprehension, and suddenly the integer
 > comparison operators have stopped working in one group of cases.
 > 
 >    What approaches are there for debugging this kind of problem? The
 > best I can some up with is inspection of the .yrl source in detail,
 > but that's not helping. How else can I work out what the issue is?
 > 
 >    Obviously, I could post the grammar here for inspection by more
 > experienced minds than mine, but I'd prefer to find better tooling and
 > techniques rather than mere appeal to higher authority...

Caveat: while I have experience with various parsing techniques, including
LALR(1), I have none with the yecc tool.

Does yecc issue any warnings about shift/reduce or reduce/reduce conflicts?
If it does, you need to investigate those and resolve them.  With yacc and
bison it's possible to manually inspect the LALR(1) automaton for debugging.



More information about the erlang-questions mailing list