Skip to content
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

Migrate to FastParse #23

Open
laughedelic opened this issue Oct 15, 2017 · 6 comments
Open

Migrate to FastParse #23

laughedelic opened this issue Oct 15, 2017 · 6 comments

Comments

@laughedelic
Copy link
Owner

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.

@mfirry
Copy link

mfirry commented Oct 25, 2018

I think one would first need to check if fastparse offers something like RegexParsers, right?

@laughedelic
Copy link
Owner Author

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.

@mfirry
Copy link

mfirry commented Nov 6, 2018

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.

@laughedelic
Copy link
Owner Author

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.

@SemanticBeeng
Copy link

SemanticBeeng commented Dec 31, 2018

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.

Twitter
@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.”

@SemanticBeeng
Copy link

@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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants