summaryrefslogtreecommitdiff
path: root/muse
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2012-06-07 17:53:43 -0400
committerOri Bernstein <orib@google.com>2012-06-07 17:53:43 -0400
commit9220a5e91430f73453e50cc48ffee026587e0e53 (patch)
tree949063093f90eccaa712ab1d7e56a431872ddf14 /muse
parent4cbf921e4eb323a3c8817e1471632fd25021a2a1 (diff)
downloadmc-9220a5e91430f73453e50cc48ffee026587e0e53.tar.gz
Add in stub for muse.
Diffstat (limited to 'muse')
-rw-r--r--muse/Makefile8
-rw-r--r--muse/main.c66
2 files changed, 74 insertions, 0 deletions
diff --git a/muse/Makefile b/muse/Makefile
new file mode 100644
index 0000000..636a391
--- /dev/null
+++ b/muse/Makefile
@@ -0,0 +1,8 @@
+BIN=muse
+OBJ=main.o
+
+CFLAGS+=-I../parse
+LDFLAGS+=-L../parse -lparse
+EXTRADEP=../parse/libparse.a
+
+include ../mk/c.mk
diff --git a/muse/main.c b/muse/main.c
new file mode 100644
index 0000000..b46ef08
--- /dev/null
+++ b/muse/main.c
@@ -0,0 +1,66 @@
+#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"
+
+Node *file;
+static char *outfile;
+int debug;
+
+static void usage(char *prog)
+{
+ printf("%s [-h] [-o outfile] inputs\n", prog);
+ printf("\t-h\tPrint this help\n");
+ printf("\t-d\tPrint debug dumps\n");
+ printf("\t-o\tOutput to outfile\n");
+}
+
+int main(int argc, char **argv)
+{
+ int opt;
+ int i;
+ Stab *globls;
+
+ while ((opt = getopt(argc, argv, "dho:")) != -1) {
+ switch (opt) {
+ case 'o':
+ outfile = optarg;
+ break;
+ case 'h':
+ case 'd':
+ debug++;
+ break;
+ default:
+ usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
+
+ for (i = optind; i < argc; i++) {
+ globls = mkstab();
+ tyinit(globls);
+ tokinit(argv[i]);
+ file = mkfile(argv[i]);
+ file->file.exports = mkstab();
+ file->file.globls = globls;
+ yyparse();
+
+ if (debug) {
+ /* before we do anything to the parse */
+ dump(file, stdout);
+ }
+ infer(file);
+ die("FIXME: IMPLEMENT ME!");
+ }
+
+ return 0;
+}