Laszlo Nagy wrote: > The program below gives me "segmentation fault (core dumped)". > > Environment: > Linux gandalf-desktop 2.6.20-16-generic #2 SMP Tue Feb 12 05:41:34 > UTC 2008 i686 GNU/Linux > Python 2.5.1 > > What is wrong with my grammar? Can it be an internal error in simpleparse? > There's no way to tell from here. It's almost certainly a problem with simpleparse. Can you contact the developers of simpleparse?
There is more you can do on your own: Use a debugger or prints to decide which python line is causing this. (Almost certainly the parse.parse, but *make sure* of that ...) Then start reducing your grammar bit-by-bit until you get a working grammar and so narrow in on the portion that's causing this problem. This way, you may answer your own question, or provide enough information to motivate any knowledgeable volunteers to actually volunteer their time. Good luck. Gary Herron > Thanks, > > Laszlo > > > from simpleparse.common import numbers, strings, comments > from simpleparse.parser import Parser > > declaration = r''' > expr := paren_expr/unop_expr/binop_expr/word > paren_expr := "(",expr,")" > unop_expr := unop,expr > binop_expr := expr,binop,expr > unop := ("+"/"-") > binop := ("|"/"&"/"@") > word := [a-zA-Z], [a-zA-Z0-9_]* > ''' > > parser = Parser( declaration) > success, resultTrees, nextCharacter = > parser.parse("testword",production="expr",processor=None) > print success > > > -- http://mail.python.org/mailman/listinfo/python-list