Git Product home page Git Product logo

pysecd's Introduction

pysecd

Python interpreter for the SECD abstract machine defined by Peter Landin.

I followed the presentation of the SECD machine given by Peter M. Kogge in his book The Architecture of Symbolic Computers (1991, McGraw Hill). I wrote this interpreter as a learning exercise, so the code should not be taken as a definitive statement on how the SECD machine operates. The trickiest opcodes to implement were DUM and RAP, for defining recursive closures.

To aid debugging I wrote a small wrapper for pydot, so that the memory structures can be visualised. For example the list [1, 2, 3] is stored as:

small list

A nonterminal cell has three parts: its address, the car value, and the cdr value. Nonterminal cells have two parts: the address and the integer value. For convenience opcodes (ADD, LD, LDF, etc) are stored as strings so that when we draw the graph we can see opcodes instead of integers. For examle the program

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

corresponds to the following graph in memory:

sample program

On Debian-like systems, install pydot with this command:

sudo apt-get install python-pydot

Further reading

I only read Kogge's presentation of the SECD machine, so I really ought to invest some time in getting through these:

TODO

  • Test pysecd against one of the other implementations listed above.
  • Implement garbage collection (Chapter 8 of Kogge's book).

pysecd's People

Stargazers

Eran avatar Konstantin Selin avatar Alejandro Zamora Fonseca avatar  avatar Sandy Vanderbleek avatar Jiamo avatar Оками 0жff666 λ avatar ebigram avatar ryan avatar Seth Morabito avatar  avatar Alex avatar latrokles avatar Gregario Mansa avatar Kenneth Bruskiewicz avatar cs avatar Kesava Mallela avatar  avatar Dave Harlan avatar Kamynin Ivan avatar Shinichi Tanaka avatar Guido Bartolucci avatar Miëtek Bak avatar  avatar Z-Shang avatar Ajinkya Kulkarni avatar  avatar Aleksandr Koshkin avatar Lewis Brown avatar Mayank Jain avatar hamlet avatar  avatar Cristian Stoica avatar Kevin Millikin avatar Alain Fischer avatar scvalencia avatar Mort Yao avatar Tatsuya Tsuda avatar Mark Godfrey avatar  avatar Young Gyu Park avatar Fogus avatar

Watchers

Dave Creelman avatar hamlet avatar Carlo Hamalainen avatar James Cloos avatar Rich Loveland avatar  avatar  avatar

pysecd's Issues

Hi, some links are broken since .... then (10 years ago)

Hi, I hope this issue finds you doing alright. It must have been about 10 years now since your study made on SECD and this repo for some of the resources you found relevant, which I appreciate very much as I too, am doing some learning on this subject.

So, there are two links that I have found broken:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.