Skip to content

ashutoshbsathe/yacv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 :

  1. Visualize the syntax tree
  2. Visualize the LR automaton
  3. Export the parsing table
  4. Visualize the parsing process step-by-step using manim

Installation

Requirements:

  1. Python 3.6+
  2. pygraphviz
  3. pandas
  4. 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

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

Interesting Reads

  1. A good, free book for interpreters
  2. GCC does not use machine generated parsers
  3. Why LL and LR parsing is hard ?

I have also written a blog about how I built this project . Check it out here