diff options
Diffstat (limited to 'lisp.lex')
-rw-r--r-- | lisp.lex | 33 |
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; +} |