[Types-sig] "Mobius2" -- high performance Python-extensible Python parser
Jeff Epler
jepler@users.sourceforge.net
Tue, 17 Apr 2001 13:25:42 -0500
On Tue, Apr 17, 2001 at 09:42:05AM -0700, Michel Pelletier wrote:
> I am still having a problem though that I can't get past. Here's snippet
> of my Grammar file:
>
> interfacedef: 'interface' NAME ['(' testlist ')'] ':' suite
You don't say whether you did this, but you need to amend the rule for
'compound_stmt':
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef | interfacedef
Your 'myxform' file also needs to reference the grammar file:
class MyTransformer(mobius2.mcompile.MobiusTransformerMixin,
compile_template.TemplateTransformer):
grammar = mobius2.Parser.Parser("Grammar")
# ...
You can try executing in immediate mode:
import mobius2.Parser
g = mobius2.Parser.Parser("Grammar")
g.suite(open("interfacetest.py").read())
this should return a large nested tuple if the grammar is working.
Jeff