Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a parser combinator as awesome as the Scala one for Java?

I read the tutorial on parser combinators for Scala, and I was wondering if there's something as "magical" for Java. The best thing I could find was JParsec.

like image 783
nes1983 Avatar asked Mar 09 '11 10:03

nes1983


2 Answers

JParsec seems to do the trick, but I cannot comment on its quality. Java has no operator overloading, which is the syntactic part of the "magic" in parser combinators.

You could also use Scala to implement parsers, then call them from Java. But then the benefit over a code generator such as JavaCC isn't as great.

like image 148
Fred Foo Avatar answered Sep 19 '22 15:09

Fred Foo


I've come to enjoy jParsec, even if it isn't as hot as, say, the Newspeak parser combinator. We've shot an aweseome video tutorial on how to use JParsec.

like image 29
nes1983 Avatar answered Sep 19 '22 15:09

nes1983