Hampi parser bug?

5 views
Skip to first unread message

Tim Hinrichs

unread,
Feb 1, 2010, 12:55:57 PM2/1/10
to hampi...@googlegroups.com
I've run into this problem a couple of times now. The input file
includes two CFGs. (It turns out that in the example below the first
CFG subsumes the second, but I'm generating these automatically, so
that's unknown.) Hampi works fine on either CFG independently but
produces an error when both appear. The symbols are distinct in the
two CFGs.

Thoughts?
Thanks,
Tim

Input
==============
var SUBJECT : 1;
cfg qtlh166h2 := \033 | [\035 - \038] | \042 | \046 | [\048 - \057] |
[\064 - \090] | \092 | [\094 - \095] | [\097 - \122];
cfg qtlh166h3 := (qtlh166h2)+;
cfg qtlh166h1 := qtlh166h3;
cfg flaxtlh166h0 := qtlh166h1;
assert SUBJECT in flaxtlh166h0;

cfg qtlh165h2 := \033 | [\035 - \038] | \042 | \046 | [\048 - \057] |
[\064 - \090] | \092 | [\094 - \095] | [\097 - \122];
cfg qtlh165h3 := (qtlh165h2)*;
cfg qtlh165h1 := qtlh165h3;
cfg flaxtlh165h0 := qtlh165h1;
assert SUBJECT in flaxtlh165h0;


Output
================
distributions in bounding: 2ms (82 times)
grammar bounding for flaxtlh166h0: 62ms (1 times)
java.lang.IllegalArgumentException: Cannot find nonterminal rangea_z
in grammar:
Sym0 = qtlh165h2 | qtlh165h2 Sym0 ;
flaxtlh165h0 = | qtlh165h1 ;
qtlh165h1 = qtlh165h3 ;
qtlh165h2 = "!" | "*" | "." | "\" | range#_& | range0_9 |
range@_Z | range^__ | rangea_z ;
qtlh165h3 = Sym0 ;

at
hampi.grammars.apps.UnreachableNonterminalRemover.getReachableNontermina
ls(UnreachableNonterminalRemover.java:62)
at
hampi.grammars.apps.UnreachableNonterminalRemover.removeUnreachableNonte
rminals(UnreachableNonterminalRemover.java:76)
at
hampi.grammars.apps.EpsilonProductionRemover.removeEpsilonProductions
(EpsilonProductionRemover.java:52)
at hampi.grammars.apps.GrammarStringBounder.getBoundedRegexp
(GrammarStringBounder.java:51)
at hampi.parser.HConstraintPreparer.prepareSizeFixRegexp
(HConstraintPreparer.java:216)
at hampi.parser.HConstraintPreparer.prepareIn
(HConstraintPreparer.java:132)
at hampi.parser.HConstraintPreparer.prepare
(HConstraintPreparer.java:47)
at hampi.parser.HConstraintPreparer.prepare
(HConstraintPreparer.java:34)
at hampi.Hampi.run(Hampi.java:283)
at hampi.Hampi.run(Hampi.java:259)
at hampi.Hampi.main(Hampi.java:238)

Adam Kiezun

unread,
Feb 1, 2010, 8:55:16 PM2/1/10
to hampi...@googlegroups.com
Thanks Tim for reporting this.

I delta-debugged it down to:
var v : 1;
cfg R := ['a' - 'b'];
assert v in R;
assert v in R;

I created a bug report for it: http://code.google.com/p/hampi/issues/detail?id=2
I'll let you know about the progress on this.

./adam

> hampi.parser.HConstraintPreparer.prepare(HConstraintPreparer.java:34)

Reply all
Reply to author
Forward
0 new messages