Snowflake lets you interactively create PEG-based recursive-descent parsers via a GUI.
Quick Links:
Maven Dependency:
<dependency>
<groupId>com.mackenziehigh</groupId>
<artifactId>snowflake</artifactId>
<version>2.0</version>
</dependency>
Step: Download GUI from Maven Central:
Click Here to download the ready-to-run Snowflake JAR file.
Step: Run the GUI
java -cp snowflake-2.0.jar com.mackenziehigh.snowflake.designer.gui.MainWindow
The following window will appear on screen.
Step: Download the Demonstration Grammar:
Click Here to download the planet-demo.snow
file.
Step: Open the Demonstation Grammar:
- Click
File -> Open Project
- Select the
planet-demo.snow
file that you just downloaded in the previous step.
The GUI will be populated with the grammar and example from the planet-demo.snow
file.
The example input is displayed on the Input
tab of the GUI.
Step: Parse the Example Input:
Click Action -> Parse
on the GUI.
The grammar will be used to parse the example input and then the resulting parse tree will be displayed.
The nodes in the tree correspond to the matching grammar rules.
Click on nodes to see the portion of text corresponding to that node.
Here is a powerpoint presentation that will introduce you to parsing using Parsing Expression Grammars.
These projects include executable example programs that utilize Snowflake for parsing.