Bison奇怪的C代码(yyerror)

ric*_*fox 5 c bison

我正在使用Bison创建一个简单的解析器,并且在理解下面的C代码时遇到一些麻烦.对我而言,它看起来不像是一个有效的语句,但gcc整齐地复制它,并且块中的代码在解析错误时执行.

我真的很想知道这实际意味着什么.

我引用的代码来自http://dinosaur.compilertools.net/bison/bison_7.html#SEC66:

yyerror (s) 
     char *s;
{
  // Some code here
}
Run Code Online (Sandbox Code Playgroud)

Let*_*_Be 8

这是K&R C.

在现代C(C89/90或C99)中,它将是:

int yyerror(char *s)
{
}
Run Code Online (Sandbox Code Playgroud)