Re: Using synopsis to translate python source code to C/C++ or Java
"Tom Malcolmson" <[email protected]> Fri, 27 Mar 2009 12:24:58 -0400
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 27 Mar 2009 11:02 -0400, "Stefan Seefeld" <[email protected]> wrote: > 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. On the other hand, I think that Python 3 will make that much easier because it allows the developer to annotate the source code with type information. Tom. > If you are interested in such a feature I encourage you to submit a > detailed feature request. And, if you are willing and able to help > implement it, I would be glad to collaborate. > > Thanks for your interest into Synopsis ! > > Stefan > > -- > > ...ich hab' noch einen Koffer in Berlin... >