5

The project I'm doing is written in Java and parsers source code files. (Java src up to now). Now I'd like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses Ruby source code.

The only thing I have been able to find up to now are Ruby parsers in Ruby (ParseTree and RubyParser...). I could maybe parse the source files I want with a Ruby parser in JRuby, and then access my Java stuff from there. But that would mean that I will not be able to reuse a lot of my previously written Java code.

Is there a decent Ruby parser in Java out there and have I just not be able to find it? Or does someone see a better solution?

2
  • this is relevant for me. did you find anything? Commented Aug 14, 2018 at 11:44
  • Huh, you found an old question of mine. :) I worked on this during my bachelors thesis... Sadly I never found an answer. Commented Aug 14, 2018 at 13:39

2 Answers 2

3

See http://kenai.com/projects/jruby-parser/

Sign up to request clarification or add additional context in comments.

1 Comment

Nice. Stumbled upon that before but the repo was down at the time and I feared the project was dead. Looks nice at the first glance, definitley a good start. Thanks.
1

You could let ANTLR generate a lexer/parser for you. They have a simplified Ruby grammar available: http://www.antlr.org/grammar/1160820213459/rubyParserLexerSPGrammar.g which may be sufficient for your needs.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.