aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-09-25 14:30:42 +0200
committerCamil Staps2016-09-25 14:30:42 +0200
commitbcf15d34aae382076cf4dd09336ff7c8d02af5be (patch)
tree7fd7c65f5ef884b388fa3bea66910ea86eded57b
parentConstant code names (diff)
Various minor cleanups
-rw-r--r--.gitignore2
-rw-r--r--interpreter/.gitignore2
-rw-r--r--interpreter/Makefile2
-rw-r--r--interpreter/code.h3
-rw-r--r--interpreter/print.c5
5 files changed, 6 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a7cf6c8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+graph-*.png
+graph-*.dot
diff --git a/interpreter/.gitignore b/interpreter/.gitignore
index 165017a..ea6faae 100644
--- a/interpreter/.gitignore
+++ b/interpreter/.gitignore
@@ -1,4 +1,2 @@
*.o
-graph-*.png
-graph-*.dot
fuspel
diff --git a/interpreter/Makefile b/interpreter/Makefile
index 61be68d..8edcabe 100644
--- a/interpreter/Makefile
+++ b/interpreter/Makefile
@@ -1,4 +1,4 @@
-CFLAGS=-Werror -Wall -Wextra
+CFLAGS=-Werror -Wall -Wextra -O3
DEPS=lex.h syntax.h print.h parse.h log.h eval.h mem.h code.h graphs.h
OBJ=fuspel.o lex.o syntax.o print.o parse.o log.o eval.o mem.o code.o graphs.o
diff --git a/interpreter/code.h b/interpreter/code.h
index d139fb1..144a7c3 100644
--- a/interpreter/code.h
+++ b/interpreter/code.h
@@ -10,7 +10,4 @@ typedef void (Code_2) (struct node**, struct node*, struct node*);
unsigned char code_find(char* name, void** function);
-void code_mul(struct node** result, struct node* a, struct node* b);
-void code_sub(struct node** result, struct node* a, struct node* b);
-
#endif
diff --git a/interpreter/print.c b/interpreter/print.c
index 78976c2..d410ba2 100644
--- a/interpreter/print.c
+++ b/interpreter/print.c
@@ -9,7 +9,7 @@
#include "mem.h"
void print_token(token* tk) {
- char c;
+ char c = NULL;
switch (tk->kind) {
case TOKEN_SEMICOLON: c = ';'; break;
case TOKEN_COLON: c = ':'; break;
@@ -28,7 +28,8 @@ void print_token(token* tk) {
printf("%d", *((int*) tk->var));
return;
}
- printf("%c", c);
+ if (c)
+ printf("%c", c);
}
void print_token_list(token_list* list) {