Skip to content

jcomeauictx/python-antlr-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python ANTLR Example

I googled for an example of using ANTLR with Python3 and found bentrevett's repo, so I forked it to make a new one, up to date (May 2024) and for JavaScript instead of Java9.

I'm assuming Debian Bookworm or later as the dev environment.

Install ANTLR and Python bindings

sudo apt install antlr4 python3-antlr4

Download the grammar file (and example)

This is all built into the Makefile, so simply: make to download and run.

Write the code to tokenize

The parser jsparse.py was adapted from the README of the javascript grammar page.

References

About

Simplified bentrevett's example (parent repo) using a Makefile

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 73.8%
  • Makefile 17.8%
  • ANTLR 8.4%