summaryrefslogtreecommitdiff
path: root/parse/names.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@odin.theasylum>2011-11-05 01:32:46 -0400
committerOri Bernstein <ori@odin.theasylum>2011-11-05 01:34:58 -0400
commit76d42756c93a7f8e1519268b8eb693ba36db4652 (patch)
treecd51bfe84f24f8aba6fd4aaf0885cb03b0e13f73 /parse/names.c
downloadmc-76d42756c93a7f8e1519268b8eb693ba36db4652.tar.gz
Initial commit
Diffstat (limited to 'parse/names.c')
-rw-r--r--parse/names.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/parse/names.c b/parse/names.c
new file mode 100644
index 0000000..e3f626f
--- /dev/null
+++ b/parse/names.c
@@ -0,0 +1,56 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <ctype.h>
+#include <string.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "parse.h"
+
+char *optab[] = {
+#define O(op) #op,
+#include "ops.def"
+#undef O
+};
+
+char *nodetab[] = {
+#define N(nt) #nt,
+#include "nodes.def"
+#undef N
+};
+
+char *littab[] = {
+#define L(lt) #lt,
+#include "lits.def"
+#undef L
+};
+
+char *tidtab[] = {
+#define Ty(t) #t,
+#include "types.def"
+#undef Ty
+};
+
+char *opstr(Op o)
+{
+ return optab[o];
+}
+
+char *nodestr(Ntype nt)
+{
+ return nodetab[nt];
+}
+
+char *litstr(Littype lt)
+{
+ return littab[lt];
+}
+
+char *tidstr(Ty tid)
+{
+ return tidtab[tid];
+}