Re:Show HN: Pest – Fast parser generator written in Rust
by DC-3 on Sunday August 27, 2017 @03:31PM
(#15112275)
What type of parser does this produce?
[ Parent
| on HN ]
Re:Show HN: Pest – Fast parser generator written in Rust
by dragostis on Sunday August 27, 2017 @03:50PM
(#15112349)
For now, it produces a recursive descent parser. Packrat parsing is an open-question since I'm afraid that adding a memoization layer all throughout the parser will lead to a consistent general slowdown.
Re:Show HN: Pest – Fast parser generator written in Rust
by DC-3 on Sunday August 27, 2017 @03:52PM
(#15112360)
Interesting. I'll try and find some time to read the source - am interested to see how this is implemented.
Re:Show HN: Pest – Fast parser generator written in Rust
by dragostis on Sunday August 27, 2017 @04:07PM
(#15112436)
A good place to start would be in the manually written example. [1] My current plan is to try and limit the the use of memoization such that it still guarantees linear parsing, but it doesn't memoize unless necessary.
[1]: https://github.com/pest-parser/pest/blob/master/pest/example...
Re:Show HN: Pest – Fast parser generator written in Rust
by DC-3 on Sunday August 27, 2017 @04:24PM
(#15112522)
I appreciate the link - I'm teaching myself about parsers right now and like the rest of HN I like Rust programs ;)
Re:Show HN: Pest – Fast parser generator written in Rust
by jmcomets on Sunday August 27, 2017 @03:37PM
(#15112299)
"Parsing expression grammars (PEGs) are an alternative to context free grammars for formally specifying syntax" [1]
Basically, you have tools for context free grammars such as GNU Bison or Yacc. This is an alternative, but with PEG.
For more in-depth info, there's the original PEG paper. [2]
[1]: http://bford.info/packrat [2]: http://bford.info/pub/lang/peg
Re:Show HN: Pest – Fast parser generator written in Rust
by yellowapple on Sunday August 27, 2017 @03:39PM
(#15112309)
That's the grammar, not the parser resulting from the grammar.
The README doesn't say, but most PEGs in the wild (AFAICT) compile down to / are implemented by packrat parsers.
Re:Show HN: Pest – Fast parser generator written in Rust
by yellowapple on Sunday August 27, 2017 @03:38PM
(#15112305)
With PEGs (like Pest), it's probably going to be a packrat parser (which would also make sense given the project's name).