Recently in ruby_parser Category

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.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.3.1 / 2011-09-21

Bug Bounty Scorecard

| | Comments (0)

I'm sorta amazed at how well this has worked so far:

CommitFailuresErrorsUserNotes
6683 6 10zenspider original bounty count
6684 5 10albus522 1 fix $50 paid
6687 4 8albus5223 fix $150 paid
6688 1 8nobu3 fix $150 paid
6689 1 4jamie4 fix

So far I've paid out $350 and another $200 is due. There is still $250 to be made and you get to help out projects like flog and flay work on 1.9!

First bounty claimed!

| | Comments (0)

I just merged Fixed test_call_not_equal__19 so less than 24 hours later the first ruby_parser bug bounty has been claimed!

A quick transcript of my rubyconf 2011 lightning-talk slides:

We all know and love ParseTree, but it sorta sucks:

runs on 1.8runs on 1.9
parses 1.8
parses 1.9

ruby_parser gets us much closer by running on 1.9 (and every ruby implementation under the sun):

runs on 1.8runs on 1.9
parses 1.8
parses 1.9

We have lots of tests and they run really fast. On 1.9 we have 16 non-passing test cases:

10009 % rake19
Test run options: --seed 8509

Loaded suite -e
Started

...........................................................................
...........................................................................
...........................................................................
...........................................................................
...E............................F...........................E..............
E.......................F..................................................
....................E....F.....E..EF.......................................
.....F.................................................F...................
.....E........................E.......................E.......E............
............................

Finished in 0.355610 seconds.

  1) Error:

Oh dear god the errors...

703 tests, 3847 assertions, 6 failures, 10 errors, 0 skips

Test run options: --seed 8509
Wanted: 6 Failures, 10 Errors -- dead or alive
$50 / fix
(First solution per failure wins)

fork, fix, push, and submit pull request

Requirements:

  1. gem install isolate
  2. rake
  3. there is no step 3

I'm available to help you get started

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.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.3.1 / 2011-09-21

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.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.3.0 / 2011-09-06

  • 2 minor enhancements:

    • Add -g flag to parser compile if DEBUG
    • Lexer now embeds line number in yacc_value for keywords, helping fix up line numbers
  • 3 bug fixes:

    • Fix method line numbers when no args and no parens (quix)
    • Fixed line numbers on return/break/next w/ result expr. (pjnz)
    • Fixed some lexing state in order to parse: 'f (1), 2' as 'f(1, 2)'. (invernizzi)
  • https://github.com/seattlerb/ruby_parser

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.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.2.0 / 2011-08-23

  • 2 minor enhancements:

    • Moved Keyword, Environment, and StackState inside of RubyParser
    • Added proper dsym and dsym->sym support.
  • 3 bug fixes:

    • Added extra (failing) tests for call/iter line number checking (quix)
    • Fixed line numbers for certain call/iter edge cases
    • Fixed parsing of: alias :"<<" :">>".
  • https://github.com/seattlerb/ruby_parser

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.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.1.0 / 2011-08-15

  • 2 minor enhancements:

    • Added new accessor canonicalize_conditions to toggle conditional canonicalization (on by default). (confused)
    • Awesome cleanup: Replaced call to appendblock by blockappend. (Confusion)
  • 2 bug fixes:

    • Fixed handling last line of =begin/=end. (raybaxter)
    • Fixed source line numbers after heredocs. (jbarreneche)
  • https://github.com/seattlerb/ruby_parser

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.

As an example:

def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end

becomes:

s(:defn, :conditional1, s(:args, :arg1), s(:scope, s(:block, s(:if, s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), s(:return, s(:lit, 1)), nil), s(:return, s(:lit, 0)))))

Changes:

2.0.6 / 2011-02-18

ruby_parser is only 1.8 compatible and it needs some 1.9 love. I'd like to offer a (negotiable) bounty to get it contributed. Charlie Nutter said he'd also throw in a few bucks.

Requirements

  • Syntax additions:

    • block arg splat: blah { |a, *b| ... }
    • block arg default values: blah { |a, b=0| ... }
    • splat arg in the middle: def blah(a, *b, c) ... end
    • default arg in the middle: def blah(a, b=0, c) ... end
    • hash delimiters: h = { a: 2 } and blah(a: 2)
    • stabby lambda: p = ->(x) { x.to_f } sigh
    • (am I missing any?)
  • Charlie pointed out:

    • masgn in method args: def foo(a, (b, (c, d), e), f, *g, h) ugh
    • ! and != parse as methods now (probably the worst idea in 1.9)
    • ?a returns single-char string
    • encodings, unicode
  • Every feature must be tested via ParseTree's pt_testcase.rb setup.

Priorities:

I actually value the tests over the implementation. I would be tempted to get the failing tests passing myself if they were contributed as-is.

For the first pass, I'd be happy if we just did syntax additions and not encoding.

About this Archive

This page is a archive of recent entries in the ruby_parser category.

ruby2ruby is the previous category.

sexp_processor is the next category.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en