-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scannerless parsing #23
Conversation
# Conflicts: # src/commonMain/kotlin/me/alllex/parsus/parser/Lexer.kt
Hey @alllex, just wanted to let you know that I've tried the changes you made using a local build of I can now easily declare my parser as a series of expected tokens or combinations thereof, basically just translating the specification document to Kotlin. I really, really like the declarativeness and composability this entails. Thank you for your work. I'm looking forward for the next release. |
In this approach to parsing, there is no separate tokenization process. Instead, each parser tries to directly parse a token it expects.
This has a number of advantages:
or
sequence).The main drawback for now is a slight drop in performance. This is due to inability to proactively extract the next token and make smarter work avoidance decisions (e.g. jumping directly to the right parser in the set of alternatives using the 1-token lookahead). However, this is a small price to pay for added flexibility and developer experience.
This is related and alleviates the problems described in