Yet another what is wrong with this grammar question:
I am playing with pyPEG2 by Volker Birk and I am stuck with a very trivial case:
from pypeg2 import *
text = 'f(x)'
grammar = name, '(' , word,')'
print parse(text, grammar)
The exception I am getting looks like:
Traceback (most recent call last): File "test.py", line 5, in print parse(text, grammar) File "/home/yy/dev/python/len/len/lang/pypeg2/init.py", line 539, in parse t, r = parser.parse(text, thing) File "/home/yy/dev/python/len/len/lang/pypeg2/init.py", line 644, in parse t, r = self._parse(t, thing, pos) File "/home/yy/dev/python/len/len/lang/pypeg2/init.py", line 814, in _parse t2, r = self._parse(t, e, pos) File "/home/yy/dev/python/len/len/lang/pypeg2/init.py", line 962, in _parse raise GrammarTypeError("in grammar: " + repr(thing)) pypeg2.GrammarTypeError: in grammar: '('
parse() fails on parsing opening round bracket which supposed to be a Symbol(). Surely I am missing something obvious, but what?