Gigue is a minimal scheme interpriter written in Go
Go Makefile

README.md

Gigue

Build Status Go Report Card

One day after reading SICP, I interested in implement my own scheme interpriter for practice. A design of Gigue is based on scheme interpriter of SICP Chapter 4.

Gigue is not the metacircular evaluator, simple scheme interpriter written in Go.

Installation

go get github.com/suzuken/gigue

Examples

From examples/fold.scm,

(define (fold-right op initial sequence)
  (if (null? sequence)
    initial
    (op (car sequence)
        (fold-right op initial (cdr sequence)))))

(print (fold-right / 1 (list 1 2 3)))

and gigue examples/fold.scm, then output 1.5.

REPL

Gigue has REPL.

-> % ./gigue
> (define x 1)
> (define y 2)
> (load "examples/sum.scm")
> (print (sum x y))
3

Features

  • +, -, *, /
  • cons, car, cdr, list, cadr, cdar, cddr, caaar, caddr, cdadr, cddar, cdddr
  • <, >, <=, >=
  • define, lambda, if, cond, begin
  • null?, list?, symbol?, string?, eq?
  • load

LICENSE

MIT

Author

Kenta Suzuki (a.k.a. suzuken)

For your reference

Written in above, Gigue is based on the interpriter written in SICP Chapter 4. If you are not similar to scheme, you don't mind it. I think writing scheme interpriter in scheme - metacircular evaluator - is much simpler than written in Go or other language.

SICP Chapter 4

If you're not have enough time to read SICP, scm.go, a Scheme interpreter in Go, as in SICP and lis.py | De Babbelbox of Pieter Kelchtermans may be helpful for understanding what a scheme interpriter is. A minimal Scheme interpreter, as seen in lis.py and SICP is a minimal scheme interpriter (surprisingly only 250 lines) written in Go .

And I found some projects which implements scheme interpriter in Go.