All Projects → xrlin → Goscheme

xrlin / Goscheme

Licence: gpl-3.0
Just another scheme interpreter.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
scheme
763 projects

Projects that are alternatives of or similar to Goscheme

Blink Lexer
Starting code of the first challenge in the Let's Build a Programming Language series.
Stars: ✭ 24 (-41.46%)
Mutual labels:  interpreter
Monkey v
[WIP] Implementation of Monkey 🐒 Language in V
Stars: ✭ 29 (-29.27%)
Mutual labels:  interpreter
Brainfuck C
Brainfuck interpreter in C.
Stars: ✭ 36 (-12.2%)
Mutual labels:  interpreter
Jasl
Just another scripting language
Stars: ✭ 25 (-39.02%)
Mutual labels:  interpreter
Mappy
A functional programming language. Like LISP but focused around maps rather than lists.
Stars: ✭ 10 (-75.61%)
Mutual labels:  interpreter
Pseudo
PSeudo - The world's simplest PLAYSTATION emulator
Stars: ✭ 31 (-24.39%)
Mutual labels:  interpreter
Mico
Mico ("Monkey" in catalan). Monkey language implementation done with C++. https://interpreterbook.com/
Stars: ✭ 19 (-53.66%)
Mutual labels:  interpreter
Goawk
A POSIX-compliant AWK interpreter written in Go
Stars: ✭ 995 (+2326.83%)
Mutual labels:  interpreter
Esta
Interpreted language and bytecode VM of my own design written in Rust [Unmaintained]
Stars: ✭ 28 (-31.71%)
Mutual labels:  interpreter
Seax
A VM-based runtime environment for functional programming languages
Stars: ✭ 36 (-12.2%)
Mutual labels:  interpreter
Androidfancydrawable
Android animation interpolator based on bezier curve.
Stars: ✭ 26 (-36.59%)
Mutual labels:  interpreter
Littlec
A modified version of the LittleC Interpreter from Herbert Schildt's C: The Complete Reference (4th Ed.)
Stars: ✭ 10 (-75.61%)
Mutual labels:  interpreter
Rustpython
A Python Interpreter written in Rust
Stars: ✭ 10,261 (+24926.83%)
Mutual labels:  interpreter
Moonsharp
An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.
Stars: ✭ 926 (+2158.54%)
Mutual labels:  interpreter
Rascal
A simple Pascal interpreter written in rust.
Stars: ✭ 38 (-7.32%)
Mutual labels:  interpreter
Poop
A new perspective on programming
Stars: ✭ 19 (-53.66%)
Mutual labels:  interpreter
Hadeslang
The Hades Programming Language
Stars: ✭ 30 (-26.83%)
Mutual labels:  interpreter
Openxion
OpenXION - Reference Implementation of the XION Scripting Language
Stars: ✭ 40 (-2.44%)
Mutual labels:  interpreter
Mips
MIPS assembler and simulator
Stars: ✭ 38 (-7.32%)
Mutual labels:  interpreter
Nimlox
Interpreter for the 'Lox' language written in Nim
Stars: ✭ 35 (-14.63%)
Mutual labels:  interpreter

GoScheme


Just another shceme interpreter written in Go.

godoc

Installation

go get github.com/xrlin/goscheme/cmd/goscheme

Or you can download the corresponding pre-compiled executable file in release page.

Usage

# Just run goscheme to enter interactive shell
goscheme

# Run a scheme file
goscheme test.scm

Examples

  • Calculate nth fibonacci number

    ; calculate nth fibonacci number
    (define (fib n)
       (if (<= n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))
    
    (fib 10)
     
    ;#=> 55
     
    ; calculate nth fibnacci number in tail recursion
    (define (fib2 n)
       (begin (define (fib-iter a b n)
             (if (= n 0) b (fib-iter b (+ a b) (- n 1))))
       (fib-iter 0 1 (- n 1))))
    (fib2 30)
    ;#=>832040
    
  • Mutually recursion

    (letrec (
        (zero? (lambda (x) (= x 0)))
        (even?
        (lambda (n)
        (if (zero? n)
            #t
            (odd? (- n 1)))))
        (odd?
            (lambda (n)
            (if (zero? n)
                #f
                (even? (- n 1))))))
    (even? 88))
    ;#=>#t
    

Explore example.scm for more examples.

Features

  • Interactive REPL shell

  • Tail recursion optimization

  • Lazy evaluation

  • Short circut logic

  • Type: String, Number, Quote, LambdaProcess, Pair, Bool ...

  • syntax, builtin functions and procedures

    load define let let* letrec begin lambda and or not if cond delay map reduce force + - * / = cons list append list-length list-ref quote null? ' eval apply set! set-cdr! set-car! ... etc

Though it is a toy project just for fun and practice, Feel free to open an issue or make a merge request is you find bugs or have some suggestions.

Happy coding...

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].