This post was published long ago, when I was a student and an amateur blogger. The links might be outdated and content may not be useful anymore. Please read this content keeping its age in mind.
Subject : System Software Laboratory
Branch : Information Science & Engineering
Semester : 6
University : VTU
………………………………………………………………………………………………………………………….
PART – A
………………………………………………………………………………………………………………………….
6) Program to recognize the grammar (anb, n>= 10).
6.l
/* 6.l */
%{
#include<stdio.h>
#include “y.tab.h”
%}
%%
[aA] return A;
[bB] return B;
.|n return yytext[0];
%%
6.y
/* 6.y */
%{
#include<stdio.h>
%}
%token A B
%%
stmt: S ‘n’ {printf(“nValid expression”);exit(1);}
;
S: X B
X: X A | A A A A A A A A A A
%%
main()
{
printf(“nEnter the expression: “);
if(yyparse())
{
printf(“nValid expression”);
exit(0);
}
}
int yyerror()
{
printf(“nInvalid expressionn”);
return 1;
}
int yywrap()
{
return 1;
}
RAVi says
can't we download them?