Strange C code in Bison (yyerror)

I use Bison to create a simple analyzer and have some problems understanding the C code below. For me, this does not look like a valid statement, but gcc compiles it neatly and the code in the block executes when analyzing the error.

I would really like to know what that really means.

The code I refer to refers to http://dinosaur.compilertools.net/bison/bison_7.html#SEC66 :

yyerror (s) 
     char *s;
{
  // Some code here
}
+5
source share
4 answers

What is K & RC

In modern C (C89 / 90 or C99), which will be:

int yyerror(char *s)
{
}
+8
source

It means

int yyerror(char* s){
  //some code here
}

, .

+4
+3

GNU bison is now in version 2.5 , see here . Why are you using such an ancient version (you have been referring to bison 1.25 since 1996)?

The function is yyerrordesigned to recover errors . Simple example here

+1
source

All Articles