diff options
[IPL/T] Added unfinished makefile and frontend
1 files changed, 30 insertions, 0 deletions
| -rw-r--r-- | Year 2/Implementation of Programming Languages/Transpiler/frontend/commonlisp2transpilerstr.l | 30 |
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; } + +%% |
