473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Transformation with ``parser`` ast

(Note: repost from python-dev)

The ``compiler.ast`` module makes parsing Python source-code and AST
manipulation relatively painless and it's straight-forward to implement
a transformer class.

However, I find that the ``compiler.pycodegen`` module imposes a hard
limit on the length of functions since it calculates jump points in a
recursion.

I'm using this module to compile an XML dynamic template into Python
code (akin to "Mako") and functions may grow to a rather large size.

Now it seems that the ``parser`` module, which parses source code into
``parser.st`` trees does not have the same limitations, however, I could
not find a transformer class compatible with its tree structure.

What's the recommended way of working with the AST tree from the
``parser`` module?

\malthe

Oct 13 '08 #1
1 1439
On Oct 13, 2:39*pm, Malthe Borch <mbo...@gmail.comwrote:
(Note: repost from python-dev)

The ``compiler.ast`` module makes parsing Python source-code and AST
manipulation relatively painless and it's straight-forward to implement
a transformer class.

However, I find that the ``compiler.pycodegen`` module imposes a hard
limit on the length of functions since it calculates jump points in a
recursion.

I'm using this module to compile an XML dynamic template into Python
code (akin to "Mako") and functions may grow to a rather large size.

Now it seems that the ``parser`` module, which parses source code into
``parser.st`` trees does not have the same limitations, however, I could
not find a transformer class compatible with its tree structure.

What's the recommended way of working with the AST tree from the
``parser`` module?
That's old. Use the shiny new ast module that has a higher level view
of the syntax. http://doc.python.org/library/ast.html should start you
off.
>
\malthe
Oct 14 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron...
7
by: CK | last post by:
Hello, I have the 60 MB XML string and I am coding a program in Visual Basic to run a XSL transformation on it. Currently, I'm using the Microsoft standard MSXML 2.0 to create a DOM document, load...
8
by: Will | last post by:
I was thrust into XML about 2 weeks ago and don't know much yet. From another department in the corp I am receiving an XML file which concatenates nodes all on one line i.e....
2
by: philips | last post by:
Hi everybody, I am using the Xalan 1.8 C++ API in a real-time financial application which need to apply XSLT transformations on XML input messages received on-the- fly. On the process output,...
0
by: pulvertum | last post by:
Hello, I need an org.w3c.dom.Document so I can pass them to do a transformation of my XML using XSL (to another XML as result). I've tried several solutions but didn't have the desired result:...
0
by: Hugo Ferreira | last post by:
Hi all, I'm having a problem here, to which I hope someone to be able to help me :) I need to apply a XSLT transformation to the output of all my ASPX webpages. I've recently found the tag...
5
by: mahesh.nimbalkar | last post by:
When I transform XML, XSLT automatically adds extra attributes to the node which are declared in DTD (default DTD attributes) . I just want XSLT not to add these extra default attributes from DTD....
3
by: =?iso-8859-1?q?Eduardo_Y=E1=F1ez_Parareda?= | last post by:
Hello, I have to use xalan to transform some XML using XSL, but I have some problems within the XSLs, and Xalan doesn't give very good error messages. Is there any way to put Xalan on debug or...
18
by: R. P. | last post by:
I wonder how to indicate in a stylesheet that character entities in an element are not to be transformed as would be the case in XML-to-XML transforms. I want to keep those &amp; &quot; and other character...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.