summaryrefslogtreecommitdiff
path: root/lc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lc.c')
-rw-r--r--lc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lc.c b/lc.c
new file mode 100644
index 0000000..651ed95
--- /dev/null
+++ b/lc.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "lexer.h"
+
+int main(void)
+{
+ char *src = "12.3";
+ token *head = lexer_parse(src);
+
+ if (!head) {
+ printf("Parsing error!\n");
+ exit(1);
+ }
+ while (head->next) {
+ head = head->next;
+ printf("%d -> %.*s\n", head->type, head->length, head->lexeme);
+ free(head->prev);
+ }
+ return 0;
+}