[Python-Dev] Revive the types sig?

Jeff Epler jepler@inetnebr.com
Mon, 12 Mar 2001 17:38:42 -0600


On Mon, Mar 12, 2001 at 06:15:15PM -0500, Barry A. Warsaw wrote:
> This might mean an extensive set of patches, a la Stackless.  After
> seeing and talking to Neil and Andrew about PTL and Quixote, I think
> there might be another way.  It seems that their approach might serve
> as a framework for experimental Python syntaxes with minimal overhead.
> If I understand their work correctly, they have their own compiler
> which is built on Jeremy's tools, and which accepts a modified Python
> grammar, generating different but compatible bytecode sequences.
> E.g., their syntax has a "template" keyword approximately equivalent
> to "def" and they do something different with bare strings left on the
> stack.

See also my project, "M=F6bius python".[1]

I've used a lot of existing pieces, including the SPARK toolkit,
Tools/compiler, and Lib/tokenize.py.

The end result is a set of Python classes and functions that implement th=
e
whole tokenize/parse/build AST/bytecompile process.  To the extent that
each component is modifable or subclassable, Python's grammar and semanti=
cs
can be extended.  For example, new keywords and statement types can be
introduced (such as Quixote's 'tmpl'), new operators can be introduced
(such as |absolute value|), along with the associated semantics.

(At this time, there is only a limited potential to modify the tokenizer)

One big problem right now is that M=F6bius Python only implements the
1.5.2 language subset.

The CVS tree on sourceforge is not up to date, but the tree on my system =
is
pretty complete, lacking only documentation.  Unfortunately, even a small
modification requires a fair amount of code (My 'absolute value' extensio=
n
is 91 lines plus comments, empty lines, and imports)

As far as I know, all that Quixote does at the syntax level is a few
regular expression tricks.  M=F6bius Python is much more than this.

Jeff
[1] http://mobiuspython.sourceforge.net/