ruby_parser version 1.0.0 has been released!
ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
racc–which does by default use a C extension). RP’s output is
the same as ParseTree’s output: s-expressions using ruby’s arrays and
base types.
FEATURES/PROBLEMS:
- Pure ruby, no compiles.
- Incredibly simple interface.
- Output is 100% equivalent to ParseTree.
- Can utilize PT’s SexpProcessor and UnifiedRuby for language
processing.
- Known Issue: Speed sucks currently. 5500 tests currently run in 21
min.
- Known Issue: Code is waaay ugly. Port of a port. Not my fault. Will
fix RSN.
- Known Issue: I don’t currently support newline nodes.
- Known Issue: Totally awesome.
- Known Issue: dasgn_curr decls can be out of order from ParseTree’s.
- TODO: Add comment nodes.
SYNOPSIS:
RubyParser.new.parse “1+1”
=> s(:call, s(:lit, 1), :+, s(:array, s(:lit, 1)))
Changes:
1.0.0 / 2007-12-20
Ryan D. wrote:
ruby_parser version 1.0.0 has been released!
ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
racc–which does by default use a C extension). RP’s output is
the same as ParseTree’s output: s-expressions using ruby’s arrays and
base types.
I assume this doesn’t work with 1.9 [the racc, at least]?
Thanks!
-R
Roger P. wrote:
Ryan D. wrote:
ruby_parser version 1.0.0 has been released!
ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
racc–which does by default use a C extension). RP’s output is
the same as ParseTree’s output: s-expressions using ruby’s arrays and
base types.
I assume this doesn’t work with 1.9 [the racc, at least]?
Thanks!
-R
Answering my own question [in 1.9 SVN HEAD]
RubyParser.new.parse “1+1”
/Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617:
[BUG] Bus Error
ruby 1.9.0 (2008-07-23 revision 17865) [i686-darwin9.3.0]
– control frame ----------
c:0029 p:---- s:0098 b:0098 l:000097 d:000097 CFUNC :method_missing
c:0028 p:---- s:0096 b:0096 l:000095 d:000095 CFUNC :old_initialize
c:0027 p:0029 s:0092 b:0092 l:000091 d:000091 METHOD
/Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/ruby_parser-1.0.0/lib/ruby_lexer.rb:2617
c:0026 p:---- s:0088 b:0088 l:000087 d:000087 FINISH :(null)
…
As a note 1.9 does include racc still, as an extension, so I don’t think
this is expected.
Guess I’ll file it away to the core people.
-R
On Jul 19, 2008, at 21:41 , Roger P. wrote:
I assume this doesn’t work with 1.9 [the racc, at least]?
nope. it works with 1.9 just fine. why?
I get a silent failure on 1.9.0-2, but it worked on 1.9.0-1. I’ll look
into it but would appreciate if you filed a bug.
Thanks for looking into that. I filed something but it was a little
obscure.
http://rubyforge.org/tracker/index.php?func=detail&aid=21263&group_id=439&atid=1781
Thanks!
-R
On Jul 22, 2008, at 16:22 , Roger P. wrote:
base types.
[BUG] Bus Error
ruby 1.9.0 (2008-07-23 revision 17865) [i686-darwin9.3.0]
– control frame ----------
c:0029 p:---- s:0098 b:0098 l:000097 d:000097 CFUNC :method_missing
c:0028 p:---- s:0096 b:0096 l:000095 d:000095 CFUNC :old_initialize
c:0027 p:0029 s:0092 b:0092 l:000091 d:000091 METHOD
/Users/rogerpack/dev/ruby_19_installed/lib/ruby/gems/1.9.0/gems/
ruby_parser-1.0.0/lib/ruby_lexer.rb:2617
c:0026 p:---- s:0088 b:0088 l:000087 d:000087 FINISH :(null)
…
I get a silent failure on 1.9.0-2, but it worked on 1.9.0-1. I’ll look
into it but would appreciate if you filed a bug.