2008-07-11から1日間の記事一覧

よくよく考えたら

c

ゆの in Lex - daily dayflower ゆの in yacc - daily dayflower どちらも標準入力から読んで答えを吐いているので,要件と違う気がしてきた。これじゃだめですね。でも bison で '/' とか ' とか token にできない(クォーテーションで囲まないとだめ)。ぐ…

ゆの in yacc

c

パーサかませばなんでもありだな…… %{ #include <stdio.h> #include <string.h> %} %union { char *str; } %token X %token <str> STRING %type <str> face mouths left_part right_part mouth %% sayhello: face '<' STRING '!' { fputs($1, stdout); fputc(' ', stdout); fputs($3, stdo</str></str></string.h></stdio.h>…

ゆの in Lex

c

元ネタ*1がいまいちわかんないすが,id:cho45 さんに捕捉されたかったので書いてみました。Lex なので C と絡めないと動かないところが歯がゆいところですけど。 %{ #include <stdio.h> int yywrap(void) { return 1; } %} %x BACK %x SPEAK %% [ \t]+ /* whitespaces</stdio.h>…