ChrisDodd / btyacc

Backtracking yacc
17 stars 5 forks source link

Use and generate enum instead of defined constants #15

Closed zosrothko closed 8 years ago

zosrothko commented 8 years ago

Hi

This PR brings enum to btyacc: -- btyacc is using enum instead of predefined constants in defs.h -- btyacc generates enum [class] YYTOKEN instead of predefined constants for the tokens.

Also, yyname is no more static to allow access of the symbol's name from outside the compile unit.

ChrisDodd commented 8 years ago

I'm of mixed feelings about this change. While enums are generally better than #defines, the POSIX yacc spec requires that tokens be defined as macros. This can come up with someone using #ifdef TOKEN in their lexer code.

zosrothko commented 8 years ago

OK, I didn't know about the POSIX requirments of #define in the generated parser.. So I will close this PR.