summaryrefslogtreecommitdiff
path: root/c99.l
diff options
context:
space:
mode:
Diffstat (limited to 'c99.l')
-rw-r--r--c99.l15
1 files changed, 15 insertions, 0 deletions
diff --git a/c99.l b/c99.l
new file mode 100644
index 0000000..184980d
--- /dev/null
+++ b/c99.l
@@ -0,0 +1,15 @@
+%{
+#include "c99.tab.h"
+%}
+
+%%
+; { printf ("SEMICOLON\n"); return SEMICOLON; }
+"+" { printf ("PLUS\n"); return PLUS; }
+"-" { printf ("MINUS\n"); return MINUS; }
+int { printf ("INT\n"); return INT; }
+"\".*\"" { printf ("string literal:%s\n", yytext); return STRING; }
+[a-zA-z_]+ { printf ("identifier: %s\n", yytext); return IDENTIFIER; }
+"/*[.]**/" { printf ("COMMENT\n"); return COMMENT; }
+%%
+
+int yywrap (void) { return 0; }