On Aug 17, 5:23 am, Irmen de Jong <ir...@-nospam-xs4all.nl> wrote: > On 16-08-11 13:33, Paul Wray wrote: > > > > > > > > > > > The idea: > > Python syntax allows a statement to be a bare literal or identifier. > > These have no effect on the program. > > > So the function below is legal python: > > > def myFunc(): > > 'a' > > x = 45 > > 'b'; 'c'; x > > > So is this (within the appropriate class context of course): > > > def body(self, r): > > '<h1>'; self.heading; '</h1>' > > '<ul>' > > for itm in self.items: > > '<li>'; itm; '</li>' > > '</ul>' > > Looks very similar to PTL what Quixote > uses:http://www.quixote.ca/overview/paper.html > > (never used it though, and I doubt Quixote used ASTs) > > Irmen
Thanks. Yes it looks much the same, and it does use AST. This from the ptl_compile.py module: """Compile a PTL template. First template function names are mangled, noting the template type. Next, the file is parsed into a parse tree. This tree is converted into a modified AST. It is during this state that the semantics are modified by adding extra nodes to the tree. Finally bytecode is generated using the compiler package. """ -- http://mail.python.org/mailman/listinfo/python-list