Secd: A silly implementation of the SECD machine

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • secd

    A simple implementation of the SECD abstract machine (https://en.wikipedia.org/wiki/SECD_machine)

  • Arguably, it's a bit silly, in the same way that the one page Lisp definitions written in Lisp are a bit silly. It's a naive implementation. It basically maps the SECD machine, directly to the underlying Clojure environment, which being Lisp, is very close in semantics. (Since SECD was first intended to implement Lisp.)

    Consider how it evaluates a variable in an environment: https://github.com/zachallaun/secd/blob/master/src/secd/mach... It's the simplest, and worst, solution -- iterate over the linked list from the start until you find the value you want. Performance degrades exponentially the more variables you have. In a more "serious" interpreter or compiler, you'd want to do a transform at some point, and slip in the value directly, if possible. And if not, you want to call out to a fast lookup method, like a hash table or balanced tree.

  • lispkit

    FUNCTIONAL PROGRAMMING: Application and Implementation, Peter Henderson, ISBN 0-13-331579-7

  • I've actually recently read "FUNCTIONAL PROGRAMMING: Application and Implementation", by Peter Henderson from 1980, which contains a description of the SECD machine and a compiler for a simple purely-functional Lisp dialect called Lispkit.

    This <https://github.com/carld/lispkit> looks like a good repo if you want to know more, although I'm not related to it in any way.

    I can't say how it compares the book by Kogge mentioned in this post since I haven't read that, but I can say I think it's an excellent book and worth reading if you're interested in this kind of thing.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • ocaml

    The core OCaml system: compilers, runtime system, base libraries

  • Might be of interest: the ocaml interpreter runs on some kind of ZINC machine iirc, which is implemented here: https://github.com/ocaml/ocaml/blob/trunk/runtime/interp.c

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts