aptk

A Parse Toolkit
Download

aptk Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Kay-Uwe Lorenz

aptk Tags


aptk Description

aptk is a Python 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.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.orgBuilding DocumentationFor building documentation you need sphinx, you can get it using:: easy_install -U SphinxThen you can:: cd docs make html firefox _build/html/index.htmlProduct's homepage


aptk Related Software