Future Vision BIE Future Vision BIE


ONE STOP FOR ALL STUDY MATERIALS & LAB PROGRAMS


E MENU Whatsapp Share Join Telegram, to get Instant Updates
× NOTE! Click on MENU to Browse between Subjects...

Advertisement

SYSTEM SOFTWARE AND OPERATING SYSTEM LABORATORY

[As per Choice Based Credit System (CBCS) scheme]

(Effective from the academic year 2017 - 2018)

SEMESTER - VI

Subject Code 17CSL67

IA Marks 40

Number of Lecture Hours/Week 01I + 02P

Exam Marks 60



17CSL67 - SYSTEM SOFTWARE AND OPERATING SYSTEM LABORATORY

Program 2

Develop, Implement and Execute a program using YACC tool to recognize all strings ending with b preceded by na's using the grammar anb (note: input n value)




Advertisement



Advertisement

Lex Program

 1
2
3
4
5
6
7
8
%{
#include "y.tab.h"
%}
%%
a 		{return A;}
b 		{return B;}
[\n]	return '\n';
%%

Yacc Program

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token A B
%%
input:	s'\n' {printf("Successful Grammar\n");exit(0);}
		s: A s1 B| B
		s1: ; | A s1
%%
main()
{
	printf("\nEnter A String\n");
	yyparse();
}
int yyerror()
{
	printf("\nError \n");
	exit(0);
}

Output


Program Output



× Note Page Number is specified to navigate between Pages...
SYS = Syllabus
P = Program


-ADMIN



× Note Do Share the website link with Your Friends and known Students...

-ADMIN

lIKE OUR CONTENT SUPPORT US BY FOLLOWING US ON INSTAGRAM : @futurevisionbie

Latest Updates are also posted in instagram as Stories...

For immediate Notification Join the Telegram Channel




Advertisement