guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: language translator help


From: Thomas Bushnell, BSG
Subject: Re: language translator help
Date: 26 Apr 2002 14:14:22 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

My translator is a Scheme program that parses and reads Python, and
turns it into Scheme.  "Turns it into scheme" means not that it writes
ASCII and uses the Scheme reader; of course it just uses cons to make
forms.  That's the Right Thing.

The way to translate break, goto, and such is indeed with call/cc (or,
if you're a fan of it, using call/ec).

Scoping is best handled by doing it by hand.  I have python variables
*not* as scheme variables, but rather as just indexes in a table.  A
python variable ref is then compiled into a lookup in that table.  A
more clever compiler could detect safe cases where it can just be a
Scheme variable.

Global variables are handled differently: each language's globals show
up as a subset of the globals of the other language, and compilation
of Python into Scheme replaces the pythony names with the Schemey
ones.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]