Piston-Meta is a research project under the Piston project to explore the use of meta parsing and composing for data oriented design. Meta parsing is a technique where you use a rules to describe how to transform a text into a tree structure, in a similar way that a parser generator can generate code for reading a text by a grammar, except that the rules in meta parsing can be changed at run time, or even read from a text described by the same rules. Piston-Meta is inspired by OMeta (https://en.wikipedia.org/wiki/OMeta) developed at Viewpoints Research Institute in 2007.
New features
Parsing is now working! This library contains the rules and parse algorithms. For examples, see the unit tests.
The deepest error is picked to make better error messages. When a text is parsed successfully, the result contains an optional error which can be used for additional success checks, for example whether it reached the end of a file.
Node
(allows reuse a rule and reference itself)Number
(reads f64)Optional
(a sequence of rules that can fail without failing parent rule)Rule
(an enum for all the rules)Select
(tries one sub rule and continues if it fails)SeparatedBy
(separates a rule by another rule)Sequence
(rules in sequence)Text
(a JSON string)Token
(expects a sequence of characters)UntilAnyOrWhitespace
(reads until it hits any of the specified characters or whitespace)Whitespace
(reads whitespace)