[Compiler-sig] Re: [Python-Dev] Revive the types sig?

Jeremy Hylton jeremy@alum.mit.edu
Mon, 12 Mar 2001 18:44:14 -0500 (EST)


>>>>> "GvR" == Guido van Rossum <guido@digicool.com> writes:

  >> 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.

  GvR> I'm not sure this is viable.  I believe Jeremy's compiler
  GvR> package actually doesn't have its own parser -- it uses the
  GvR> parser module (which invokes Python's standard parse) and then
  GvR> transmogrifies the parse tree into something more usable, but
  GvR> it doesn't change the syntax!  Quixote can get away with this
  GvR> because their only change is giving a different meaning to
  GvR> stand-alone string literals.  But for type annotations this
  GvR> doesn't give enough freedom, I expect.

Right!  It would be nice to kill two birds with one stone though.  We
could generate an alternate parser for Python and have it generate the
same AST, decorated with type information.  Even if the type
experiment doesn't work out, the alternate parser might be useful.

Jeremy