I am trying to implement one Lex program that accepts input of the following forms.
Code:
(NOT(NOT(NOT(P))))
(NOT(P))
(NOT(NOT(NOT(NOT(P)))))
And I wrote the following code.
Code:
%{
#include <stdio.h>
%}
%option noyywrap
delim [ \t\n]
ws {delim}*
awfp \({ws}[A-Z]{ws}\)
NOTwfp \({ws}"NOT"{ws}{awfp}{ws}\)
NOTwfpR \({ws}"NOT"{ws}{NOT}{ws}\)
NOT {NOTwfpR}|{NOTwfp}
%%
{NOT} { printf("%s\n",yytext); }
.|\n { /* Ignore all other characters. */ }
%%
int main()
{
/* Call the lexer, then quit. */
yylex();
return 0;
}
I am getting the following error.
Code:
flex scanner push-back overflow