yacv
is a tool for visualizing various aspects of typical LL(1) and LR parsers. Check out demo on YouTube to see sample visualizations
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
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
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 .
Check extra notes for install on Ubuntu WSL in the docs
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
For more information, please refer to the documentation
MIT
- A good, free book for interpreters
- GCC does not use machine generated parsers
- Why LL and LR parsing is hard ?
I have also written a blog about how I built this project . Check it out here