gs

command module
v0.0.0-...-5c28dc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2016 License: MIT Imports: 9 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package eval implements an evaluator of gigue.
Package eval implements an evaluator of gigue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL