Variableize Makefile and adjust pebble tokens
Also made repl() a void function
This commit is contained in:
parent
8bdf42f6fd
commit
7ad541eb02
11
src/Makefile
11
src/Makefile
|
@ -1,16 +1,17 @@
|
||||||
files = pebblisp.c tokens.c object.c env.c
|
files = pebblisp.c tokens.c object.c env.c
|
||||||
|
exe = pebblisp
|
||||||
|
|
||||||
all:
|
all:
|
||||||
gcc -g -O0 -o pebblisp -D STANDALONE $(files) && ./tests.sh
|
gcc -g -O0 -o $(exe) -D STANDALONE $(files) && ./tests.sh
|
||||||
|
|
||||||
notest:
|
notest:
|
||||||
gcc -g -O0 -o pebblisp -D STANDALONE $(files)
|
gcc -g -O0 -o $(exe) -D STANDALONE $(files)
|
||||||
|
|
||||||
val:
|
val:
|
||||||
gcc -g -O0 -o pebblisp -D STANDALONE $(files) && ./tests.sh -val
|
gcc -g -O0 -o $(exe) -D STANDALONE $(files) && ./tests.sh -val
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
gcc -g -O0 -o pebblisp -D STANDALONE -D DEBUG $(files) && ./tests.sh
|
gcc -g -O0 -o $(exe) -D STANDALONE -D DEBUG $(files) && ./tests.sh
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./pebblisp
|
./$(exe)
|
||||||
|
|
|
@ -48,9 +48,9 @@ char *tokens[] = {
|
||||||
"7","8","9", "0",
|
"7","8","9", "0",
|
||||||
"a", "b", "c", "d", "e",
|
"a", "b", "c", "d", "e",
|
||||||
"= ", "< ", "> ",
|
"= ", "< ", "> ",
|
||||||
"spent", "window",
|
"spent ", "window",
|
||||||
"\"",
|
"\"",
|
||||||
"map", "fn", "def", "if", "\n",
|
"cat", "map", "fn", "def", "if", "\n",
|
||||||
END_PHRASE
|
END_PHRASE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,8 @@ void eval_forms(Object *destList, const Object *src, struct Environment *env)
|
||||||
{
|
{
|
||||||
int length = listLength(src) - 1; // Not counting first_form
|
int length = listLength(src) - 1; // Not counting first_form
|
||||||
for(int i = 0; i < length; i++) { // Evaluates all in list
|
for(int i = 0; i < length; i++) { // Evaluates all in list
|
||||||
destList[i] = eval(itemAt(src, i + 1), env); // Skip the first
|
Object *ptr = itemAt(src, i + 1); // Skip the first
|
||||||
|
destList[i] = eval(ptr, env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +412,7 @@ Object parseEval(const char *input, struct Environment *env)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
int repl(struct Environment *env)
|
void repl(struct Environment *env)
|
||||||
{
|
{
|
||||||
char input[200] = "";
|
char input[200] = "";
|
||||||
while(input[0] != 'q') {
|
while(input[0] != 'q') {
|
||||||
|
|
Loading…
Reference in New Issue