-
Notifications
You must be signed in to change notification settings - Fork 14
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
Rewrite Catharsis as a Pratt parser #54
Comments
FWIW, I see there is https://www.npmjs.com/package/pratt-parser Btw, also regarding the project future, until such time as you may move to such a parser, are you still accepting PRs here? I'd like to add a routine for having the Unicode rules be auto-generated from the https://github.com/mathiasbynens/node-unicode-data for the latest Unicode support, and also to make use of much more succinct regex-like ranges as PegJS supports. Also would be interested to know if you'd accept PRs to add support for a TypeScript mode to parse TS expressions... |
@brettz9 because I saw this post and I was curious to learn more about pratt-parsers, I just wrote one that parses jsdoc types. I used the carthasis test suites to test my Parser and might use the jsdoctypeparser ones as well. So far it passes all catharsis tests but one in the main I looked at catharsis and at jsdoctypeparser for inspiration for the output. So far the results are pretty near to catharsis and I also wrote a catharsis compat mode - to be able to use the test suites directly. I might write one for jsdoctypeparser as well. I uploaded the project to https://github.com/simonseyock/jsdoc-type-pratt-parser, but did not write any documentation yet. If this is interesting to you I am grateful for any input. Also I am willing to write some documentation XD I did not think much about modes (closure, jsdoc, typescript) and any other functionality apart from parsing. |
Excellent! I'd love to be able to use such an engine in So, yes, I'm very interested. Just have to give a warning that my health isn't great, so I can be flaky and unreliable at times, and at other times, if I have energy, may be able to plow forward for a time. I've watched your repo, and if you get to adding some docs, hope you can file an alpha release or file an issue or something. |
(Disclaimer: I'll probably never actually do this.)
Catharsis's parser is currently generated by PEG.js from a parsing expression grammar. That seemed like a good choice when I made it. Over time, though, as I've implemented more and more undocumented things that Closure Compiler supports, the grammar has become quite brittle and difficult to change.
In the unlikely event that I'm ever so inclined, it would be interesting to try to reimplement Catharsis as a Pratt parser, which should be more flexible while still being reasonably straightforward to implement by hand.
The text was updated successfully, but these errors were encountered: