Python version of SimplePEG
Project description
Python version of SimplePEG
--------
To use, simply do::
>>> import SPEG from simplepeg
>>> parser = s.SPEG()
>>> # will throw Exception if grammar is invalid
>>> parser.parse_grammar('GRAMMAR test b -> "a";')
>>> # will throw Exception if text have invalid grammar
>>> ast = parser.parse_text('a')
>>> print ast.to_json()
or::
>>> import SPEG from simplepeg
>>> parser = s.SPEG()
>>> ast = parser.parse('GRAMMAR test b -> "a";', 'a')
>>> print ast.to_json()
--------
To use, simply do::
>>> import SPEG from simplepeg
>>> parser = s.SPEG()
>>> # will throw Exception if grammar is invalid
>>> parser.parse_grammar('GRAMMAR test b -> "a";')
>>> # will throw Exception if text have invalid grammar
>>> ast = parser.parse_text('a')
>>> print ast.to_json()
or::
>>> import SPEG from simplepeg
>>> parser = s.SPEG()
>>> ast = parser.parse('GRAMMAR test b -> "a";', 'a')
>>> print ast.to_json()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size simplepeg-1.0.0.tar.gz (4.6 kB) | File type Source | Python version None | Upload date | Hashes View |