Comments (7)
There is now an example of arithmetic expression parsing, although not based on a Pratt parser. Parser combinators embed the precedence rules in the way functions refer to each other.
from nom.
ok, so, I gave it some thought. It would be possible to use nom as a lexer, and let a Pratt parser handle precedence.
I have been thinking for some time about adding multiple parsing systems over nom, like GLL, LL, etc. Hammer is an example of parser combinators used with different parsing backends.
from nom.
FYI #1690 is the issue for tracking the status of built-in Pratt Parser support.
from nom.
from nom.
I'm trying to write a generic Pratt parser using Nom, and arriving at difficulty. Since parsers must be a function (I think?) and not something implementing a trait, there is nowhere for the parser to store the state on token precedence.
from nom.
I'm honestly not even sure how you would use Nom in the traditional context of parsing a context-free language.
from nom.
This is the first result when you Google "rust nom pratt parse". Has anything changed since 2015? I was hoping to find a recipe for “you can write your expression
rule as a Pratt parser (by hand), and then this is how you integrate it into nom
for the rest of the grammar“.
from nom.
Related Issues (20)
- How to parse until a range of tags HOT 3
- Mention difference between is_not and take_until in their respective docs.
- I was going to complain about an issue in the function take_while_m_n, but [update : and I will do] ...
- Add u48 number parser HOT 1
- I want to implement `separated_tuple` for 8.0 HOT 7
- `tag_no_case` panicks while matching certain unicode capitalized characters.
- Ergonomics of `alt()` taking tuple versus slice HOT 3
- A new release for 8.0?
- FromStr-esque parsing trait HOT 1
- Float parsing with trailing `e` broken
- A fix has to be implemented by those dependencies HOT 7
- FlatMap does not properly implement Parser HOT 2
- Feature Request: Add branching parser combinator for `exclude()` and `depend()` HOT 1
- Document (or fix?) the fact that escaped() succeeds on empty inputs HOT 7
- Stack overflow before parsing HOT 1
- fold's param init func should be FnOnce instead of FnMut HOT 3
- Profile-Guided Optimization (PGO) benchmark results
- Fn / FnMut HOT 7
- Suprised by error from `is_not` on empty result
- feature request: `maybe_delimited` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nom.