yacv: Yet Another Compiler Visualizer
yacv
is a tool for visualizing various aspects of typical LL(1) and LR parsers. Check out demo on YouTube to see sample visualizations
Introduction
Getting comfortable with parsing can be tough. While the legendary "Dragon Book" is an excellent resource for everything related to compilers, it still contains very minimal visualizations for the parsing process itself. That being said, there exist visualization tools such as LR(0) parser visualizer and LL(1) parser visualizer by Zak Kincaid and Shaowei Zhu, JSMachines, Jison etc. However, all of these tools are web-based and most of them show steps in a table which isn't very intuitive
yacv
attempts to overcome all these shortcomings by using manim
Primary features
yacv
takes in a context free grammar and a string and can be used to :
- Visualize the syntax tree
- Visualize the LR automaton
- Export the parsing table
- Visualize the parsing process step-by-step using manim
Installation
Requirements:
- Python 3.6+
pygraphviz
pandas
manim
:yacv
should theoretically work with both manim versions ( ManimGL or ManimCE ) but ManimCE is recommended
Issues with pycairo
? Check this
To install yacv
, clone the yacv
repository on GitHub to your local machine and then install using pip
$ git clone https://github.com/ashutoshbsathe/yacv
$ cd yacv
$ pip install -e .
Usage
To verify installation, run yacv
with the example configuration example_config.yml
$ yacv example_config.yml
To run with your own grammar and string, create your own custom config and use that instead. Examples of config files with various grammars can be found in examples/ directory
Documentation
For more information, please refer to the documentation
License
MIT