Re: Using synopsis to translate python source code to C/C++ or Java
Tom Malcolmson <Tom <at> Malcolmson.com>
2009-03-27 16:24:58 GMT
On Fri, 27 Mar 2009 11:02 -0400, "Stefan Seefeld" <seefeld <at> sympatico.ca>
> Hi Tom,
> Tom Malcolmson wrote:
> > Hi.
> > It appears to me that synopsis is able to parse Python and C++. I see
> > formatters for producing documentation from the AST trees but I don't
> > see formatters for producing source code. Do they exist?
> No. The various language parsers in Synopsis first generate
> language-specific source representations (a C++ parse tree, a Python
> AST, etc.), and then translate that (or rather, a subset of it) into a
> common representation: the 'Abstract Semantic Graph' (ASG). This ASG is
> what most of the processors in Synopsis work on to generate
> documentation. I assume this level is enough if you want to generate API
> bindings (say), because for those you only care about the API
> declarations, which are adequatly represented in the ASG.
> For full-blown code translation, however, this is not enough. You need
> to operate one level below, on the parse tree.
> I think what you want is very reasonable, and in case of Python even
> straight-forward to do (in contrast to C++, for example).
Thanks for the clarification.
I'm surprised to hear you say that it would be relatively easy in
Python. I thought that the hard part with Python is the type inference.