aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-06-05 02:49:50 +0200
committerpacien2018-06-05 02:49:50 +0200
commitfe36a92c2d22057e8bbbf4c248706984f06415c0 (patch)
treeeb7fea744e7f9166b3794f28a9d1a643a4633210
parentfb9befa3d883250d67b6cec492018c78f89ef2e8 (diff)
downloadtpc-compiler-fe36a92c2d22057e8bbbf4c248706984f06415c0.tar.gz
Add void type
-rw-r--r--src/symbol_table.c2
-rw-r--r--src/symbol_table.h3
-rw-r--r--src/tpc.lex1
3 files changed, 5 insertions, 1 deletions
diff --git a/src/symbol_table.c b/src/symbol_table.c
index 60f2cd6..3ac34fb 100644
--- a/src/symbol_table.c
+++ b/src/symbol_table.c
@@ -203,6 +203,8 @@ static char *string_of_type(int type) {
203 return "INT"; 203 return "INT";
204 case CHAR: 204 case CHAR:
205 return "CHAR"; 205 return "CHAR";
206 case VOID:
207 return "VOID";
206 default: 208 default:
207 return "UNEXPECTED"; 209 return "UNEXPECTED";
208 } 210 }
diff --git a/src/symbol_table.h b/src/symbol_table.h
index 917e4f9..cd14ae2 100644
--- a/src/symbol_table.h
+++ b/src/symbol_table.h
@@ -16,7 +16,8 @@
16 16
17typedef enum type { 17typedef enum type {
18 INT, 18 INT,
19 CHAR 19 CHAR,
20 VOID
20} Type; 21} Type;
21 22
22typedef struct { 23typedef struct {
diff --git a/src/tpc.lex b/src/tpc.lex
index bdf6bb5..7d907b4 100644
--- a/src/tpc.lex
+++ b/src/tpc.lex
@@ -7,6 +7,7 @@
7#include "tpc.tab.h" 7#include "tpc.tab.h"
8#define INT 0 8#define INT 0
9#define CHAR 1 9#define CHAR 1
10#define VOID 2
10int lineno = 1; 11int lineno = 1;
11%} 12%}
12 13