Giter Site home page Giter Site logo

wangchenghuidream / sectorlisp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jart/sectorlisp

0.0 0.0 0.0 2.57 MB

Bootstrapping LISP in a Boot Sector

License: ISC License

Shell 0.30% C 87.48% Common Lisp 5.68% Assembly 6.00% Makefile 0.54%

sectorlisp's Introduction

sectorlisp

sectorlisp is a 512-byte implementation of LISP that's able to bootstrap John McCarthy's meta-circular evaluator on bare metal.

Yo dawg, I heard you like LISP so I put a LISP in your LISP so you can eval while you eval

Overview

LISP has been described as the Maxwell's equations of software. Yet there's been very little focus to date on reducing these equations to their simplest possible form. Even the original LISP paper from the 1960's defines LISP with nonessential elements, e.g. LABEL.

This project aims to solve that by doing three things:

  1. We provide a LISP implementation that's written in LISP, as a single pure expression, using only the essential functions of the language. See lisp.lisp. It's the same meta-circular evaluator in John McCarthy's paper from the 1960's, except with its bugs fixed, dependencies included, and syntactic sugar removed.

  2. We provide a readable portable C reference implementation to show how the meta-circular evaluator can be natively bootstrapped on POSIX conforming platforms, with a pleasant readline-like interface. See lisp.c.

  3. We provide a 512-byte i8086 implementation of LISP that boots from BIOS on personal computers. See sectorlisp.S. To the best of our knowledge, this is the tiniest true LISP implementation to date.

Binary Footprint Comparison

Getting Started

See lisp.lisp for code examples that you can copy and paste into your LISP REPL.

You can run the C implementation as follows:

$ make
$ ./lisp

After running make you should see a sectorlisp.bin file, which is a master boot record you can put on a flopy disk and boot from BIOS. If you would prefer to run it in an emulator, we recommend using Das Blinkenlights.

curl --compressed https://justine.lol/blinkenlights/blinkenlights-latest.com >blinkenlights.com
chmod +x blinkenlights.com
./blinkenlights.com -rt sectorlisp.bin

Alternatively you may use QEMU as follows:

qemu-system-i386 -nographic -fda sectorlisp.bin

Further information may be found on our wiki.

Demo

booting sectorlisp in emulator

The video above demonstrates how to boot sectorlisp in the blinkenlights emulator, to bootstrap the meta-circular evaluator, which evaluates a program for finding the first element in a tree.

You can watch the full demo on YouTube.

sectorlisp's People

Contributors

jart avatar peterferrie avatar woodrush avatar agreppin avatar swolchok avatar tkchia avatar ilyakurdyukov avatar mrdomino avatar moon-chilled avatar

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.