By Jochen Voss, on
Today I completed version 0.4 of the Wisent parser generator for Python. The program is now efficient enough to deal with grammars of the size of the C grammar.
I spent some effort on generating useful error messages for grammar conflicts. For example the usual "if-else conflict" in the C grammar is reported as follows:
cg.wi:164:61: shift-reduce conflict: the input cg.wi:164:61: IDENTIFIER { if ( IDENTIFIER ) ;.else ... cg.wi:164:61: can be shifted using the production rule cg.wi:164:61: selection_statement: if ( expression ) statement.else statement; cg.wi:164:25: or can be reduced to cg.wi:164:25: IDENTIFIER { selection_statement.else ... cg.wi:164:25: using the production rule cg.wi:164:25: selection_statement: if ( expression ) statement; cg.wi: 1 conflict, aborting ...
Now you can even tell Wisent to ignore this conflict by placing an
!
before the offending else
.
This is an excerpt from Jochen's blog.
Newer entry: A fast numerical algorithm for the estimation of diffusion model parameters
Older entry: Efficient LR(1) Parsers
Copyright © 2008 Jochen Voss. All content on this website (including text, pictures, and any other original works), unless otherwise noted, is licensed under the CC BY-SA 4.0 license.