RedParse is a ruby parser written in pure ruby. Instead of YACC or
ANTLR, it’s parse tool is a home-brewed “compiler-interpreter”. (The
tool is LALR(1)-equivalent and the ‘parse language’ is pretty nice,
even in it’s current crude form.)

My intent is to have a completely correct parser for ruby, in 100%
ruby. It’s not all there yet, but I’m getting pretty close. Currently,
RedParse can parse slightly in excess of 99% of ruby files found in
the wild. For known problems, see below.

== REQUIREMENTS:

RedParse requires RubyLexer, my hand-coded lexer for ruby. It also
uses Reg, (a pattern-matcher). RubyLexer depends on Sequence,
(external iterators). Reg depends on Sequence’s predecessor, Cursor,
altho Cursor isn’t used at all in RedParse. The (long-delayed) next
version of Reg will use Sequence. To summarize:

RedParse 0.9.0 requires RubyLexer>=0.7.1 and Reg>=0.4.7

RubyLexer 0.7.1 requires Sequence>=0.2.0

Reg 0.4.7 requires Cursor (not really needed here)

All are available as gems. (Or tarballs on rubyforge, if you must.)

== INSTALL:

gem install redparse #(if root as necssary)

== LICENSE:

RedParse is available under the Library General Public License (LGPL).
Please see COPYING.LGPL for details.

== Benefits:

Pure ruby, through and through. No part is written in C, YACC,
ANTLR, lisp, assembly, intercal, befunge or any other language
except ruby.

Did I mention that there’s no YACC at all? YACC grammars are
notoriously difficult to modify, (I’ve never successfully done it)
but I’ve found it easy, at times even pleasant to modify the parse
rules of this grammar as necessary.

Relatively small parser: 70 rules in 240 lines
(vs (by my count) 320 rules in 2200 lines for MRI 1.8.7. This is
by no means a fair comparison, tho, since RubyLexer does a lot
more than MRI’s lexer, and MRI’s 2200 lines include its
actions (which occupy somewhere under 3100 lines in RedParse).
Also, what is a rule? I counted most things which required a
separate action in MRI’s parser, I’m not sure if that’s fair.
But in the end, I still think RedParse is still much easier to
understand than MRI’s parse.y.)