OT: Ultimate Language Syntax Cleanness Comparison
holger krekel
pyth at devel.trillke.net
Mon Feb 10 11:37:36 EST 2003
Jeremy Fincher wrote:
> holger krekel <pyth at devel.trillke.net> wrote in message news:<mailman.1044877956.27600.python-list at python.org>...
> > If so can you send the snippet which parses *any* perl script?
> > If your deduction above is true, then it should be easy.
>
> You originally claimed, "All the methods involve evaluating/executing
> it at the same time." I showed you that Perl's abstract syntax tree
> (which is constructed by the code generated from perly.y in addition
> to some other arcane machinery) is absolutely different from the
> bytecode (an example of which is shown in bytecode.pl), which is
> actually executed.
That sharp distinction is still a claim. Pointing to some files
doesn't prove your point but example code does. In python i do
>>> import compiler
>>> p=compiler.parseFile('test.py')
>>> p # Parse tree
Module(None, Stmt([Printnl([Const('hello world')], None)]))
>>> p.filename='test.py' # fixup
>>> c=compiler.pycodegen.ModuleCodeGenerator(p).getCode()
>>> c
<code object <module> at 0x828a720, file "test.py", line 2>
>>> exec c
hello world
>>>
Can you show me the equivalent of this in perl *in real code*?
Even just the parsing step? Or is it to painful to actually do it?
just some questions,
holger
More information about the Python-list
mailing list