Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alandipert/shave
a wannabe lisp interpreter
https://github.com/alandipert/shave
Last synced: 7 days ago
JSON representation
a wannabe lisp interpreter
- Host: GitHub
- URL: https://github.com/alandipert/shave
- Owner: alandipert
- Created: 2009-07-02T10:32:54.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2009-07-02T10:52:24.000Z (over 15 years ago)
- Last Synced: 2024-08-03T18:16:42.392Z (3 months ago)
- Language: C
- Homepage:
- Size: 84 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
- AwesomeInterpreter - shave
README
shave
This is the beginnings of a LISP interpreter. It's kind of full of garbage right now, because I got impatient and started copy-pasting. The lexer is handwritten, so yeah, it rules. The generated AST is a big linked list, which is evaluated in the eval step. The AST is made up of 'Token' structs, which have type and property enums used by the eval routines.
My end goal here is to make the cleanest, smallest, and simplest implementation of LISP that would handle the recursive computation of a factorial:
(defun factorial (n)
(if (<= n 1)
1
(* n (factorial (- n 1)))))There's a ways to go; namely cleanup and implementing defun.
compile:
$ make
use:
$ ./shave
shave.
> (if (> 3 2) (/ 9 (+ 3 2)))
list:
if:list:
>:
atom: 3
atom: 2list:
/:
atom: 9list:
+:
atom: 3
atom: 2
atom: 1.8