From ff0eee931d3918eedf1c125c58328e54b47a4994 Mon Sep 17 00:00:00 2001 From: thing1 Date: Sun, 30 Mar 2025 19:22:31 +0000 Subject: init --- lisp.lex | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lisp.lex (limited to 'lisp.lex') 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 +#include +#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; +} -- cgit v1.2.3