Pasukon – The easy JavaScript parser generator
pasukon.rocks
pasukon.rocks
A small critique: it might be useful to include a small explainer of why parsers / ADTs are useful - maybe in the context of decoding JSON.
(Learning about ADTs shifted the way that I think about data modelling and application development, so I am a huge fan.)
I mean this as constructive criticize, apologies if it feels too harsh.
Did you see the GitHub repo's README? I do ellaborate a bit over there. Do you think I should explain the basics in the website too? Or maybe just link to the wiki once I have that "Getting Started" guide up?
I'm not sure what this gives me over and above yacc/lex (for C) or PLY (for Python).
I certainly could have chosen another syntax, but I settled for that one. Because the user can define their own combinators I can't just hard-code all combinators into the syntax.
For example `*:A` is alias for `(many0 (token A))` but if the user defines his/her own unary combinator, I need a way to let him/her call it without changing the syntax.
1. Is there a Pasukon grammar for JavaScript/ES6?
2. Is there a Pasukon grammar for Pasukon grammars?
2. Yup: https://github.com/gosukiwi/Pasukon/blob/master/lib/grammar....
Initially I started using PEGjs, and then swapped once it was ready.
It looks like a great package. I have loved parser combinators forever.
It can emit parser in many languages.
There are also a couple of udemy courses from the author, about parsing and language creation. They are quite good imho.
It can parse any context-free language, so it should have no problem parsing CommonMark.
a) romanization of the Japanese pronunciation of PC ("personal computer" -> "PersCom" Japanese abbreviations of English tend to concatenate the initial syllable of every word, and "n" and "m" end up sounding very similar).
b) "parser combinator" would have the same abbreviation in Japanese
I originally designed Pasukon as an alternative to PEGjs. A way to quickly prototype a language and generate an usable parser. What I didn't like much about PEGjs is the lack of extensibility, so I added the ability to use your own lexer and combinators to really fine-tune the parser if needed.
Also PEGjs struggles with indent-based grammars, because it can't use caching with those, and it can get quite slow. That gets solved by using a lexing step which outputs proper `INDENT` and `DEDENT` tokens.