Read time: 0.6 minutes (61 words)
Parser Application Entry Point¶
- This application is constructed as a single p
package named scadparser the entry point is in the 88main–.py file within that package;
You can launch the application using this Python command:
$ python -m scadparser --help
In the setup.py file in this project, we also create a simple command line file that will be available after installing the application code using pip.
First Parser¶
We can use this specification to generate a parser using a simple test file:
step01.py¶
1import tatsu
2from pprint import pprint
3
4
5def test():
6 g = open('scadparser/ebnf/scad01.ebnf').read()
7 parser = tatsu.compile(g)
8 ast = parser.parse('123')
9 pprint(ast)
10
11if __name__ == '__main__':
12 test()