Ruby parser in Java

The project I am doing is written in Java and parsers source files. (Java src so far). Now I would like to enable Ruby code parsing. Therefore, I am looking for a parser in Java that parses Ruby source code.

The only thing I have managed to find so far is Ruby parsers in Ruby (ParseTree and RubyParser ...). I could parse the source files I want with a Ruby analyzer in JRuby, and then access my Java materials. But this will mean that I will not be able to reuse a lot of previously written Java code.

Is there a decent Ruby parser in Java there, and I just can't find it? Or does someone see a better solution?

+4
source share
2 answers

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

+1
source

All Articles