[Python-ideas] Statements vs Expressions... why?

Leonardo Santagada santagada at gmail.com
Mon Sep 15 03:58:37 CEST 2008


On Sep 14, 2008, at 10:35 PM, Greg Ewing wrote:

> Cliff Wells wrote:
>
>> Breve more or less a functional DSL that barely resembles Python but
>> actually *is* Python (in fact, I've seen someone assert that Breve
>> templates could not possibly be actual Python code).
>
> If it looks that little like Python, I'd say it really
> is a different language, and you have no right to expect
> to be able to use the Python compiler as-is to process
> it.
>
> Rather than twisting Python to make it possible to
> abuse it even further, you'd be better off writing a
> Breve compiler in Python that produces Python code
> (or maybe even translates it directly to Python
> bytecode).

I was having fun reading the discussion, specially now that it got to  
the part were most people are starting to realise how ugly python  
would become, to put it lightly we got to the dificult part (the "how").

But all Cliff wanted is to have better support for DSL in python, that  
is his real use case. I say why don't we focus on it.

The only clean way to support DSL in python in my view would be to  
support something like pyparsing or ANTLR and make it generate a  
parser and some simple form of compilation to python bytecodes. How  
can we support that? Is this even desired?


--
Leonardo Santagada
santagada at gmail.com






More information about the Python-ideas mailing list