Carlo Hamalainen


SECD machine interpreter in Python

2012-09-15

I wrote a Python interpreter for the SECD abstract machine, following the presentation in Kogge's book. The pydot library was convenient for visualising the graph in memory corresponding to data and code. For example this short program:

[LDC, [3, 4], LDF, [LD, [1, 2], LD, [1, 1], ADD, RTN], AP, WRITEI, STOP,]

looks like this (click for enlarged image):

Source code is available on github: https://github.com/carlohamalainen/pysecd