I was just wondering whether its possible to make YACC report a syntax error on all symbols not defined in a LEX file.
Eg.
Lex file
/*dummy.l*/
%{
#include "dummy.tab.h"
%%
int return INT;
[a-z]+ return ID;
[0-9]+ return NUM;
%%
Yacc file
/*dummy.y*/
%token INT ID NUM
%%
var : INT ID "=" NUM ";"
%%
int main(void) {
yyparse();
}
Say I have these 2 files, how do I make it so that my program will report a syntax error when a
$(dollar symbol) appears in the input.
Eg. It will still accept on input
int a = 234; $
NOTE: I want to reject all symbols that ARE NOT defined