Variableize Makefile and adjust pebble tokens

Also made repl() a void function
This commit is contained in:
= 2020-05-20 01:37:15 +01:00
parent 8bdf42f6fd
commit 7ad541eb02
3 changed files with 12 additions and 10 deletions

View File

@ -1,16 +1,17 @@
files = pebblisp.c tokens.c object.c env.c
exe = pebblisp
all:
gcc -g -O0 -o pebblisp -D STANDALONE $(files) && ./tests.sh
gcc -g -O0 -o $(exe) -D STANDALONE $(files) && ./tests.sh
notest:
gcc -g -O0 -o pebblisp -D STANDALONE $(files)
gcc -g -O0 -o $(exe) -D STANDALONE $(files)
val:
gcc -g -O0 -o pebblisp -D STANDALONE $(files) && ./tests.sh -val
gcc -g -O0 -o $(exe) -D STANDALONE $(files) && ./tests.sh -val
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:
./pebblisp
./$(exe)

View File

@ -41,16 +41,16 @@ char temptext[SMAX_LENGTH] = "";
char resulttext[RESULT_LENGTH] = "";
char *tokens[] = {
" ", "(", ")",
" ", "(", ")",
"+ ", "- ", "* ", "/ ",
"1","2","3",
"4","5","6",
"7","8","9", "0",
"a", "b", "c", "d", "e",
"= ", "< ", "> ",
"spent", "window",
"spent ", "window",
"\"",
"map", "fn", "def", "if", "\n",
"cat", "map", "fn", "def", "if", "\n",
END_PHRASE
};

View File

@ -84,7 +84,8 @@ void eval_forms(Object *destList, const Object *src, struct Environment *env)
{
int length = listLength(src) - 1; // Not counting first_form
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
int repl(struct Environment *env)
void repl(struct Environment *env)
{
char input[200] = "";
while(input[0] != 'q') {