summaryrefslogtreecommitdiff
path: root/lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'lex.l')
-rw-r--r--lex.l53
1 files changed, 0 insertions, 53 deletions
diff --git a/lex.l b/lex.l
deleted file mode 100644
index 64c3765..0000000
--- a/lex.l
+++ /dev/null
@@ -1,53 +0,0 @@
-%{
-#include "ast.h"
-#include "grammar.tab.h"
-%}
-
-%%
-"+" { return OPERATOR_PLUS; }
-"-" { return OPERATOR_MINUS; }
-"=" { return ASSIGN; }
-
-"function" { return FUNCTION; }
-"if" { return IF; }
-"else" { return ELSE; }
-"return" { return RETURN; }
-"const" { return CONST; }
-"var" { return VAR; }
-
-"integer" { return TYPE_INTEGER; }
-"string" { return TYPE_STRING; }
-"void" { return TYPE_VOID; }
-
-"(" { return PARENTHESIS_LEFT; }
-")" { return PARENTHESIS_RIGHT; }
-"{" { return BRACE_LEFT; }
-"}" { return BRACE_RIGHT; }
-"[" { return BRACKET_LEFT; }
-"]" { return BRACKET_RIGHT; }
-
-"," { return COMMA; }
-":" { return COLON; }
-
-[a-zA-Z][a-zA-Z0-9]* { yylval.string = yytext; return IDENTIFIER; }
-[0-9]+ { yylval.number = atoi(yytext); return NUMBER; }
-"//".* { return COMMENT; }
-
-\n { return END_OF_LINE; }
-[ \t] {}
-
-. { printf("undefined: %c\n", *yytext); }
-%%
-
-void henshin_lex(int argc, char **argv)
-{
- int tok;
-
- while (tok = yylex()) {
- printf("%d", tok);
- if (tok == NUMBER) {
- printf(" = %d", yylval);
- }
- printf("\n");
- }
-}