Reputation: 339
I am compiling a very old program (wu-ftpd 2.6.1 circa 2000) and it was failing on this code:
cmd_list: /* empty */
| cmd_list cmd
= {
fromname = (char *) NULL;
restart_point = 0;
}
| cmd_list rcmd
;
Bison says the problem is the unexpected '=' which makes sense, as every other Yacc program I've seen (admittedly not very many) does not use an '=' sign there. I've replaced the =\t{
pattern with \t{
and the software builds (with many warnings of course) but I'm wondering how it was built in the past. Has Yacc syntax changed?
Upvotes: 2
Views: 68
Reputation: 241671
Yes, very old versions of yacc allowed the semantic action to be signaled with an =
. They also allowed actions consisting of single statements without enclosing braces.
This syntax was noted as obsolete in Stephen Johnson's original Yacc paper, which dates from the 1970s. See Appendix D: Old Features Supported but not Encouraged:
Actions may also have the form
= { . . . }
and the curly braces can be dropped if the action is a single C statement.
I did a quick check on my hard drive and found that the ={...}
syntax was accepted by bison 1.2.5 (1996), but it doesn't seem to be present in v1.875 (2003). Somewhere between those two versions, bison's original hand-built lexer was replaced with a lexer generated by (f)lex (and the hand-built parser was replaced with a bootstrapped parser); I suppose the obsolete syntax never made it into the new parser.
Upvotes: 5