For some time now, I've been working on my Clojure/pypy
implementation. However, I'm starting to wish I had a few Clojure
facilities while writing my rpython clojure interpreter. Basically I
would love to have macros, protocols, symbol resolution, and a ton of
other little features for helping with run-time code generation and
the like.
So this is when I started thinking about generating python code from
Clojure source. That is, in Python we have a AST, and in Clojure we
can parse LISP lists and convert them to AST constructs. This is when
I started to realize where Python falls short of the flexability of
Clojure in a few key areas:
1) multiline closures (lambdas with more than one statement)2) IfExpr
with multiline bodies.
I tried working with the ast module in Python 2.7...and it's horribly
restricted. I found a old lib from PEAK that does what I want
(BytecodeAssembler) but it's fairly old, and no longer supported. So
this is when I thought of the ast in /pypy/interpreter/astcompiler/
Does the pypy interpreter support non-standard constructs like IfExpr
with a multiline body? And if not, could it be adapted to support
this?
I'd rather not drop all the way to emitting Python bytecode...but I
may have to. My end goal is to have my target load some rClojure (as I
call it) code. And then have pypy translate this rClojure code to a
native interpreter. Yes, we're talking about adding a new front-end to
pypy.
Timothy
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev