Migrate to FastParse
laughedelic opened this issue · 6 comments
Although scala-parser-combinators are available for Scala 2.12, I want to try to migrate to FastParse (which btw, just released 1.0):
- should be easy to do, since the combinators syntax is similar
- will work significantly faster
- will provide better error messages (if any)
I'm not sure whether it's worth specializing the parsers to Scala (as FastParse provides a ready to use ScalaParse combinators). As a first try I want just to migrate existing parsers to FastParse.
I think one would first need to check if fastparse
offers something like RegexParsers
, right?
Hi @mfirry! I'm sorry if you were interested in this during the Hacktoberfest and my reply is late. Anyways, I think regex parsers are not needed for literator, they are used here in a couple of places and could be replaced with some FastParse primitives. The rest is just combining simple parsers to combine a more complex ones, it should be quite straightforward to translate it to FastParse syntax.
Thanks @laughedelic. I've been looking for a (toyish-)project to learn how to use parsers and parsers combinators for a while, and yeah Hacktoberfest was just an excuse but it's fine.
I'd be interesting in helping out with moving over to FastParse if you can guide me in the right direction.
When I looked at the code I found case class LiteratorParsers(val lang: Language) extends RegexParsers
right away so that's why I figured that was needed.
Let me know how and if I can help.
Nice! Sure, I'll be glad to guide you if you want to try your hand at this. And I'll be more responsive in the future (you caught me in the middle of a move to another country 😅).
About RegexParsers
: I see now where you got that idea. I pretty sure it the old parser combinators library-specific way to define parsers with some given context. So in FastParse it will be different and there's no problem with it.
Now we have PythonParse
: what would it take to make literator
work same way for both Scala and Python?
http://www.lihaoyi.com/post/Fastparse2EvenFasterScalaParserCombinators.html
@laughedelic what is your assessment on the value of doing this given your work on bio4j
?
Always been looking to link code to concepts in wiki, across languages. See 4-5 tweets around here https://twitter.com/semanticbeeng/status/1079445197484904450. If interested in this sort of thing I can document as a separate feature request.
“@olafurpg Wes, thanks for interest. My goal is to maintain rich knowledge in a wiki style but very close to code (Intellij ideal). See https://t.co/klVxm89iS6 for context. Like also what Specs2 (see https://t.co/aMdl2ktCED) does but mdoc is better because of scalameta foundation.”
@laughedelic scala.meta
already uses fastparse
: scalameta/scalameta#556 (comment) + scalameta/scalameta#1800
Would you say it makes sense to use scala.meta
in literator
?