-------- 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

> 
> On Jun 10, 2008, at 05:34 , Axel Etzold wrote:
> 
> > 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 :)

> 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 



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