Skip to content
/ pegdebug Public

A debug viewer for Parsing Expression Grammars using cpp-peglib

License

Notifications You must be signed in to change notification settings

mqnc/pegdebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PEG debug

A debug viewer for Parsing Expression Grammars using cpp-peglib.

When writing grammars, it somehow often happens that they don't do what they were intended to do. This recursive explorer lets you investigate, why certain rules matched certain parts of text and why other rules did not. It does not only show the AST of the completed parsement, it illustrates the complete recursive parsing process, including not matching attempts.

Building

mkdir build
cd build
cmake ..
make

Running

./pegdebug ../example/pl0.peg ../example/gcd.pl0 ../example/output.html

Example

See here for exemplary output.

The left side displays the recursion tree of the parsing process. When a rule matches, it is green and the matching part of the string is highlighted. If it doesn't match, it is read. Both matching and not matching rules can be unfolded and investigated by clicking them.

The right side shows, what part of the text was matched by what rule. Hovering over the text makes an info window appear that shows the stack of rules that apply for the piece of text. Clicking freezes the info window and the matches for the rules in the rulestack can be highlighted by hovering over them.

Thanks

This project is supported by

GESTALT.ROBOTICS

GESTALT Robotics GmbH develops solutions for intelligent robotics and supplies your business with AI and automation.

About

A debug viewer for Parsing Expression Grammars using cpp-peglib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published