Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / frontend / commonlisp2transpilerstr.l
diff options
context:
space:
mode:
Commit7cc99d560d3f36996dde0f73becd57445fc54d11 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-02-08 12:34:27 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-02-08 12:34:27 +0200
Files8284219e1186a554cf5050194e72a18708c6cdee /Year 2/Implementation of Programming Languages/Transpiler/frontend/commonlisp2transpilerstr.l
uni-projects-7cc99d560d3f36996dde0f73becd57445fc54d11.tar
uni-projects-7cc99d560d3f36996dde0f73becd57445fc54d11.tar.gz
uni-projects-7cc99d560d3f36996dde0f73becd57445fc54d11.zip
Parent90d86e8072e7246374076961a26cfd1024ac67f7 (diff)
[IPL/T] Added unfinished makefile and frontend
diff --git a/Year 2/Implementation of Programming Languages/Transpiler/frontend/commonlisp2transpilerstr.l b/Year 2/Implementation of Programming Languages/Transpiler/frontend/commonlisp2transpilerstr.l
new file mode 100644
index 0000000..d2bffba
--- /dev/null
+++ b/Year 2/Implementation of Programming Languages/Transpiler/frontend/commonlisp2transpilerstr.l
@@ -0,0 +1,30 @@
+%{
+#include "../build/commonlisp2transpilerstr.tab.h"
+%}
+
+DIGIT [0-9]
+LEFTBRACKET \(
+RIGHTBRACKET \)
+
+/* STR \"([^\"]|\\\")*([^\\]|\\\\)\" */
+INTEGER (\+|-)?{DIGIT}
+FLOAT {INTEGER}(\.{DIGIT}+(e{DIGIT}+|d{DIGIT}+|e-{DIGIT}+)?|\/{DIGIT}+)?
+
+COMMENT ;.*$
+
+FUNCTION "+ "|"- "|"* "|\/|defun|defvar|if|=|>|>=|<|<=
+
+%%
+
+{LEFTBRACKET} { return LBRACKET; }
+{RIGHTBRACKET} { return RBRACKET; }
+/* {STR} { yylval = strdup(yytext); return STR; } */
+{INTEGER} { yylval = strdup(yytext); return INTEGER; }
+{FLOAT} { yylval = strdup(yytext); return FLOAT;}
+
+{FUNCTION} { yylval = strdup(yytext); return FUNCTION; }
+
+ /* flex catches the longest possibility, so if some variable name contains a known word (function, macro, etc.), this will prevent it from highlighting */
+[A-z!-'*-@]+|" "|\t { yylval = strdup(yytext); return NAME; }
+
+%%