summaryrefslogtreecommitdiff
path: root/yy/main.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-01-18 13:03:34 -0600
committersanine <sanine.not@pm.me>2023-01-18 13:03:34 -0600
commit82f47550fe3327cce6f2e0e1bf62e81d9ebcf90c (patch)
tree18c15c14a3f1623a4343d36a2f518ee6f51f204a /yy/main.c
parent8d5389d66ef79b58a0fff32fa2b01b4206bfb311 (diff)
begin reentrant refactor
Diffstat (limited to 'yy/main.c')
-rw-r--r--yy/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/yy/main.c b/yy/main.c
new file mode 100644
index 0000000..d53a598
--- /dev/null
+++ b/yy/main.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include "kalmia.h"
+
+int main(int argc, char **argv)
+{
+ if (argc < 2) {
+ fprintf(stderr, "You must specify a file to parse!\n");
+ return -1;
+ }
+ FILE *in = fopen(argv[1], "r");
+ if (in == NULL) {
+ fprintf(stderr, "Could not open file \"%s\"\n", argv[1]);
+ return -1;
+ }
+
+ yyscan_t scanner;
+ yylex_init(&scanner);
+ yyset_in(in, scanner);
+ yyparse(scanner);
+ yylex_destroy(scanner);
+ return 0;
+}