News for hackers. Stuff that matters.
Re:SICP is Under Attack by naughtysriram on Thursday August 04, 2011 @12:51AM (#2844621)
Why not write a python(subset) interpreter in scheme?

The point is once you scan,tokenize and parse you get an AST. You already got a language that works on AST. I don't think python's AST is gonna differ a lot from scheme's.

Re:SICP is Under Attack by btilly on Thursday August 04, 2011 @01:11AM (#2844682)
The problem is that Python's AST looks different than Python. In Scheme there is no such intermediate step.

They don't write a scheme(subset) interpreter in scheme. They write a scheme interpreter in scheme.

Re:SICP is Under Attack by zephyrfalcon on Thursday August 04, 2011 @02:59AM (#2844981)
Um, yes, actually they differ a lot. In Scheme (and Lisp in general) the code pretty much is the AST. This is not the case for Python.
Re:SICP is Under Attack by btilly on Thursday August 04, 2011 @09:00PM (#2848519)
I think that the point was that the AST for a Scheme program isn't that different from the AST for a Python program, even though the code looks different.

Unfortunately that point is false as well. The AST for a Python program will generally involve a lot of message dispatches that won't exist in the AST for a similar Scheme program.

To get a sense of the difference, in Python if you yield, your code actually gets turned into a class with certain methods that get called repeatedly, and restart your method at the correct place with the correct state. By contrast equivalent code in Scheme will somewhere under the hood have call-with-current-continuation, which works by very different mechanics.