0
只是採樣的情況下野牛-d創建頭文件不能包含頭文件正確
test.grm
%{
#include <stdio.h>
%}
%token id
%start program
%%
program: exp
exp: ID
ID: id
野牛-d test.grm -o test.c的奧特生成測試。^h
#ifndef YY_TEST_H
# define YY_TEST_H
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype {
id = 258
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_TEST_H */
你可以看到的#include是不是在這個文件。這個會有一個問題,當.grm使用頭文件中被定義在%{%}一些定義。
這裏是我的問題,我如何自動生成test.h包括%{%}中包含的內容。