A Parse Toolkit. Create well documented grammars.
Project description
aptk - A Parse Toolkit
======================
This is a module for creating parsers from grammars. aPTK targets to make
this in a very "documented" way. So you can define the grammar in doc-string
of your grammar class or even in your reStructuredText documentation.
.. highlight:: aptk
A simple example of a greeting parser::
:grammar GreetingGrammar
<greeting> := <greeting-clause> <.ws> <greeted>
<ws> := \s+
<greeting-clause> := "hello" | "hi"
<greeted> := \w+
This will create a class named `GreetingGrammar`. First rule in the
grammar will be used as start-rule for a normal parsing. Parsing a
rule, will result in a ParseTree. Here follows an example of rule
``<greeting>`` matching "hello world"::
<greeting> ~~ "hello world"
-> greeting(
greeting-clause( 'hello' ),
greeted( 'world' )
)
Actually what you see above is a test assertion for applying rule greeting
to string "hello world", what is expected to result in the parse-tree
displayed above.
But read more in `aptk's documentation`_.
.. _aptk's documentation: http://aptk.readthedocs.org
Download
--------
You can download this package from PyPI_.
.. _PyPI:: http://pypi.python.org/pypi/aptk#downloads
.. highlight:: bash
Or install it with easy_install::
easy_install -U aptk
or get the the source from source code repository from bitbucket.org::
$ hg clone https://bitbucket.org/klorenz/aptk
Building Documentation
----------------------
For building documentation you need sphinx, you can get it using::
$ easy_install -U Sphinx
Then you can::
$ cd docs
$ make html
$ firefox _build/html/index.html
License
-------
Licensed under New BSD License, see LICENSE.txt.
Release Notes
-------------
======= =================================================================
Version Notes
======= =================================================================
0.5.7 add comments
0.5.4 first tests for postcircumfix pass, more tests, cleaned code a bit
0.5.3 Added operation precedence parser. Pretty simple yet, but supports
infix, postfix, prefix, circumfix operations. postcircumfix is
also implemented but not tested at all others are partly tested.
0.5 Starting with version 0.5, which shall indicate, that there is
still a lot to do.
Especially documentation is far from complete and it contains
some passages, which are already outdated.
Next releases will focus on documentation and testing and adding
an operator precendence parser.
======= =================================================================
======================
This is a module for creating parsers from grammars. aPTK targets to make
this in a very "documented" way. So you can define the grammar in doc-string
of your grammar class or even in your reStructuredText documentation.
.. highlight:: aptk
A simple example of a greeting parser::
:grammar GreetingGrammar
<greeting> := <greeting-clause> <.ws> <greeted>
<ws> := \s+
<greeting-clause> := "hello" | "hi"
<greeted> := \w+
This will create a class named `GreetingGrammar`. First rule in the
grammar will be used as start-rule for a normal parsing. Parsing a
rule, will result in a ParseTree. Here follows an example of rule
``<greeting>`` matching "hello world"::
<greeting> ~~ "hello world"
-> greeting(
greeting-clause( 'hello' ),
greeted( 'world' )
)
Actually what you see above is a test assertion for applying rule greeting
to string "hello world", what is expected to result in the parse-tree
displayed above.
But read more in `aptk's documentation`_.
.. _aptk's documentation: http://aptk.readthedocs.org
Download
--------
You can download this package from PyPI_.
.. _PyPI:: http://pypi.python.org/pypi/aptk#downloads
.. highlight:: bash
Or install it with easy_install::
easy_install -U aptk
or get the the source from source code repository from bitbucket.org::
$ hg clone https://bitbucket.org/klorenz/aptk
Building Documentation
----------------------
For building documentation you need sphinx, you can get it using::
$ easy_install -U Sphinx
Then you can::
$ cd docs
$ make html
$ firefox _build/html/index.html
License
-------
Licensed under New BSD License, see LICENSE.txt.
Release Notes
-------------
======= =================================================================
Version Notes
======= =================================================================
0.5.7 add comments
0.5.4 first tests for postcircumfix pass, more tests, cleaned code a bit
0.5.3 Added operation precedence parser. Pretty simple yet, but supports
infix, postfix, prefix, circumfix operations. postcircumfix is
also implemented but not tested at all others are partly tested.
0.5 Starting with version 0.5, which shall indicate, that there is
still a lot to do.
Especially documentation is far from complete and it contains
some passages, which are already outdated.
Next releases will focus on documentation and testing and adding
an operator precendence parser.
======= =================================================================
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
aptk-0.6.2.zip
(55.9 kB
view details)
aptk-0.6.2.tar.gz
(46.5 kB
view details)
Built Distribution
aptk-0.6.2.linux-i686.exe
(99.9 kB
view details)
File details
Details for the file aptk-0.6.2.zip
.
File metadata
- Download URL: aptk-0.6.2.zip
- Upload date:
- Size: 55.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 813aa1290da898ad72872bd739e655d4e0fbee1f2762fe326debdb4a7b0d015b |
|
MD5 | f2033b03d6812500541da86f7124f6b9 |
|
BLAKE2b-256 | 5499b4033bf7b4724289a0f4bc837615af063a95f759a23118055b1992194560 |
File details
Details for the file aptk-0.6.2.tar.gz
.
File metadata
- Download URL: aptk-0.6.2.tar.gz
- Upload date:
- Size: 46.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ab0e7680934163558bf058ad747a33d832976c4cc741b17b94fe5ab0e0441b3 |
|
MD5 | 5c3c4ea650fdd3c703ec71626dd3690a |
|
BLAKE2b-256 | f3cf6f54bc23102bcf861450d586ae0086ac12d566570e18e44cec6bb419f80b |
File details
Details for the file aptk-0.6.2.linux-i686.exe
.
File metadata
- Download URL: aptk-0.6.2.linux-i686.exe
- Upload date:
- Size: 99.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a396c7180752e9b83e11e6bd13db66d9abd10a9769bff6d399ea3440eb885425 |
|
MD5 | ef173a24f551b6d032b18aa50ff41ddd |
|
BLAKE2b-256 | e2f31b7a1e1555ed4566b0a84f6cae337a0022298206be93fd417ebd9e50c8ae |