simpleparse - what is wrong with my grammar?
Laszlo Nagy
gandalf at shopzeus.com
Sun Feb 24 04:49:18 EST 2008
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?
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
More information about the Python-list
mailing list