/*
- * Copyright (C) 2012
- * Dale Weiler
+ * Copyright (C) 2012
+ * Dale Weiler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include "gmqcc.h"
+#include "gmqcc.h"
+
+bool parser_compile(const char *filename);
int main(int argc, char **argv) {
- argc--;
- argv++;
-
- const char *ifile = argv[0];
-
- FILE *fp = fopen(ifile, "r");
- if (!fp) {
- fclose(fp);
- return error(ERROR_COMPILER, "Source file: %s not found\n", ifile);
- } else {
- struct lex_file *lex = lex_open(fp);
- lex->name = util_strdup(ifile);
- if (!lex) {
- fclose(fp);
- return 0;
- }
- parse_tree(lex);
- mem_d(lex->name);
- lex_close (lex);
- }
-
- code_write();
- return 0;
+ util_debug("COM", "starting ...\n");
+
+ if (argc == 2) {
+ if (!parser_compile(argv[1])) {
+ printf("There were compile errors\n");
+ }
+ }
+
+ util_debug("COM", "cleaning ...\n");
+
+ util_meminfo();
+ return 0;
}