mirror of
https://github.com/samsonjs/lake.git
synced 2026-04-27 14:57:43 +00:00
add a readme, fix Makefile
This commit is contained in:
parent
70fe7a1a58
commit
f001af16ee
4 changed files with 46 additions and 3 deletions
2
Makefile
2
Makefile
|
|
@ -1,4 +1,4 @@
|
||||||
CC=gcc -Wall -ansi -G
|
CC=gcc -Wall -g
|
||||||
|
|
||||||
all: lake
|
all: lake
|
||||||
|
|
||||||
|
|
|
||||||
43
Readme.md
Normal file
43
Readme.md
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
Lake Scheme
|
||||||
|
===========
|
||||||
|
|
||||||
|
A quick and dirty scheme written in C, for fun and to use while reading The Little Schemer. Very quick and dirty, a weekend hack.
|
||||||
|
|
||||||
|
Compiling & Running
|
||||||
|
===================
|
||||||
|
|
||||||
|
Portable ANSI C, no deps, nothing to configure, no documentation!
|
||||||
|
|
||||||
|
$ make
|
||||||
|
$ ./lake
|
||||||
|
|
||||||
|
That will drop you at a repl. You can type expressions and they will be echoed back to you. There are symbols, integers, strings, and lists.
|
||||||
|
|
||||||
|
> (foo bar 42 "hello" (nested list))
|
||||||
|
(foo bar 42 "hello" (nested list))
|
||||||
|
|
||||||
|
Hooray! It parses (reads), evaluates, and then prints things back.
|
||||||
|
|
||||||
|
Lake needs:
|
||||||
|
|
||||||
|
* booleans
|
||||||
|
* chars
|
||||||
|
* functions
|
||||||
|
* flesh out eval, write apply
|
||||||
|
* dotted lists
|
||||||
|
* primitives (especially define)
|
||||||
|
* define and friends
|
||||||
|
* branching
|
||||||
|
* native type operations
|
||||||
|
* symbol
|
||||||
|
* integer (math)
|
||||||
|
* boolean (logic)
|
||||||
|
* char
|
||||||
|
* string
|
||||||
|
* function
|
||||||
|
* list (cons, car, cdr, ...)
|
||||||
|
* dotted list
|
||||||
|
* a minimal stdlib
|
||||||
|
* sugar such as '... -> (quote ...)
|
||||||
|
|
||||||
|
I don't think I'll need any other numeric types, but they are easy to implement anyway when performance is no concern and they're all boxed.
|
||||||
2
lake.c
2
lake.c
|
|
@ -5,7 +5,7 @@
|
||||||
* Copyright 2011 Sami Samhuri
|
* Copyright 2011 Sami Samhuri
|
||||||
* MIT License
|
* MIT License
|
||||||
*
|
*
|
||||||
* A quick and dirty scheme written in C for fun and to use while
|
* A quick and dirty scheme written in C, for fun and to use while
|
||||||
* reading The Little Schemer.
|
* reading The Little Schemer.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
2
sym.c
2
sym.c
|
|
@ -27,7 +27,7 @@ LakeSym *sym_intern(char *s)
|
||||||
sym->n = n;
|
sym->n = n;
|
||||||
sym->s = strdup(s);
|
sym->s = strdup(s);
|
||||||
sym->hash = ht_hash(s, n, symbols->size);
|
sym->hash = ht_hash(s, n, symbols->size);
|
||||||
ht_put(symbols, sym->s, sym->n, sym, sizeof(LakeSym));
|
ht_put(symbols, sym->s, sym->n, sym, VAL_SIZE(sym));
|
||||||
}
|
}
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue