summaryrefslogtreecommitdiff
path: root/lisp.lex
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-03-30 19:22:31 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-03-30 19:22:31 +0000
commitff0eee931d3918eedf1c125c58328e54b47a4994 (patch)
treea61c94e89ea76ef68c55a9fe387be0a1b56e8e3e /lisp.lex
init
Diffstat (limited to 'lisp.lex')
-rw-r--r--lisp.lex33
1 files changed, 33 insertions, 0 deletions
diff --git a/lisp.lex b/lisp.lex
new file mode 100644
index 0000000..8122d86
--- /dev/null
+++ b/lisp.lex
@@ -0,0 +1,33 @@
+%{
+#include <stdio.h>
+#include <string.h>
+#include "types.h"
+#include "y.tab.h"
+%}
+
+%%
+-?[0-9]+ {
+ yylval.intlit = strdup(yytext);
+ return INTLIT;
+}
+
+[A-z][A-z0-9]+|[+-/*%] {
+ yylval.name = strdup(yytext);
+ return NAME;
+}
+
+[(] {
+ return yytext[0];
+}
+
+[)] {
+ return yytext[0];
+}
+
+.|\n {;}
+
+%%
+
+int yywrap(){
+ return 1;
+}