%{
#include<stdio.h>
int isS=1;
%}
%%
" and " {isS=0; printf(" and ");}
" or " {isS=0; printf(" or ");}
"\n" if(isS==1){ printf("\nSimple\n"); }else{ printf("\nCompound\n"); isS=1; }
%%
int main(){
extern FILE *yyin;
yyin=fopen("SimpleCompound.txt","r");
yylex();
}
int yywrap(){return 1;}
File Name: simpleCompound.l
input file name should be SimpleCompound.txt
0 Comments