2012-03-15から1日間の記事一覧

注釈付きでマークされた文字列の解析 #10

C

書いたBNFを元に構文解析器と字句解析器のソースを書いてみる。 まず、構文解析器。 parser.y %{ #define YYSTYPE char* #include <stdio.h> #include <stdlib.h> #include <string.h> int yylex(void); void yyerror(char const *); static char *estrdupcat(const char *s1, const char </string.h></stdlib.h></stdio.h>…