Created
March 24, 2016 20:08
-
-
Save snaka/c8bc1dc96197ec50544f to your computer and use it in GitHub Desktop.
lex(flex)でズンドコキヨシ
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
%option noyywrap | |
%{ | |
int zun = 0; | |
%} | |
%state ZUN | |
%state FILLED | |
%% | |
<INITIAL>ズン { ECHO; BEGIN ZUN; zun = 1; } | |
<ZUN>ズン { | |
ECHO; | |
zun++; | |
if (zun >= 4) BEGIN FILLED; | |
} | |
<ZUN>ドコ { | |
ECHO; | |
BEGIN INITIAL; | |
zun = 0; | |
} | |
<FILLED>ドコ { | |
ECHO; | |
printf("\n\キ・ヨ・シ!/\n"); | |
exit(0); | |
} | |
%% | |
int main(void) { | |
yylex(); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment