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

Richard Carlsson <>
Sun Feb 5 17:02:39 CET 2017


It can be pretty tricky to figure out what's wrong with a grammar, in
particular if the parser generator doesn't have support for emitting
various kinds of debug information. Here are some links that might help you:
http://www.tldp.org/HOWTO/Lex-YACC-HOWTO-7.html
http://www.cs.man.ac.uk/~pjj/cs211/ho/node7.html
http://dinosaur.compilertools.net/bison/bison_11.html

You might want to consider porting the grammar to Bison (which has better
debugging support) and use that instead for the development/debugging
phase, then port it back to yecc for the final implementation when done.



        /Richard

2017-02-05 7:49 GMT+01:00 Walter Weinmann <>:

> I've done a project with he OpenCypher <http://opencypher/openCypher>
> language: https://github.com/walter-weinmann/ocparsehttps:/
> /github.com/walter-weinmann/ocparse. This should be a good example how to
> apply leex and yecc.
>
> I've done also a second one, but honestly I'm very unhappy with the
> limitations of LALR parsing. I'm now in the process to switch to neotoma
> <http://seancribbs/neotoma>, which is based on Parser Expression Grammars
> and it looks very promising.
>
> Regards
>
> Walter
>
>
> On 5 February 2017 at 00:45, Hugo Mills <> wrote:
>
>>    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...
>>
>>    Hugo.
>>
>> --
>> Hugo Mills             | Strive for apathy!
>>  carfax.org.uk |
>> http://carfax.org.uk/  |
>> PGP: E2AB1DE4          |                                      Andrew
>> Zalotocky
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
> __________________________________
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170205/083965ec/attachment.html>


More information about the erlang-questions mailing list