Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
/ gigue Public archive

Gigue is a minimal scheme interpriter written in Go

License

Notifications You must be signed in to change notification settings

suzuken/gigue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Gigue is a minimal scheme interpriter written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published