mackenzie-high / snowflake Goto Github PK
View Code? Open in Web Editor NEWSnowflake is a Parsing Expression Grammar (PEG) library and graphical parser-generator.
Home Page: https://www.mackenziehigh.com/snowflake/
License: Other
Snowflake is a Parsing Expression Grammar (PEG) library and graphical parser-generator.
Home Page: https://www.mackenziehigh.com/snowflake/
License: Other
Add findChild(String name) : ITreeNode and findChildren(String name) : List to the ITreeNode class. These are simply convenience methods that perform a DFS by calling the static equivalents that already exist.
This method is usually needed, so it might as well be auto-generated.
Currently, there is not a way to force stop a parser. This functionality should be added. Then, as a separate addition, the functionality should be integrated with the GUI in order to allow the user to stop parsing attempts at will.
Currently, the code-generator generates a visit() method containing an if-elif-else comprised of string equality tests. This should be converted to either a string-switch or a HashMap of lambdas.
In the future, it would be nice for Snowflake to support user-defined timeouts and recursion-depth-limits in order to make the parser behave better when one accidentally creates a left-recursive grammar. In addition, it may be possible to add functionality to limit the (global) maximum number of match attempts.
Currently, users must have the snowflake library on the CLASSPATH in order to use a generated parser. This can be undesirable in some circumstances. It may be possible to create a single class file containing the generated parser, generated visitor, and a copy of the parser library embedded therein as nested classes. This would be a cheap way of providing the desired functionality.
Suppose that you have the following grammar rules:
ESCAPE_B = "\b";
ESCAPE_T = "\t";
ESCAPE_N = "\n";
ESCAPE_F = "\f";
ESCAPE_R = "\r";
ESCAPE_SL = "\";
ESCAPE_SQ = "'";
Then, the following parser configuration code will be generated.
g.str("ESCAPE_B", "\b");
g.str("ESCAPE_F", "\f");
g.str("ESCAPE_N", "\n");
g.str("ESCAPE_R", "\r");
g.str("ESCAPE_SL", "\");
g.str("ESCAPE_SQ", "'");
g.str("ESCAPE_T", "\t");
However, the correct code would be:
g.str("ESCAPE_B", "\b");
g.str("ESCAPE_F", "\f");
g.str("ESCAPE_N", "\n");
g.str("ESCAPE_R", "\r");
g.str("ESCAPE_SL", "\\");
g.str("ESCAPE_SQ", "\'");
g.str("ESCAPE_T", "\t");
Work Around:
ESCAPE_B = '' , 'b';
ESCAPE_T = '' , 't';
ESCAPE_N = '' , 'n';
ESCAPE_F = '', 'f';
ESCAPE_R = '', 'r';
ESCAPE_SL = '','";
ESCAPE_SQ = '', "'";
This is a bug in the code-generator, not in the snowflake library itself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.