[ANN] ParseTree 2.2.0 Released

ParseTree version 2.2.0 has been released!

* <http://rubyforge.org/projects/parsetree/>
* <http://www.zenspider.com/ZSS/Products/ParseTree/>
* <ryand-ruby@zenspider.com>

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:

### 2.2.0 / 2008-06-09

* 18 minor enhancements:

   * Added 1.9 and rubinius to multiruby skip list.
   * Added 1.9 fixes for SexpProcessor.
   * Added compatibility changes for regexp option values.
   * Added custom compact since Array#compact is hostile to subclasses.
   * Added some tests for wonky index edge cases. some commented out.
   * Added test changes for 1.9 and r2r changes. Esp fixed regexp differences.
   * Added tests for dasgn, proc arities,
   * Added/updated some tests for ruby_parser.
   * Changed tests to default to nil for verbose.
   * Fixed all assertions deprecated in miniunit.
   * Raises LoadError if incompatible ruby, allows fallback to ruby_parser.
   * Removed Unified's rewrite_fbody and moved up into defn... not sure about that.
   * Removed argscat rewriter from unified_ruby.rb
   * Renamed shadowed variable name.
   * Reworked parse_tree_for_(method|string) to take optional verbose arg.
   * Started removing ending newlines from pt_testcase.rb.
   * Uncommented all commented out tests. ruby_parser must not be a pansy.
   * Updated rakefile for new hoe abilities.

* 3 bug fixes:

   * Fixed 1.8.[45] wrt dasgn_curr declaration removal.
   * Fixed pt_testcase bug.
   * Fixes for colon2/3 in class/module/cdecls.

* <http://rubyforge.org/projects/parsetree/>
* <http://www.zenspider.com/ZSS/Products/ParseTree/>
* <ryand-ruby@zenspider.com>

Ryan Davis wrote:

[...]

### 2.2.0 / 2008-06-09

* 18 minor enhancements:

  * Added 1.9 and rubinius to multiruby skip list.
  * Added 1.9 fixes for SexpProcessor.

I'm curious. Does that mean, ParseTree now works with Ruby 1.9? That
would be great!

Regards,

   Michael

Dear Ryan,

ParseTree version 2.2.0 has been released!
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.

can you recommend an analogon to ParseTree for classes and methods written in C/C++,
which produces output that's compatible/easily adaptable to ParseTree's output for Ruby, i.e., that would
facilitate translations of code

Ruby -> S-Expressions -> C/C++ and in the other direction ?

Thank you very much!

Best regards,

Axel

···

--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx

Unfortunately, no.

My 1.9 fixes were for SexpProcessor only. The intent is to get to the point where 1.9 and other non-ASTable implementations can automatically fall back to ruby_parser.

1.9 dropped support for storing AST information. ruby_parser can take over for some of that, but the biggie is procs... People who design DSLs on procs using ruby2ruby to do manipulation are going to be sorely disappointed in ruby 1.9. Unfortunately I don't have a solution at this time. There has been some talk about a bytecode decompiler for procs, but I don't even know if it is feasible at this point.

···

On Jun 10, 2008, at 02:32 , Michael Neumann wrote:

Ryan Davis wrote:

[...]

### 2.2.0 / 2008-06-09
* 18 minor enhancements:
* Added 1.9 and rubinius to multiruby skip list.
* Added 1.9 fixes for SexpProcessor.

I'm curious. Does that mean, ParseTree now works with Ruby 1.9? That
would be great!

Dear Ryan,

ParseTree version 2.2.0 has been released!
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.

can you recommend an analogon to ParseTree for classes and methods written in C/C++, which produces output that's compatible/easily adaptable to ParseTree's output for Ruby, i.e., that would facilitate translations of code

I'm confused... above it seems you're asking for something like ParseTree for C/++. Below it seems you're asking for a sexp to C translator. Or... you want it bidirectional???

Ruby -> S-Expressions -> C/C++ and in the other direction ?

Any C/++ parser could be adapted to generate ruby objects that look like sexps. But conceptually there is a lot of disparity between C, C++, and ruby. I doubt you'll ever manage a clean bidirectional mapping between the two except for the most hamstrung subset between the three.

Curious tho: why?

···

On Jun 10, 2008, at 05:34 , Axel Etzold wrote:

-------- Original-Nachricht --------

Datum: Wed, 11 Jun 2008 09:24:32 +0900
Von: Ryan Davis <ryand-ruby@zenspider.com>
An: ruby-talk@ruby-lang.org
Betreff: Re: [ANN] ParseTree 2.2.0 Released

> Dear Ryan,
>
>> ParseTree version 2.2.0 has been released!
>> 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.
>
> can you recommend an analogon to ParseTree for classes and methods
> written in C/C++, which produces output that's compatible/easily
> adaptable to ParseTree's output for Ruby, i.e., that would
> facilitate translations of code

Dear Ryan,

I'm confused... above it seems you're asking for something like
ParseTree for C/++. Below it seems you're asking for a sexp to C
translator. Or... you want it bidirectional???

Curious tho: why?

well, your project somehow revives a dream I have about somehow easier
integration of code in different languages, so indeed, I'd take bidirectional
if I'd get it :slight_smile:

Any C/++ parser could be adapted to generate ruby objects that look
like sexps. But conceptually there is a lot of disparity between C, C+
+, and ruby. I doubt you'll ever manage a clean bidirectional mapping
between the two except for the most hamstrung subset between the three.

It's just a dream now, but I was wondering for some time whether it shouldn't
be possible to make a mapping of concepts between different programming
languages in the following way.

---Two necessary prerequistes --

1. If you have a text (about any subject), you can automatically summarize it (i.e.,
keep only the, say, 10 percent most interesting sentences in it). and categorize
different sentences in it using a technique called Latent Semantic Analysis.
There is a Ruby implementation of this technique in the classifier gem:

http://classifier.rubyforge.org/

and the usage examples there.
Latent Semantic Analysis transforms a text into a "matrix" by counting the number
of occurrences of words in a sentence, and similar sentences are identified as
"vectors" which are mapped "closely together" in a set called the "eigenspace" of that
matrix. The terms in quotation marks are precisely defined in linear algebra.

2. Suppose you have two somewhat encylopaedic books explaining how to code in
language X and language Y, from the ground up, so that you can search their entire
text from your computer (that should be possible from a O'Reilly Safari subscription).

The idea I have is about this:
Now, to transform a piece of code T in language X into one in language Y, I think it would be
feasible to use the S-expressions of T, to identify those pieces of code in the book
about language X that have their S-expressions resemble most to those of T ( in the
linear algebra distance sense), and then try to find the parts of explanatory text and code in the book about language Y, that resemble most to that text in the book about language X.

Best regards,

Axel

···

On Jun 10, 2008, at 05:34 , Axel Etzold wrote:

--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger