ParseTree version 3.0.0 has been released!
Published 2008-10-22 @ 20:14
ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby’s arrays, strings, symbols, and integers.
As an example:
def conditional1(arg1)
if arg1 == 0 then
return 1
end
return 0
end
becomes:
[:defn,
:conditional1,
[:scope,
[:block,
[:args, :arg1],
[:if,
[:call, [:lvar, :arg1], :==, [:array, [:lit, 0]]],
[:return, [:lit, 1]],
nil],
[:return, [:lit, 0]]]]]
Changes:
3.0.0 / 2008-10-22
-
3 major enhancements:
- Split out sexp_processor project.
- ParseTree#process outputs a UnifiedRuby parse tree.
- Switched all ParseTree tests to RawParseTree tests.
- Added ParseTree tests.
- Added UnifiedRuby#process.
-
28 minor enhancements:
- PTTC: Added a comprehensive suite of tests for every combo of defn args.
- PTTC: Added a ton of new tests.
- PTTC: Added extra tests for mri verbose flag testing (horrid horrid bug imhfo)
- PTTC: Don’t generate tests if class has “TestCase” in the class name.
- PTTC: Made self.previous more overridable.
- PTTC: Now all tests that have “mri_verbose_flag” activate $VERBOSE
- PTTC: Officially added clone_same phase to generate_tests
- PTTC: Refactored test generation to make subclasses more flexible.
- PTTC: Refactored to use new add_tests. Much much cleaner.
- PTTC: Removed Unique from PTTC… subclasses need to deal with this
- PTTC: Removed some stupid tests.
- PTTC: Renamed a bunch of tests to be more uniform.
- UR: Added rewrite_attrasgn to normalize arg array into arglist.
- UR: Added rewrite_op_asgn1 to ensure the arglist is an arglist.
- UR: Flattened resbodies in rescue node.
- UR: Flattened super and yield args yet, deal with array arg properly.
- UR: Handle yield(*ary) properly.
- UR: Nuked argspush.
- UR: Removed begin node from unified sexps.
- UR: Removed block from rewritten resbody if only 1 element.
- UR: Removed dasgn, dasgn_curr, and dvar nodes.
- UR: Removed s(:block_arg, :block) in favor of :”&block”
- UR: Rewrote argscat to be a splat inside an array.
- UR: Rewrote block_pass into arglist of inner call/super.
- UR: Rewrote call to ALWAYS have an argslist (no more splat as arglist).
- UR: Rewrote rewrite_resbody from scratch… MUUCH cleaner.
- UR: zarray -> array
- Used Hoe#add_include_dirs to clean up rakefile.
- Moved PT dependent code from ruby2ruby to here (eg Proc#to_sexp & friends).
-
2 bug fixes:
- UR: Fixed a bug with resbody that starts with an lasgn.
- UR: Fixed args for attrset
- Fixed export of symbols to work across platforms.
- http://rubyforge.org/projects/parsetree/
- https://www.zenspider.com/ZSS/Products/ParseTree/
- mailto:ryand-ruby@zenspider.com