By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,589 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,589 IT Pros & Developers. It's quick & easy.

simpleparse - what is wrong with my grammar?

P: n/a
The program below gives me "segmentation fault (core dumped)".

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?


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",processo r=None)
print success
Feb 24 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.