yacc:%{} 在 yacc 中是什么意思?

yacc: What does %{} mean in yacc?

是说直接复制C代码吗? 这是摘自 ruby 源代码 parse.y

%{

#ifndef PARSER_DEBUG
#define PARSER_DEBUG 0
#endif
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
#define YYSTACK_USE_ALLOCA 0

#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/encoding.h"

定义部分放在%{%}

之间

The definitions section consists of token declarations and C code bracketed by "%{" and "%}".

DOC