Skip to content

garlic0x1/scheme-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme

Scheme interpreter

Installation

build from source

git clone https://github.com/garlic0x1/scheme-interpreter.git
cd scheme-interpreter
cargo install --path .
scheme-interpreter

Usage

Commands:
  eval  evaluate a string
  run   run a file as a program
  repl  start a REPL
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Implemented

A list of what is done (not exhaustive)

special forms:

  • eval
    (eval (quote (println {:hi "world"})))
        

    evaluate Edn as lisp

  • load
    (load "test.scm")
        

    Evaluate a file

  • lambda
    (lambda [x] (println x))
        

    Create an anonymous function

  • def
    (def x "var")
        

    Define in global namespace

  • if
    (if pred? then else)
        

    If statement, returns branch. nil, false, 0, “”, etc are falsy

  • do
    (do (println "1") (println "2"))
        

    Evaluate multiple exprs, return last

  • quote
    (quote (1 2 3))
        

    Return list without evaluating

native fns:

  • conj
  • cons
  • car
  • cdr
  • =
  • +
  • *
  • /
  • mod
  • int
  • str
  • type
  • read
  • slurp
  • println
  • dbg

About

incomplete lisp with EDN syntax

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published