4.1.1 |
|
---|---|
4.0.0 |
|
3.1.0 |
|
2.1.0 |
|
1.0.2 |
|
#159 in #parser-combinator
51 downloads per month
28KB
511 lines
Informal
A macro-based parser combinator library.
lib.rs
:
Informal is a library to help build your own parser using a few simple declarative macros.
Each macro translates to a function with the type fn (String, usize) ->
ParseResult
.
Usage
Macros from informal
are largely just syntactic sugar for writing parsing functions, so they end up looking like simplified function declarations.
informal
macros will take an identifier, then a block containing that parser's one or more children depending on the specific macro.
Example
For example, parsing a terminal symbol can be done by calling the just!
macro like so:
just!( pub plus { "+"; } );
Notice you can specify pub
visibility like a regular function.
The above macro call declares a function that can be called with the same identifier you provided with a String
and a usize
as arguments.
assert!( plus ( String::from("+"), 0 ).is_ok() );
Dependencies
~2.1–3MB
~54K SLoC