Building an abstract syntax tree parser for your own domain specific language
pyastbuilder
is a python framework for building parsers that constructs an object tree that reflects the language's abstract syntax tree (AST), which can be pythonically navigated, searched and modified. Included in the package is one demonstrative example: a parser for the W3C SPARQL language, i.e., sparqlparser.py
, which implements Sparql v1.1. However, any other BNF-specified language can be facilitated.
Many specific or generic parsers exist, however the reason for developing pyastbuilder
is that often the parsing is considered a streaming, dynamic process in which several hooks exist to which one can attach ones own code, as opposed to the generation of a static, abstract syntax tree of the electronic "document", with an API for its access for post-parsed processing.
The heavy lifting about the actual parsing is left to pyparsing, which is included and extensively used.
We follow our following
DESIGN PRINCIPLE: Be Predictive. Define clear criteria for the location of documentation. What part of the documentation is put in the README files, what parts can be found on the wiki pages, and what information do you put in-code as comments? Define and document your documentation criteria, preferably in the principle piece of documentation that your user or developer will hit, which probably is the project's README.md file.
We therefore follow the following criteria regarding documentation:
pyastparser
, will be documented as README.md files in every folder of the source tree.pyastbuilder
, as well as all detailed, code-specific documentation is available throughout the source code as reStructuredText (reST) markup syntax. Since this type of documentation follows the convention of python pydoc, their corresponding HTML-pages can be generated. The documentation will be available after building the HTML by pointing a browser at the file Doc/build/html/index.html
(TODO).These will contain that part of the documentation that involves the generic design about the source code that is available in the particular part of the tree. This documentation is aimed at the developers of the project with the purpose to provide them with a thorough understanding of:
A complete overview of the wiki documentation can be found at the wiki Home page. One can expext the following entries:
sparqlparser
as library in your own python code, as well as any other out-of-the-box xxxparser
that might be provided in the future of this project. Since any other xxxparser
will be based on this same project, we can safely assume to find many references to very similar or even identical use-cases from the sparqlparser
.xxxparser
, please share this with this project and provide for your own Chapter in our User Manual about the use of this parser. However: Do Not Duplicate documentation, but use the sparqlparser
manual as reference manual instead.Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participate(d) in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details