Mini lisp interpreter written in Go.

Overview

Mini Go Lisp

Go Report Card Actions Status

Mini lisp interpreter written in Go. It is implemented with reference to the d-tsuji/SDLisp repository written in Java.

Support

  • System Functions
    • car
    • cdr
    • cons
    • eq
    • if
    • arithmetic operations (+, -, *, /)
    • comparative operation (>, <, >=, <=, =)
  • Special
    • symbol-function
    • quote or '
    • setq
    • defun

Usage

$ go run github.com/d-tsuji/gosdlisp/cmd/gosdlisp

Some examples

> (+ 1 2)
3
> (cons 1 '(2 3))
(1 2 3)
> (defun 1+ (n) (+ n 1))
1+
> (1+ 10)
11
> (defun abs (n) (if (< n 0) (- 0 n) n))
ABS
> (abs -1)
1
> (defun gcd (m n) (if (= (mod m n) 0) n (gcd n (mod m n))))
GCD
> (gcd 12 18)
6
> (defun fact (n) (if (< n 1) 1 (* n (fact (- n 1)))))
FACT
> (fact 10)
3628800
> (defun fib (n) (if (<= n 1) n (+ (fib (- n 1)) (fib (- n 2)))))
FIB
> (fib 11)
89

See eval_test.go for other examples of how it works.

You might also like...
A simple virtual machine - compiler & interpreter - written in golang

go.vm Installation Build without Go Modules (Go before 1.11) Build with Go Modules (Go 1.11 or higher) Usage Opcodes Notes The compiler The interprete

interpreter for the basic language written in golang
interpreter for the basic language written in golang

jirachi interpreter for the basic language written in golang The plan supports the following functions: Arithmetic Operations (+, -, *, /, ^) Comparis

◻️ A Whitespace interpreter written in Go.

whitespace-go A Whitespace interpreter written in Go. Whitespace is a esoteric programming language made up entirely of spaces, tabs, and newlines. Th

🧠 A Brainfuck interpreter written in Go

brainfuck-go A Brainfuck interpreter written in Go. How Brainfuck works Brainfuck is an esoteric programming language designed to have the simplest co

A little brainfuck interpreter written in Go

Brainfuck_go_interpreter A little brainfuck interpreter written in Go from what I've done in coding game Usage $ go build brainfuck.go $ ./brainfuck P

An interpreter written in go for a brainfuck-based language called €*

eurostar-go-interpreter This is an interpreter written in go for a brainfuck-bas

Bf - A brainfuck interpreter written in Go while the programmer was drunk
Bf - A brainfuck interpreter written in Go while the programmer was drunk

BF A (not well tested) brainfuck interpreter written in Go while the programmer

DEPRECATED. Embeds mruby (mini Ruby) VM into Go.

GoMRuby Package gomruby embeds mruby (mini Ruby) VM into Go. Documentation. Installation It's slightly more than just go get: go get -d github.com/Ale

This vitual os application consist of 3 mini applications embedded in it like weather app , text editor and calculator .

Virtual-Operating-System This vitual os application consist of 3 mini applications embedded in it like weather app , text editor and calculator . APPS

Owner
Tsuji Daishiro
Tsuji Daishiro
Lisp Interpreter

golisp Lisp Interpreter Usage $ golisp < foo.lisp Installation $ go get github.com/mattn/golisp/cmd/golisp Features Call Go functions. Print random in

mattn 123 Dec 15, 2022
Toy Lisp 1.5 interpreter

Lisp 1.5 To install: go get robpike.io/lisp. This is an implementation of the language defined, with sublime concision, in the first few pages of the

Rob Pike 895 Jan 1, 2023
Interactive Go interpreter and debugger with REPL, Eval, generics and Lisp-like macros

gomacro - interactive Go interpreter and debugger with generics and macros gomacro is an almost complete Go interpreter, implemented in pure Go. It of

Massimiliano Ghilardi 2k Dec 30, 2022
Interpreter - The Official Interpreter for the Infant Lang written in Go

Infant Lang Interpreter Infant Lang Minimalistic Less Esoteric Programming Langu

Infant Lang 2 Jan 10, 2022
A dialect of Lisp extended to support concurrent programming, written in Go.

LispEx A dialect of Lisp extended to support concurrent programming. Overview LispEx is another Lisp Interpreter implemented with Go. The syntax, sema

null 181 Nov 22, 2022
A Lisp-dialect written in Go

Lispy ✏️ Intro Lispy is a programming language that is inspired by Scheme and Clojure. It's a simple Lisp-dialect I built to better understand Lisp an

Amir Bolous 22 Dec 8, 2022
Sabre is highly customisable, embeddable LISP engine for Go. :computer:

Sabre DEPRECATED: This repository is deprecated in favour much better slurp project and will be archived/removed soon. Sabre is highly customizable, e

Shivaprasad Bhat 28 May 23, 2021
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

mattn 1.3k Dec 23, 2022
A POSIX-compliant AWK interpreter written in Go

GoAWK: an AWK interpreter written in Go AWK is a fascinating text-processing language, and somehow after reading the delightfully-terse The AWK Progra

Ben Hoyt 1.6k Dec 31, 2022
A BASIC interpreter written in golang.

05 PRINT "Index" 10 PRINT "GOBASIC!" 20 PRINT "Limitations" Arrays Line Numbers IF Statement DATA / READ Statements Builtin Functions Types 30 PRINT "

Steve Kemp 289 Dec 24, 2022