Skip to content

EarlGray/SECD

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
std
 
 
 
 
vm
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SECDScheme

Join the chat at https://gitter.im/EarlGray/SECD

This is a loose implementation of SECD machine and a simple self-hosted Scheme-to-SECD compiler/interpreter.

Running Scheme:

$ ./secdscheme
;>> (+ 2 2)
   4

;>> (define n 10)
   n

;>> (define (sqr x) (* x x))
   sqr

;>> (define apply-to-42 (lambda (g) (g 42)))
   apply-to-42

;>> (apply-to-42 sqr)
1764

;>> (define (fact n) (if (eq? n 0) 1 (* n (fact (- n 1)))))
   fact

;>> (fact 10)
3628800

;>> (load "std/lists.scm")
   ok

;>> (filter odd (range 12))
   (1 3 5 7 9 11)

;>> (begin (display 'bye) (quit))
bye
$

Running bare SECD opcodes:

$ echo "(STOP)" | ./secd
$ echo "(LDC 2  LDC 2  ADD  PRINT  STOP)" | ./secd
$ ./secd < tests/append.secd
(1 2 3 4 5 6)

The design is mostly inspired by detailed description in Functional programming: Application and Implementation by Peter Henderson and his LispKit, but is not limited by the specific details of traditional SECD implementations (like 64 Kb size of heap, etc) and R7RS.

Here is a series of my blog posts about SECD machine

Join a Gitter chat if you want to discuss the project or need help with it.

About

Scheme on SECD

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages