• Stars
    star
    1,147
  • Rank 39,231 (Top 0.8 %)
  • Language
    C
  • License
    ISC License
  • Created over 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bootstrapping LISP in a Boot Sector

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.

More Repositories

1

cosmopolitan

build-once run-anywhere c library
C
15,150
star
2

blink

tiniest x86-64-linux emulator
C
6,710
star
3

hiptext

Turn images into text better than caca/aalib
C++
749
star
4

gosip

Public Switched Telecommunications Network Unleashed
Go
429
star
5

bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
C
349
star
6

fabulous

Print images, colors, and stylish text to the terminal with Python
Python
340
star
7

disaster

Disassemble C/C++ code under cursor in Emacs
Emacs Lisp
287
star
8

landlock-make

Sandboxing for GNU Make has never been easier
C++
178
star
9

redisbayes

Naïve Bayesian Text Classifier on Redis
Python
114
star
10

occupywallst

Stomping out capitalism, one line of code at a time
JavaScript
94
star
11

pledge

OpenBSD APIs ported to Linux userspace using SECCOMP BPF and Landlock LSM
C
80
star
12

jtckdint

C23 Checked Arithmetic
C++
61
star
13

asterisk-voicechanger

Asterisk module for adjusting pitch of voices
C
31
star
14

spandsp

C
28
star
15

tokenbucket

Atomic SWAR Token Buckets
C
27
star
16

poemy2

poemy (a poetry generator) rewritten in C++
C++
24
star
17

django-bone

Generates Django Project Skeletons Simply and Properly
JavaScript
23
star
18

swatpd

Stolen WiFi Aggregate Tunneling Protocol Dæmon (RAID your internet connections!)
C
18
star
19

zsh

Zsh patched to support Actually Portable Executables git://git.code.sf.net/p/zsh/code (upstream pending)
C
15
star
20

sofia-sip

Forked for features and packaging
C
14
star
21

blink-isystem

C++
11
star
22

includeme

Automatic C/C++ '#include' and 'using' in Emacs (WORK IN PROGRESS)
Emacs Lisp
10
star
23

justinemacs

My emacs25 text editor configuration
Emacs Lisp
9
star
24

timespan

Check if timestamp falls within specific boundaries
Python
7
star
25

js2-closure

Automatic goog.require for Closure
Emacs Lisp
5
star
26

sparkles

A decision making tool (defunct, incomplete)
JavaScript
5
star
27

web_library_example

Bootstrap Web Apps for ML Visualization
HTML
5
star
28

emacs-copilot

Large language model code completion for Emacs
Emacs Lisp
5
star
29

poemy

Poetry Generator (DEPRECATED: See poemy2)
JavaScript
4
star
30

asterisk-parrot

Annoying robot that repeats what you say on the phone
C
4
star
31

jart.github.io

4
star
32

tensorflow-makefile

C++
3
star
33

libc-test

C
3
star
34

chessy

A happy toy chess engine, just for fun :) If you want a proper chess engine, check out Stockfish.
C++
3
star
35

long-s.org

Vintage Engliſh Tranſlator
CoffeeScript
2
star
36

freeswitch

Open Source Telecommunications Platform (Unofficial Fork)
C
2
star
37

verobject

Version controlled object database on Redis
Python
1
star