12 Jan 2007 14:49
Re: SVN
Stefan Seefeld <seefeld <at> sympatico.ca>
2007-01-12 13:49:31 GMT
2007-01-12 13:49:31 GMT
Lorenzo Pastrana wrote: > > > Stefan Seefeld wrote: >> Just to be clear, though: the trunk contains the in-development code >> (such as a rewritten >> C++ parser). The recent 0.9 release is based on the 'Synopsis_0_8' >> branch. (I should consider >> renaming that branch, if people find the current name confusing.) > > Well if 0_8 branch effecively contains 0_9 sure that's, not obvious at > least :D There is no such thing as '0_9'. What happened is that originally the 0_8 branch was created as the release branch for Synopsis 0.8. However, during my work on the trunk I realized that getting the new code stable enough to take over would take longer than I wanted to spend on the next release, and so I decided make the next (i.e. 0.9) release out of that branch. > Might checkout that one, since I'm in evaluation phase ... Out of curiosity, why aren't you using the release package for evaluation ? Or are you evaluating whether to help developing it (which would be very welcome) ? > Meanwhile I'd like to validate some simple concepts about Synopsis and > it's usage... > > My main concern is generating code based on the AST, input material will > mostly be C++ and Idl declarations, generated code a C++ binding layer > for the engine I'm working on. > Witch I believe I can do by feeding appropriate parser with the headers, > walking down the AST, matching nodes, and generating the glue accordingly. > > My questions : > > Is the AST accesible from C++ as it is from python or it is a > specificity of the python level ? The AST in its current form is implemented in python. However, there are C++ bindings for the AST types, so I can generate it from within C++ (i.e. the various parsers that are mostly written in C++). You may use that binding to access (traverse) the AST. > Do I have to use python to write a custom formatter or can I do it in C++ ? What is the reason for you to prefer to do it in C++ ? > http://synopsis.fresco.org/docs/Tutorial/ch05.html is rather laconic, is > there a more verbose place I can find Infos about writing a custom > formatter for the job ? The reason I don't discuss the C++ API in the tutorial (yet) is that it is very much in development, i.e. a moving target. I should have mentioned that in the tutorial, with a reference to the Development Guide, where you can find a bit more information: http://synopsis.fresco.org/docs/DevGuide/cxx.html That, however, doesn't cover the AST, which, as I said above, only exists in the python layer. If you provide some more context I may be able to suggest how to approach a solution. > http://synopsis.fresco.org/docs/Manual/python/Source/Synopsis/Formatters/Dump.py.html > > Seems to be a good place for a start but what about C++ > > Questions about python/C++ are because I'd like to use Synopsis in an > import module for my tool and would like to avoid depending on python... Sorry, that last paragraph confuses me. What do you mean by 'import module' if not a python module ? (And why would you like to avoid python ?) FWIW, I don't have plans to make Synopsis C++-only with python wrappers around it. Using python intrinsically has some significant advantages. However, as Synopsis evolves, and as your source-to-source translation needs become more fine-grained, you may discover that you really want to traverse the parse tree for code generation, not the AST (or at least what I currently call the AST), so you may end up with not depending on python. I hope all this makes sense to you and you are not discouraged. Let me know if I can help in any way. Regards, Stefan -- -- ...ich hab' noch einen Koffer in Berlin...
RSS Feed