Input an antlr grammar and file for python to test it out

Overview

py-antlr-input

Input an ANTLR grammar and test file for python to render a parser tree of the file. This program will make use of the grun command that comes with ANTLR.

Requirements

  • python 3.5 or higher
  • tkinter (python library)
  • java
  • ANTLR (with antlr4 and grun commands configured)

Usage

With your terminal, go to the repo directory and run:

python ./main.py

from there, the program should guide you. Take into account that you'll need:

  • The name of the grammar
  • An ANTLR4 grammar file (.g4)
  • The name of the start rule
  • A test file for your output language

You may also use the default Decaf grammar file specified in Decaf/Decaf.g4 by adding Decaf as an argument

python ./main.py Decaf

This will make the program only ask for the .decaf file you want to see the parser tree of.

Examples

Cow.decaf

This file has a lot of defined rules covered. Here's the parse tree for the code:

test.decaf

Just a regular test file. Useful when testing the grammar for the first time. Here's the code

Error handling

If there's just a small amount of errors, then the program will still render the parse tree with a bit of red highlighted where the code wasn't correcty specified. Make sure to check the terminal output for more details.

Support

This tools has support for both Windows and Unix based operative systems.

References

Author

  • Oscar Juárez
You might also like...
Python Screen Recorder using Python

PY-Screen-Recorder Python Screen Recorder using Python Requirement: pip install cv2 pip install pyautogui pip install numpy How to reach me? You can r

Write desktop and web apps in pure Python
Write desktop and web apps in pure Python

Flexx Want to stay up-to-date about (changes to) Flexx? Subscribe to the NEWS issue. Introduction Flexx is a pure Python toolkit for creating graphica

Build GUI for your Python program with JavaScript, HTML, and CSS
Build GUI for your Python program with JavaScript, HTML, and CSS

https://pywebview.flowrl.com pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its o

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies

(This library is available under a free and permissive license however, if you Enjoy Dear PyGui please consider becoming a Sponsor) Dear PyGui is a si

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS
Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS

Kivy Innovative user interfaces made easy. Kivy is an open source, cross-platform Python framework for the development of applications that make use o

Write desktop and web apps in pure Python
Write desktop and web apps in pure Python

Flexx Want to stay up-to-date about (changes to) Flexx? Subscribe to the NEWS issue. Introduction Flexx is a pure Python toolkit for creating graphica

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies

(This library is available under a free and permissive license however, if you Enjoy Dear PyGui please consider becoming a Sponsor) Dear PyGui is a si

Pyabr lightweight OS with Python and Qt

Pyabr cloud computing software In the name of God, the Compassionate, the Merciful Pyabr © 2021 Mani Jamali. Free Software GNU General Public License

My Git GUI version made in Python and Tkinter.

Description My Git GUI version made in Python and Tkinter. How to use Basically, create a folder in your computer, open the software, select the path

Owner
Oscar Juárez
Oscar Juárez
This was my test project when i started to learn Python Tkinter. Its the simplest interface possible.

Rock-Paper-Scissors-Game- Project Description: This was my test project when i started to learn Python Tkinter. Its the simplest interface possible. R

Hassan Shahzad 2 Jan 17, 2022
Create shortcuts on Windows to your Python, EXE, Batch files or any other file using a GUI made with PySimpleGUI

shor Windows Shortcut Creation Create Windows Shortcuts to your python programs and any other file easily using this application created using PySimpl

PySimpleGUI 7 Nov 16, 2021
The GUI application by Python3.8. Using QT Design draw UI and generator UI XML file provides to PySide2 build GUI components

The GUI application by Python3.8. Using QT Design draw UI and generator UI XML file provides to PySide2 build GUI components. Total adopt OOD design class, service, and abstract class. OOP implemented this project.

Jiage 1 Jan 11, 2022
A lightweight file-copying interface.

autosort A lightweight file-copying interface. Preview What is autosort? Autosort is a lightweight file-copying interface. It allows you to copy sever

null 32 Jan 2, 2023
Verify file hashes of downloaded files easily in a GUI

HASH-verify Verify file hashes of downloaded files easily in a GUI What it does... This gui based Python3 app calculates 3 types of file hashes and ca

Christian Richter-Pedersen 10 Dec 13, 2022
UI for converting various point cloud file formats

Point cloud format converter This coverter based on open3d. If you're using old ROS1 i suggest to use conda python3 evn to install requirements. Todo

Haegu Lee 1 Oct 29, 2021
pyglet is a cross-platform windowing and multimedia library for Python, for developing games and other visually rich applications.

pyglet pyglet is a cross-platform windowing and multimedia library for Python, intended for developing games and other visually rich applications. It

null 1.3k Jan 1, 2023
A desktop application developed in Python with PyQt5 to predict demand and help monitor and schedule brewing processes for Barnaby's Brewhouse.

brewhouse-management A desktop application developed in Python with PyQt5 to predict demand and help monitor and schedule brewing processes for Barnab

Isaac Cheng 2 Jul 9, 2022
Learn to build a Python Desktop GUI app using pywebview, Python, JavaScript, HTML, & CSS.

Python Desktop App Learn how to make a desktop GUI application using Python, JavaScript, HTML, & CSS all thanks to pywebview. pywebview is essentially

Coding For Entrepreneurs 55 Jan 5, 2023