[ANN] redparse 0.8.1 Released

C

Caleb Clausen

RedParse version 0.8.1 has been released!

* <http://redparse.rubyforge.org/>
* <http://rubyforge.org/projects/redparse/>

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.

Changes:
### 0.8.1 / 2009-04-21
* 4 minor enhancements:
* fixed embarassing permissions problems
* version.rb and History.txt were missing from the release
* I left off the dependancy on reg, oops!
* hacked up tests to ignore trivial compare errors

== Benefits:
* Pure ruby, through and through. No part is written in C, YACC,
ANTLR, lisp, assembly, intercal, befunge or any other language
except ruby.
* Pretty AST trees (at least, I think so). (To program for, not
necessarily to look at.)
* AST trees closely mirror the actual structure of source code.
* ParseTree format output too, if you want that.
* 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.)
* "loosey-goosey" parser happily parses many expressions which normal
ruby considers errors.

== Drawbacks:
* Pathetically, rediculously slow (still working on that).
* Error handling is very minimal right now.
* No warnings at all.
* Some expressions aren't parsed correctly. see below.
* Line numbers in ParseTrees not supported yet.
* AST tree format is not finalized yet.
* Unit test takes a fairly long time.
* Lots of warnings printed during unit test.
* Debugging parse rules is not straightforward.
* No support for ruby 1.9.
* No support for any charset but ascii (until rubylexer gets it).
* "loosey-goosey" parser happily parses many expressions which normal
ruby considers errors.

* The following expressions are known to parse incorrectly currently:
* m.cn= 1, V
* "#{}"""
* begin;mode;rescue;o_chmod rescue nil;end
* def i;"..#{@@c = 1}";end
* e { |c|; print "%02X" % c }
* File.open() {|f| ; }
* %W(white\ \ \ \ \ space).should == ["white ", " ", " ", " space"]
* %w[- \\ e]
* %w[- \\ ]
* module A; b; rescue C=>d; e; else g; ensure f; end
* class A; b; rescue C=>d; e; else g; ensure f; end
* class<<A; b; rescue C=>d; e; else g; ensure f; end
* %w![ ] { } ( ) | - * . \\ ? + ^ $ #!


* <http://redparse.rubyforge.org/>
* <http://rubyforge.org/projects/redparse/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top