simpleparse.examples.transformation
index
s:\sp\simpleparse\examples\transformation.py

A simple example of parsing
 
I have no idea for whom I originally created this code,
(which was originally written for SimpleParse 1.0) nor
why they wanted it.  Oh well, such is life.
 
Running as a script will do some timing tests, but the
tests are rather... simplistic.
 
The grammar is slow parsing around 5-10% of the speed I
normally expect from SimpleParse/mxTextTools parsers.
I'm guessing it gets into lots and lots of partial parses
of the "interesting" production, and that the huge number
of reported productions slows it down.  For example,
making atom non-reporting gives a 15% speedup on my
machine.

 
Modules
            
string
sys
 
Classes
            
Emitter
 
class Emitter
       
   Methods defined here:
emit(self, tree)
return transformation for a single tuple...
emitexample1(self, tuple)
*+AB+CD -> ++*AC*AD+*BC*BD
parse(self, data)
process(self, data)
write(self, data)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'simpleparse.examples.transformation'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
Data
             __file__ = r'S:\sp\simpleparse\examples\transformation.pyc'
__name__ = 'simpleparse.examples.transformation'
declaration = "\nset := (interesting/multset/plusset)+\nmul...(set/atom),'++',(set/atom),(set/atom),(set/atom)\n"
parser = <simpleparse.parser.Parser instance at 0x0083AAA8>