Created
December 13, 2014 05:15
-
-
Save wei2912/5362ee165f2f8407fdf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %{ | |
| #include <stdio.h> | |
| enum yytokentype { | |
| COMMA = 258, | |
| SEMICOLON = 259 | |
| }; | |
| char *yylval; | |
| %} | |
| %% | |
| "#".+?"\n" { /* comment */ } | |
| \s+ {} | |
| "," { return COMMA; } | |
| ";" { return SEMICOLON; } | |
| %% | |
| int main(int argc, char **argv) { | |
| int tok; | |
| while (tok = yylex()) { | |
| printf("%d\n", tok); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment