DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

DATBASE AND COMPILER LAB

JOGINPALLY B. R ENGINEERING COLLEGE (Affiliated to JNTU, Hyd. & Approved by AICTE New Delhi)

Dept of Computer Science and Engineering

09J21D5818

DATBASE AND COMPILER LAB

JOGINPALLY B.R. ENGINEERING COLLEGE

2

Dept of Computer Science and Engineering

09J21D5818

OBSERVATION BOOK
Rollno: 09J21D5818 Name: CH.VENUGOPAL

JOGINPALLY B.R. ENGINEERING COLLEGE

3

Cancellation charges will be charged . Reservations can be made 60 days in advance either cash or credit. In case the ticket is not available.wait listed tickets that do not get confirmed are fully refunded JOGINPALLY B. await listed ticket is issued to the customer.R. developing and querying a database in the content of example database “Roadway Travels”. Students are expected to use “Mysql” database Roadway Travels Roadway Travels is in Business since 1997 with buses connecting different places in Indian.Dept of Computer Science and Engineering 09J21D5818 DATABASES AND COMPILERS LAB Objective: This lab enables and students to practice the concepts learnt in the subject DBMS by developing a database for an example company named “Roadway Travels” whose description is as follows. ENGINEERING COLLEGE 4 . This ticket is confirmed against the cancellation Cancellation and Modification: Cancellations are also directly handed at the booking office. Its main office located in Hyderabad The company wants to computerize its operations in the following areas: Reservations Ticketing Cancellations Reservations: Reservations are directly handled by booking office. The student is expected to practice the designing.

ENGINEERING COLLEGE 5 . The Following are the entities and its attributes Bus: Bus_No : varchar(10) (primary key) Source : varchar(20) Destination : varchar(20) Passenger: PNR_No : Number(9) (primary key) Ticket_No : Number(9) Name : varchar(15) Age : integer(4) Sex : char(10) .R. Identify what Data has to be persisted in the databases. Male/Female PPNO : varchar(15) Reservation: PNR_No : number(9) (foreign key) Journey_date : date No_of_seats : integer(8) Address : varchar(50) Contact_No : Number(9) Status : Char(2) Cancellation : PNR_No : number(9)(foreign key) Journey_date : date No_of_seats : integer(8) Address : varchar(50) Contact_No : Number(9) Status : Char(2) Ticket: Ticket_No : number(9)(primary key) Journey_date : date Age : int(4) Sex : Char(10) Source : varchar Destination :varchar Dep_time : varchar JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 Week1: E-R model Analyze the problem and come with the entities in it.

Apply cardinalities for each relation. JOGINPALLY B.R. Relate the entities appropriately. ENGINEERING COLLEGE 6 .Dept of Computer Science and Engineering 09J21D5818 Week2: Concept design with E-R model.

Represent all relationships in a tabular fashion. The fallowing are tabular representation of the above entities and relationships BUS: Bus_no Source Destination Passenger: Pnr_No Ticket_no Name Age Sex PPNO Reservation: Pnr_No Journey_date No_of_seats Address Contact_No Status Cancellation: Pnr_No Journey_date No_of_seats Address Contact_No Status Ticket: Ticket_No Journey_date Age sex source Destination Dep_time JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 Week3: Relational Model Represent all entities in a tabular fashion. ENGINEERING COLLEGE 7 .R.

Dept of Computer Science and Engineering

09J21D5818

Week5: Installation of MySQL and practicing DDL commands.
1. Steps for installing MySQL Step 1 Make sure you already downloaded the MySQL essential 5.0.45 win32.msi file. Double click on the .msi file. Step 2 This is MySQL Server 5.0 setup wizard. The setup wizard will install MySQL Server 5.0 release 5.0.45 on your computer. To continue, click next.

Step 3 Choose the setup type that best suits your needs. For common program features select Typical and it’s recommended for general use. To continue, click next.

JOGINPALLY B.R. ENGINEERING COLLEGE

8

Dept of Computer Science and Engineering

09J21D5818

Step 4 This wizard is ready to begin installation. Destination folder will be in C:\Program Files\MySQL\MySQL Server 5.0\. To continue, click next.

Step 5 The program features you selected are being installed. Please wait while the setup wizard installs MySQL 5.0. This may take several minutes.

JOGINPALLY B.R. ENGINEERING COLLEGE

9

Dept of Computer Science and Engineering

09J21D5818

Step 6 To continue, click next.

Step 7 To continue, click next.

JOGINPALLY B.R. ENGINEERING COLLEGE

10

Check the configure the MySQL server now to continue. Setup has finished installing MySQL 5.Dept of Computer Science and Engineering 09J21D5818 Step 8 Wizard Completed. Click Finish to exit the wizard d.R. JOGINPALLY B. ENGINEERING COLLEGE 11 .0.

To continue.R. click next. ENGINEERING COLLEGE 12 .0 server instance. click next. To continue. To continue. JOGINPALLY B. Step 10 Select a standard configuration and this will use a general purpose configuration for the server that can be tuned manually. click next.Dept of Computer Science and Engineering 09J21D5818 Step 9 The configuration wizard will allow you to configure the MySQL Server 5. Step 11 Check on the install as windows service and include bin directory in windows path.

click next.R. ENGINEERING COLLEGE 13 . To continue.Dept of Computer Science and Engineering 09J21D5818 Step 12 Please set the security options by entering the root password and confirm retype the password. JOGINPALLY B.

Step 14 Processing configuration in progress. JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 Step 13 Ready to execute? Clicks execute to continue. ENGINEERING COLLEGE 14 .R.

1 CREATE Table a) Passenger Table SQL> create table Passenger(PNR_NO Numeric(9) primary key . PPNO varchar(15)). Practicing DDL commands 2. Age Number(4). SQL> desc passenger Name Null? Type ----------------------------------------.R.Dept of Computer Science and Engineering 09J21D5818 Step 15 Configuration file created. Contact_No Numeric(9). Table created.-------. Windows service MySQL5 installed. No_of_seats Number(8). Sex char(10). Status char(3)).---------------------------PNR_NO NUMBER(9) NO_OF_SEATS NUMBER(8) ADDRESS VARCHAR2(50) JOGINPALLY B.----------------------------------PNR_NO NOT NULL NUMBER(9) TICKET_NO NUMBER(9) NAME VARCHAR2(20) AGE NUMBER(4) SEX CHAR(10) PPNO VARCHAR2(15) b) Reservation Table SQL> create table Reservation(PNR_NO Numeric(9). Address varchar(50). Press finish to close the wizard. SQL> desc Reservation Name Null? Type ----------------------------------------. ENGINEERING COLLEGE 15 . Name varchar(20). Ticket_NO Numeric(9). Table created. 2.

SQL> desc bus. age number(4). Table created. Table altered.-------.2 ALTER Table SQL> ALTER TABLE Reservation ADD FOREIGN KEY (PNR_NO) REFERENCES Passenger(PNR_NO).3 INSERT JOGINPALLY B. SQL> desc Ticket Name Null? Type ----------------------------------------. destination varchar(20)).R. dep_time varchar(4)).Dept of Computer Science and Engineering 09J21D5818 CONTACT_NO STATUS c) Bus Table NUMBER(9) CHAR(3) SQL> create table Bus(Bus_No varchar(5) primary key. Table altered. Contact_No Numeric(9). Table created.----------------------------------BUS_NO NOT NULL VARCHAR2(5) SOURCE VARCHAR2(20) DESTINATION VARCHAR2(20) d) Cancellation Table SQL> create table Cancellation(PNR_NO Numeric(9). 2.---------------------------PNR_NO NUMBER(9) NO_OF_SEATS NUMBER(8) ADDRESS VARCHAR2(50) CONTACT_NO NUMBER(9) STATUS CHAR(3) e) Ticket Table SQL> create table Ticket(Ticket_No Numeric(9) primary key. Table created. Status char(3)). No_of_seats Number(8). destination varchar(20). sex char(4) Not null.----------------------------------TICKET_NO NOT NULL NUMBER(9) AGE NUMBER(4) SEX NOT NULL CHAR(4) SOURCE VARCHAR2(2) DESTINATION VARCHAR2(20) DEP_TIME VARCHAR2(4) 2. SQL> ALTER TABLE Cancellation ADD FOREIGN KEY (PNR_NO) REFERENCES Passenger(PNR_NO). source varchar(2). Name Null? Type ----------------------------------------. source varchar(20). Table altered. Address varchar(50). SQL> alter table Ticket add constraint check_age check(age>18). SQL> desc Cancellation Name Null? Type ----------------------------------------. ENGINEERING COLLEGE 16 .

56.&TICKET_NO.'sd1234') 1 row created. &Age.1. '&PPNO') new 1: insert into Passenger values(2. ENGINEERING COLLEGE 17 .&TICKET_NO. '&PPNO') new 1: insert into Passenger values(3.R. '&Sex'. '&Name'. '&Sex'.&TICKET_NO.24.Dept of Computer Science and Engineering 09J21D5818 SQL> insert into Passenger values(&PNR_NO. &Age. SQL> / Enter value for pnr_no: 2 Enter value for ticket_no: 2 Enter value for name: rahul Enter value for age: 34 Enter value for sex: m Enter value for ppno: sd3456 old 1: insert into Passenger values(&PNR_NO.4.3. '&PPNO') new 1: insert into Passenger values(4.&TICKET_NO.'sdqw34') 1 row created. '&Name'. '&Sex'. '&Sex'.'sdqazx') 1 row created. '&PPNO') new 1: insert into Passenger values(1.'m'. '&Name'. '&PPNO'). SQL> / Enter value for pnr_no: 3 Enter value for ticket_no: 3 Enter value for name: swetha Enter value for age: 24 Enter value for sex: f Enter value for ppno: sdqw34 old 1: insert into Passenger values(&PNR_NO.'sd3456') 1 row created. &Age.'m'. SQL> / Enter value for pnr_no: 4 Enter value for ticket_no: 4 Enter value for name: ravi Enter value for age: 56 Enter value for sex: m Enter value for ppno: sdqazx old 1: insert into Passenger values(&PNR_NO.'ravi'.34.12.'swetha'. Enter value for pnr_no: 1 Enter value for ticket_no: 1 Enter value for name: SACHIN Enter value for age: 12 Enter value for sex: m Enter value for ppno: sd1234 old 1: insert into Passenger values(&PNR_NO. '&Name'. SQL> / Enter value for pnr_no: 4 Enter value for ticket_no: 5 Enter value for name: asif JOGINPALLY B.'rahul'. '&Name'. &Age.&TICKET_NO. &Age. '&Sex'.'SACHIN'.'m'.2.'f'.

'&PPNO') new 1: insert into Passenger values(4.'iuyhjk') * ERROR at line 1: ORA-00001: unique constraint (SYSTEM.'&source'. Enter value for bus_no: 1 Enter value for source: hyd Enter value for destination: ban old 1: insert into Bus values('&Bus_No'. SQL> / Enter value for bus_no: 5 Enter value for source: hyd Enter value for destination: kol old 1: insert into Bus values('&Bus_No'.'ban') 1 row created. ENGINEERING COLLEGE 18 .33.'asif'.'chn') 1 row created.'mum') 1 row created. PNR_NO ---------1 2 3 4 TICKET_NO ---------1 2 3 4 NAME -------------------SACHIN rahul swetha ravi AGE SEX PPNO ---------.'asif'.'&destination') new 1: insert into Bus values('4'.'&destination') new 1: insert into Bus values('1'. '&Name'.'&source'.'&source'.SYS_C004023) violated SQL> select * from Passenger.5. '&Sex'.'&destination') new 1: insert into Bus values('2'.'&source'. &Age.'&destination') new 1: insert into Bus values('5'.Dept of Computer Science and Engineering 09J21D5818 Enter value for age: 33 Enter value for sex: m Enter value for ppno: iuyhjk old 1: insert into Passenger values(&PNR_NO.'m'.'&destination'). SQL> / Enter value for bus_no: 5 JOGINPALLY B.'kol') 1 row created.R.5. SQL> / Enter value for bus_no: 2 Enter value for source: hyd Enter value for destination: chn old 1: insert into Bus values('&Bus_No'.'m'.'hyd'. SQL> / Enter value for bus_no: 4 Enter value for source: hyd Enter value for destination: mum old 1: insert into Bus values('&Bus_No'.'iuyhjk') insert into Passenger values(4.'hyd'.33.--------------12 m sd1234 34 m sd3456 24 f sdqw34 56 m sdqazx SQL> insert into Bus values('&Bus_No'.'&source'.'hyd'.&TICKET_NO.---------.'hyd'.

9090887753.'cbt'.Dept of Computer Science and Engineering 09J21D5818 Enter value for source: sec Enter value for destination: ban old 1: insert into Bus values('&Bus_No'.' &Status') new 1: insert into Reservation values(1.SYS_C004024) violated .'&Address'.'s') insert into Reservation values(8.2.3. &No_of_seats. Enter value for pnr_no: 1 Enter value for no_of_seats: 2 Enter value for address: masabtank Enter value for contact_no: 9009897812 Enter value for status: s old 1: insert into Reservation values(&PNR_NO.&Contact_No. Enter value for pnr_no: 8 Enter value for no_of_seats: 3 Enter value for address: cbt Enter value for contact_no: 9090887753 Enter value for status: s old 1: insert into Reservation values(&PNR_NO.'cbt'. &Contact_No.'sec'. &Contact_No.R. &No_of_seats.&No_of_seats.'s') * ERROR at line 1: ORA-02291: integrity constraint (SYSTEM. '&Status') new 1: insert into Reservation values(8. '&Address'. ENGINEERING COLLEGE 19 . '&Address'. '&Status').'ban') * ERROR at line 1: ORA-00001: unique constraint (SYSTEM. &No_of_seats.9009897812.'masabtank'. &Contact_No .parent key not found JOGINPALLY B. '&Address'.'&source'.'ban') insert into Bus values('5'.9090887753.SYS_C004025) violated SQL> insert into Reservation values(&PNR_NO. SQL> insert into Reservation values(&PNR_NO.3.'s') 1 row created.'&Status').'sec'.'&destination') new 1: insert into Bus values('5'.

SQL> select * from Passenger.5 DROP Table SQL> drop table Cancellation. JOGINPALLY B.---------------------------1 1 SACHIN 2 2 rahul 3 3 swetha AGE SEX PPNO ---------.4 UPDATE Table SQL> update Passenger set age='43' where PNR_NO='2'.R.5 DELETE SQL> delete from Passenger where PNR_NO='4'.---------1 1 SACHIN 12 2 2 rahul 43 3 3 swetha 24 4 4 ravi 56 SEX PPNO ---------.---------.Dept of Computer Science and Engineering 09J21D5818 2. ENGINEERING COLLEGE 20 . PNR_NO TICKET_NO NAME ---------.--------------12 m sd1234 43 m sd3456 24 f sdqw34 2. 1 row deleted. 1 row updated.--------------m sd1234 m sd3456 f sdqw34 m sdqazx 2. PNR_NO TICKET_NO NAME AGE -------------------------------------. Table dropped. SQL> select * from Passenger.

R. SOURCE DESTINATION ----------------------------HYD BAN SEC BAN HYD MUM 5. PNR_NO ---------1 2 3 4 5 6 7 7 rows selected. NAME -------------------SACHIN rahul rafi salim riyaz 3. TICKET_NO NAME ----------------------------1 SACHIN 2 rahul 3 swetha 23 rafi 12 salim 34 riyaz 21 neha 7 rows selected.Dept of Computer Science and Engineering 09J21D5818 Week7: Practice the fallowing Queries 1. ENGINEERING COLLEGE 21 . Display Unique PNR_NO of all Passengers SQL> select PNR_NO from Passenger. destination from Ticket where Journey_Dur>10. 2. Display Ticket numbers and names of all Passengers SQL> select Ticket_NO. Find the ticket number of passenger whose name starts with ‘S’ and ends with ‘H’ SQL> select Ticket_NO from Passenger where Name like'S%'and name like'%N'.Name from Passenger. 4. Display all the names of male Passengers SQL> select Name from Passenger where Sex='m'. Display the source and destination having journey time more than 10 hours. SQL> select source. TICKET_NO ---------1 JOGINPALLY B.

Display all the name of the passengers beginning with ‘r’ SQL> select Name from Passenger where Name like 'r%'.R. JOGINPALLY B. Display the sorted list of Passenger Names SQL> select Name from Passenger ORDER BY Name. ENGINEERING COLLEGE 22 .Dept of Computer Science and Engineering 09J21D5818 6. NAME -------------------swetha rafi riyaz neha 7. Find the names of the passenger whose age is between 20 and 40 SQL> select Name from Passenger where age between 20 and 40. NAME -------------------SACHIN neha rafi rahul riyaz salim swetha 7 rows selected. NAME -------------------rahul rafi riyaz 8.

R.---------6 31 swebnht 453212345 s 7 2 dbdhfdbhf 90876543 s 7 3 jklhg 2345671 s 14 rows selected.---------------1 2 sdfgh 1234543 s 1 3 msbtnk 123456789 s 2 2 ldkp 234567891 s 2 2 wertgfds 12212121 n 3 4 dskng 345678912 n 3 5 azxsdcvf 13243546 s 4 2 ddfdsfsdfdsf 3456789 s 4 5 abids 567891234 s 5 2 allbd 891234567 s 5 11 liopujth 43256787 s 6 1 koti 231456781 s PNR_NO NO_OF_SEATS ADDRESS CONTACT_NO STATUS -------------------------------------. Write a query to Display the information present in the Cancellation and Reservation Tables SQL> select * from Reservation UNION select * from Cancellation. Find the distinct PNR_NO that are present SQL> SELECT PNR_NO.Dept of Computer Science and Engineering 09J21D5818 Week8 and week9: Practice queries using Aggregate functions. JOGINPALLY B. COUNT(*) AS NoOccurances FROM Passenger GROUP BY PNR_NO HAVING COUNT(*)>0. Group by. PNR_NO NO_OF_SEATS ADDRESS CONTACT_NO STATUS ---------. 2. PNR_NO NOOCCURANCES --------------------1 1 2 1 3 1 4 1 5 1 6 1 7 1 7 rows selected. having and Creation and Dropping of views 1.-------------------------------------. ENGINEERING COLLEGE 23 .

SQL> select * from male_pass. ENGINEERING COLLEGE 24 . View created.R. SQL> select class. 4. PNR_NO AGE ------------------1 12 2 43 4 22 5 45 6 32 JOGINPALLY B. Creating and dropping views a) CREATE VIEW SQL> create view male_pass as select PNR_NO.age from Passenger where sex='m'.sum(No_of_seats) from Reservation where class='a 'or class='b' or class= 'c' group by class having sum(No_of_seats)>1. PNR_NO SUM(NO_OF_SEATS) ------------------------1 3 6 1 2 2 4 5 5 2 3 6 7 3 7 rows selected. SUM(NO_OF_SEATS) ---------------22 6.Dept of Computer Science and Engineering 09J21D5818 3. Find the total number of cancelled seats.sum(No_of_seats) from Reservation group by PNR_NO. BY Clause. Find the number of seats booked in each class where the number of seats is greater than 1. Find the No of Seats booked for each PNR_NO using GROUP SQL> select PNR_NO. CLASS SUM(NO_OF_SEATS) -----------------a 13 b 7 c 2 5. SQL> select sum(No_of_seats) from Cancellation.

R.22) 1 row created.&age). Enter value for pnr_no: 12 Enter value for age: 22 old 1: insert into male_pass values(&PNR_NO. SQL> create view v1 as select * from Passenger full natural join Reservation.&age) new 1: insert into male_pass values(12. JOGINPALLY B. ENGINEERING COLLEGE 25 . View created. c) DROP VIEW SQL> drop view male_pass.Dept of Computer Science and Engineering 09J21D5818 Create a view from two tables with all columns. View dropped. b) INSERT SQL> insert into male_pass values(&PNR_NO.

ENGINEERING COLLEGE 26 . end if. end if. RESULT: SQL> @trigger Trigger created. delete trigger and update trigger. '&source'.'&destination').'&source'.R.'hyd') insert into Bus values(null. if(a=1) then raise_application_error(-20002. Bus_No.'error:: Bus_No cannot be null'). BEGIN if(:new.Dept of Computer Science and Engineering 09J21D5818 Week10: Create of insert trigger. BUS_NO ----110 221 412 501 SOURCE hyd hyd hyd hyd DESTINATION ban chn mum kol -------------------.’Chen'.Bus_No is Null) then raise_application_error(-20001. '&destination') new 1: insert into Bus values(null. a) CREATE OR RELPLACE TRIGGER trig1 before insert on Bus for each row DECLARE a number. Enter value for Bus_No: null Enter value for source: Chen Enter value for destination: hyd old 1: insert into Bus values(&Bus_No. To write a TRIGGER to ensure that Bus table does not contain duplicate of null values in Bus_No column. SQL> select * from Bus. 1.'error:: cannot have duplicate Bus_No ').-------------------- SQL> insert into Bus values(&Bus_No.'hyd') * JOGINPALLY B. else select count(*) into a from Bus where Bus_No =:new. END.Chen'.

line 5 ORA-04088: error during execution of trigger 'SYSTEM. SQL> @trigger Trigger created. End If End.Ticket_No=Ticket_No. JOGINPALLY B.'hyd') insert into Bus values(110.Ticket_No=0.TRIG1' SQL> / Enter value for Bus_No: 110 Enter value for source:KOL Enter value for destination: hyd old 1: insert into Bus values(&Bus_No. '&destination') new 1: insert into Bus values(110.Dept of Computer Science and Engineering 09J21D5818 ERROR at line 1: ORA-20001: error::Bus_No cannot be null 35 ORA-06512: at "SYSTEM.TRIG1' b) Create Trigger updchek before update on Ticket For Each Row Begin If New.’KOL'.R.KOL'.Ticket_No>60 Then Set New. ENGINEERING COLLEGE 27 . Else Set New.'hyd') * ERROR at line 1: ORA-20002: error:: cannot have duplicate Bus_No ORA-06512: at "SYSTEM.TRIG1". '&source'.TRIG1". line 9 ORA-04088: error during execution of trigger 'SYSTEM.

end if. else select count(*) into a from Passenger where PNR_NO =:new.'error:: PNR_NO cannot be null'). if(a=1) then raise_application_error(-20002. end if. END. JOGINPALLY B. PNR_NO. SQL> @trigger Trigger created.Dept of Computer Science and Engineering 09J21D5818 c) CREATE OR RELPLACE TRIGGER trig1 before insert on Passenger for each row DECLARE a number. ENGINEERING COLLEGE 28 .'error:: cannot have duplicate PNR_NO ').PNR_NO is Null) then raise_application_error(-20001.R. BEGIN if(:new.

R.put_line(em). end loop. DECLARE cursor c(jb varchar2) is select Name from Passenger where Sex=m.put_line(' Name of Male Passenger are:').put_line(pr). loop fetch c into em. END. pr Passenger. dbms_RESULT. BEGIN open c('m').Sex%type. RESULT: Name of Male Passenger are: SACHIN rahul rafi salim riyaz Name of female Passengers are: swetha JOGINPALLY B. loop fetch c into pr. open c('f'). ENGINEERING COLLEGE 29 . end loop. close c. dbms_RESULT. Analyst.Dept of Computer Science and Engineering 09J21D5818 Week 12: Cursors To write a Cursor to display the list of Male and Female Passengers. exit when c%notfound. dbms_RESULT. dbms_RESULT. close c.put_line(' Name of female Passengers are:'). exit when c%notfound.

Sex of Passengers are:= '). end loop. BEGIN open c. Name. dbms_RESULT. loop fetch c into i.Dept of Computer Science and Engineering 09J21D5818 neha PL/SQL procedure successfully completed. ENGINEERING COLLEGE 30 .Age%type. END.Sex%type. Name. Sex from Passenger . close c.R. l Passenger.PNR_NO%type. exit when c%notfound. j Passenger. Age. i Passenger. JOGINPALLY B. k. DECLARE cursor c is select PNR_NO.Name%type.put_line('PNR_NO. k Passenger.---------. j. Age.---------- PL/SQL procedure successfully completed.put_line(i||' '||j||' '||k||' '||l). l. dbms_RESULT. b) To write a Cursor to display List of Passengers from Passenger Table. RESULT: SQL>@Passenger PNR_NO ---------1 2 3 4 NAME SACHIN rahul swetha rafi AGE SEX 12 43 24 22 m m f m -------------------.

R.Dept of Computer Science and Engineering 09J21D5818 PART II COMPILER DESIGN JOGINPALLY B. ENGINEERING COLLEGE 31 .

while((c=getc(f1))!=EOF) { if(isdigit(c)) { tokenvalue=c-'0'.h> #include<stdio.k=0. JOGINPALLY B.R. printf("\nEnter the c program").tokenvalue=0. #include<string.str)==0|| strcmp("float".str)==0|| strcmp("static"."w").f1).h> #include<ctype.*f2. else printf("\n%s is an identifier". f3=fopen("specialchar".str)==0||strcmp("while".lineno=0.i=0."w"). int num[100].j=0.str)==0||strcmp("double".str)==0) printf("\n%s is a keyword". f1=fopen("input"."w")."r"). fclose(f1).st1[10].*f3./*gets(st1).str)==0||strcmp("char".str)==0||strcmp("int".str)==0||strcmp("do".str[10].Dept of Computer Science and Engineering 09J21D5818 Program 1 Aim: Write A Program to Design Lexical Analyzer.h> void keyword(char str[10]) { if(strcmp("for". while((c=getchar())!=EOF) putc(c.str)==0||strcmp("case".str).str)==0||strcmp("switch". ENGINEERING COLLEGE 32 .str). } main() { FILE *f1.*/ f1=fopen("input". f2=fopen("identifier". char c.

printf("\nThe no's in the program are"). ungetc(c.j++) JOGINPALLY B.f1). else putc(c. fclose(f3). for(j=0. } num[i++]=tokenvalue.f2). fclose(f1). c=getc(f1). } fclose(f2).j<i. ENGINEERING COLLEGE 33 . c=getc(f1). } else if(isalpha(c)) { putc(c.f1).R.f2). while(isdigit(c)||isalpha(c)||c=='_'||c=='$') { putc(c.Dept of Computer Science and Engineering 09J21D5818 c=getc(f1). } putc(' '. c=getc(f1). } else if(c==' '||c=='\t') printf(" "). while(isdigit(c)) { tokenvalue*=10+c-'0'. ungetc(c.f2). else if(c=='\n') lineno++.f3).

keyword(str).R. f2=fopen("identifier". k=0. } } fclose(f2)."r"). printf("Total no. printf("The keywords and identifiersare:"). k=0. printf("\n").lineno). } Output: Enter the C program a+b*c Ctrl-D The no’s in the program are: JOGINPALLY B. ENGINEERING COLLEGE 34 . else { str[k]='\0'. while((c=getc(f3))!=EOF) printf("%c". fclose(f3). while((c=getc(f2))!=EOF) { if(c!=' ') str[k++]=c. printf("\n")."r").Dept of Computer Science and Engineering 09J21D5818 printf("%d".c). of lines are:%d".num[j]). f3=fopen("specialchar". printf("\nSpecial characters are").

ENGINEERING COLLEGE 35 . of lines are: 1 JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 The keywords and identifiers are: a is an identifier and terminal b is an identifier and terminal c is an identifier and terminal Special characters are: +* Total no.R.

}*/ JOGINPALLY B.l */ %{ /* program to recognize a c program */ int COMMENT=0. /* program name is lexp.} /*{printf("\n\n\t%s is a COMMENT\n". %} identifier [a-zA-Z][a-zA-Z0-9]* %% #.* { printf("\n%s is a PREPROCESSOR DIRECTIVE".R.} int | float | char | double | while | for | do | if | break | continue | void | switch | case | long | struct | const | typedef | return | else | goto {printf("\n\t%s is a KEYWORD".yytext).yytext).} "/*" {COMMENT = 1.yytext).Dept of Computer Science and Engineering 09J21D5818 Program 2 Aim: Implement the Lexical Analyzer Using Lex Tool. ENGINEERING COLLEGE 36 .

)? {if(!COMMENT) printf("\n\t").} \".yytext).*\" {if(!COMMENT) printf("\n\t%s is a STRING".} [0-9]+ {if(!COMMENT) printf("\n\t%s is a NUMBER".argv[1]).} \( = \<= | \>= | \< | == | \> %% int main(int argc. if(!file) { printf("could not open %s \n".} {identifier}(\[[0-9]*\])? {if(!COMMENT) printf("\n %s IDENTIFIER".Dept of Computer Science and Engineering 09J21D5818 "*/" {COMMENT = 0.yytext).yytext).} \} {if(!COMMENT) printf("\n BLOCK ENDS"). ENGINEERING COLLEGE ECHO."r").printf("\n").yytext).} /* printf("\n\n\t%s is a COMMENT\n". } yyin = file. JOGINPALLY B.char **argv) { if (argc > 1) { FILE *file.} {if(!COMMENT) printf("\n\t%s is a RELATIONAL OPERATOR".yytext). } yylex().} \{ {if(!COMMENT) printf("\n BLOCK BEGINS").ECHO.} 37 .R.}*/ {identifier}\( {if(!COMMENT)printf("\n\nFUNCTION\n\t%s".yytext).} \)(\. {if(!COMMENT)printf("\n\t%s is an ASSIGNMENT OPERATOR". exit(0). file = fopen(argv[1].yytext).

ENGINEERING COLLEGE 38 .c #include<stdio.h> main() { int a.R. } Input: $vi var. return 0.b. } int yywrap() { return 0. } Output: JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 printf("\n\n").

h> is a PREPROCESSOR DIRECTIVE FUNCTION main ( ) BLOCK BEGINS int is a KEYWORD a IDENTIFIER b IDENTIFIER BLOCK ENDS JOGINPALLY B.l $cc lex. ENGINEERING COLLEGE 39 .R.c $./a.yy.c #include<stdio.out var.Dept of Computer Science and Engineering 09J21D5818 $lex lex.

h> #include<stdlib."for".KEYWORD. }symtable[100]. void Error_Message(char *m) JOGINPALLY B.R.KEYWORD."int". int lastentry=0.KEYWORD. char buffer[SIZE]."struct".h> #include<string. int lineno=1.Dept of Computer Science and Engineering 09J21D5818 Program 3 Aim:Implementation of Predictive Parser.KEYWORD. int lookahead.h> #include<ctype. int lastchar=-1.KEYWORD. struct entry keywords[]={"if". #include<stdio."else"."return".KEYWORD.h> #define SIZE 128 #define NONE -1 #define EOS '\0' #define NUM 257 #define KEYWORD 258 #define ID 259 #define DONE 260 #define MAX 999 char lexemes[MAX]. int tokenval=DONE.0}.0.KE YWORD. struct entry { char *lexptr."flo at".KEYWORD."double".KEYWORD."char". int token. ENGINEERING COLLEGE 40 .

lastchar=lastchar+len+1. ENGINEERING COLLEGE 41 .ptr+1) insert(ptr->lexptr."line %d.s)==0) return k.lexptr=&lexemes[lastchar+1].lexptr. } /*void Initialize() { struct entry *ptr. for(ptr=keywords. for(k=lastentry. if(lastentry+1>=MAX) Error_Message("Symbpl table is full"). return lastentry.s). return 0.lineno.k>0. exit(1).ptr->token.Dept of Computer Science and Engineering 09J21D5818 { fprintf(stderr. if(lastchar+len+1>=MAX) Error_Message("Lexemes array is full").int tok) { int len. }*/ int lexer() JOGINPALLY B. symtable[lastentry]. len=strlen(s). strcpy(symtable[lastentry].m).lexptr.k--) if(strcmp(symtable[k]. lastentry=lastentry+1. %s \n". } int insert(char s[ ]. } int look_up(char s[ ]) { int k. symtable[lastentry].R.ptr->token).token=tok.

Dept of Computer Science and Engineering 09J21D5818 { int t. else if(isdigit(t)) { ungetc(t. else if(t=='\n') lineno=lineno+1. } buffer[i]=EOS.R. if(t==' '||t=='\t'). t=getchar(). tokenval=val.stdin). } JOGINPALLY B. if(t!=EOF) ungetc(t. return NUM.token. } else if(isalpha(t)) { while(isalnum(t)) { buffer[i]=t.stdin). return symtable[val]. ENGINEERING COLLEGE 42 . if(i>=SIZE) Error_Message("Compiler error"). int val. scanf("%d". while(1) { t=getchar(). val=look_up(buffer).i=0.&tokenval). if(val==0) val=insert(buffer.ID). i=i+1.

ENGINEERING COLLEGE 43 . } void F() { //void E(). else if(t==NUM) printf("\n Number: %d". else Error_Message("Syntax error").R.tokenval).t). } } } void Match(int t) { if(lookahead==t) lookahead=lexer().tval). else if(t==ID) printf("\n Identifier: %s". else printf("\n Token %d tokenval %d".symtable[tval]. switch(lookahead) { case '(' : Match('(').lexptr). return t. else { tokenval=NONE. JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 else if(t==EOF) return DONE.int tval) { if(t=='+'||t=='-'||t=='*'||t=='/') printf("\nArithmetic Operator: %c". } void display(int t.t. E().

} } void T() { int t. Match(NUM). break. } } } void E() { JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 Match(')').R. continue.tokenval). case '/' : t=lookahead. while(1) { switch(lookahead) { case '*' : t=lookahead. case ID : display(ID. case NUM : display(NUM. Match(ID).NONE). display(t. F(). default : return.NONE). break. Match(lookahead). default : Error_Message("Syntax error").tokenval). break. F(). ENGINEERING COLLEGE 44 . display(t. Match(lookahead). continue.

Match('. display(t. case '-' : t=lookahead. T(). } } } void parser() { lookahead=lexer().'). Match(lookahead). JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 int t.R. ENGINEERING COLLEGE 45 . while(lookahead!=DONE) { E().NONE). default : return. continue. printf("\n Program for recursive decent parsing "). display(t. Match(lookahead). while(1) { switch(lookahead) { case '+' : t=lookahead.NONE). continue. T(). } } main() { char ans[10]. T(). printf("\n Enter the expression ").

at the end\n"). Number: 2 Number: 3 Arithmetic Operator: * +3. line 5.Dept of Computer Science and Engineering 09J21D5818 printf("And place . printf("Press Ctrl-Z to terminate\n"). Identifier: a Identifier: b Identifier: c Arithmetic Operator: * Arithmetic Operator: + 2*3. at the end Press Ctrl-Z to terminate a+b*c. } Output: Program for recursive decent parsing Enter the expression And place . ENGINEERING COLLEGE 46 .Syntax error Ctrl-Z JOGINPALLY B.R. parser().

tab.*/ #include<stdio. %% return yytext[0].y> %{ /*This YACC specification file generates the LALR parser for the program considered in experiment 4.dval=atof(yytext). <parser.$1). }. ENGINEERING COLLEGE .Dept of Computer Science and Engineering 09J21D5818 Program 4 Aim: Design LALR Bottom up Parser. <parser.h" %} %% [0-9]+ {yylval.R.l> %{ #include<stdio.h> %} %union { double dval. expr: expr '+' term {$$=$1 + $3 . } %token <dval> DIGIT %type <dval> expr %type <dval> term %type <dval> factor %% line: expr '\n' { printf("%g\n". } \n|.h> #include "y. return DIGIT.} 47 JOGINPALLY B.

c y. ENGINEERING COLLEGE 48 . %% int main() { yyparse().c –ll –lm $./a. factor: '(' expr ')' | DIGIT . term: term '*' factor | factor .l $yacc –d parser.tab.0000 JOGINPALLY B.Dept of Computer Science and Engineering 09J21D5818 | term .R.out 2+3 5. } yyerror(char *s) { printf("%s".s).y $cc lex.} Output: $lex parser.} {$$=$1 * $3 . } {$$=$2 .yy.

tab. return WHILE.R. if else while int | char | float return TYPE.yytext). return ELSE. return IF. return NUM. {identifier} {strcpy(yylval. <int.yytext).var.var.Dept of Computer Science and Engineering 09J21D5818 Program 5 Aim: Convert The BNF rules into Yacc form and write code to generate abstract syntax tree.h> int LineNo=1. %} identifier [a-zA-Z][_a-zA-Z0-9]* number [0-9]+|([0-9]*\.} \< | \> | \>= | JOGINPALLY B.} {number} {strcpy(yylval. ENGINEERING COLLEGE 49 . return VAR.[0-9]+) %% main\(\) return MAIN.h" #include<stdio.h> #include<string.l> %{ #include"y.

}stk.yytext). %% <int. \n LineNo++. int Index=0.R. . }QUAD[30].y> %{ #include<string. return RELOP.Dept of Computer Science and Engineering 09J21D5818 \<= | == {strcpy(yylval. return yytext[0]. char result[10].Ind. struct stack { int items[100]. %} %union JOGINPALLY B.h> #include<stdio.h> struct quad { char op[5].tInd. ENGINEERING COLLEGE 50 . char arg1[10].} [ \t] .var. int top.StNo. char arg2[10].tIndex=0. extern int LineNo.

STATEMENT: DESCT '.R. VARLIST: VAR '.' VARLIST | VAR . ENGINEERING COLLEGE 51 . JOGINPALLY B. DESCT: TYPE VARLIST . } %token <var> NUM VAR RELOP %token MAIN IF ELSE WHILE TYPE %type <var> EXPR ASSIGNMENT CONDITION IFST ELSEST WHILELOOP %left '-' '+' %left '*' '/' %% PROGRAM : MAIN BLOCK . CODE: BLOCK | STATEMENT CODE | STATEMENT .' | ASSIGNMENT '. BLOCK: '{' CODE '}' .Dept of Computer Science and Engineering 09J21D5818 { char var[10].' | CONDST | WHILEST .

} | '(' EXPR ')' {strcpy($$.$3.$1."%d". } .op."=="). strcpy(QUAD[Index]."-1").} | EXPR '/' EXPR {AddQuadruple("/". sprintf(QUAD[Ind]. JOGINPALLY B.""."%d". CONDST: IFST{ Ind=pop().Index).$$).} | EXPR '*' EXPR {AddQuadruple("*".$3. Ind=pop().} | EXPR '-' EXPR {AddQuadruple("-".$2).arg2. sprintf(QUAD[Ind].$1. IFST: IF '(' CONDITION ')' { strcpy(QUAD[Index].result)."=").result. strcpy(QUAD[Index]. EXPR: EXPR '+' EXPR {AddQuadruple("+".} | VAR | NUM .$3. strcpy(QUAD[Index].$1. strcpy(QUAD[Index].result.Dept of Computer Science and Engineering 09J21D5818 ASSIGNMENT: VAR '=' EXPR{ strcpy(QUAD[Index].op.$3). ENGINEERING COLLEGE 52 . strcpy(QUAD[Index]. } | IFST ELSEST .$$).arg2. strcpy(QUAD[Index].Index)."FALSE").result."").$$).$1).arg1.arg1.$3).R.$$).$2.QUAD[Index++]. strcpy($$.$3.result.$$).} | '-' EXPR {AddQuadruple("UMIN".$1.

push(tInd).Index). Index++. Ind=pop(). strcpy(QUAD[Index].""). push(Index). } | VAR | NUM .$3. WHILEST: WHILELOOP{ Ind=pop().$1. JOGINPALLY B. } BLOCK{ Ind=pop().result.arg1."%d"."GOTO").Dept of Computer Science and Engineering 09J21D5818 push(Index).result. ENGINEERING COLLEGE 53 .Index).R.op.arg2. sprintf(QUAD[Ind]."")."-1"). CONDITION: VAR RELOP VAR {AddQuadruple($2. Index++. StNo=Index-1.result."%d". } BLOCK { strcpy(QUAD[Index]. strcpy(QUAD[Index]. } . ELSEST: ELSE{ tInd=pop(). strcpy(QUAD[Index]. sprintf(QUAD[Ind].$$). } .

strcpy(QUAD[Index].char *argv[]) { FILE *fp. WHILELOOP: WHILE '(' CONDITION ')' { strcpy(QUAD[Index]. sprintf(QUAD[Ind]. } BLOCK { strcpy(QUAD[Index]. if(!fp) { printf("\n File not found"). } ."%d".result.Dept of Computer Science and Engineering 09J21D5818 sprintf(QUAD[Ind]. strcpy(QUAD[Index].arg1.result."").arg2. if(argc>1) { fp=fopen(argv[1].arg1. push(Index). int i.StNo).arg2. strcpy(QUAD[Index]. %% extern FILE *yyin.$3)."-1")."r"). int main(int argc.result."%d". JOGINPALLY B."-1"). strcpy(QUAD[Index].op. Index++."=="). Index++. strcpy(QUAD[Index]. ENGINEERING COLLEGE 54 .result.Index). push(Index)."FALSE").R.""). strcpy(QUAD[Index]."GOTO"). Ind=pop(). } .op.

result).top==100) { printf("\n Stack overflow\n"). for(i=0. } void push(int data) { stk.top]=data. } yyparse(). } JOGINPALLY B. printf("\n\n").items[stk.Dept of Computer Science and Engineering 09J21D5818 exit(0). } stk.QUAD[i].arg2.i++) { printf("\n\t\t %d\t %s\t %s\t %s\t %s". if(stk. return 0.top++.arg1.top==-1) { printf("\n Stack underflow\n").i<Index.R. if(stk. } yyin=fp. ENGINEERING COLLEGE 55 . exit(0).i. exit(0). printf("\n\n\t\t ----------------------------""\n\t\t Pos Operator Arg1 Arg2 Result" "\n\t\t --------------------").QUAD[i].QUAD[i]. } printf("\n\t\t -----------------------").QUAD[i].op. } int pop() { int data.

return data.c.result). strcpy(QUAD[Index]. ENGINEERING COLLEGE 56 . strcpy(QUAD[Index].items[stk.arg2). } void AddQuadruple(char op[5]. } yyerror() { printf("\n Error on line no:%d".op). sprintf(QUAD[Index]. strcpy(result."t%d". } while(a<b) { a=a+b.tIndex++). } if(a<=b) { c=a-b.op.b.arg2.char result[10]) { strcpy(QUAD[Index].result.arg1. } else JOGINPALLY B.c main() { int a.LineNo).arg1).char arg1[10].QUAD[Index++]. } Input: $vi test.top--]. if(a<b) { a=a+b.char arg2[10].R.Dept of Computer Science and Engineering 09J21D5818 data=stk.

} } Output: $lex int.c –ll –lm $.tab. ENGINEERING COLLEGE 57 .Dept of Computer Science and Engineering 09J21D5818 { c=a+b.y $gcc lex.out test.R./a.c Pos 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Operator < == + = GOTO < == + = GOTO <= == = GOTO + = Arg1 a to a t1 Arg2 b FALSE b 5 Result to t1 a 5 a t2 a t3 FALSE b 10 b t2 t3 a 5 a t4 a t5 b FALSE b t4 15 t5 c 17 a t6 b t3 c JOGINPALLY B.l $yacc –d int.c y.yy.

int main() { FILE *fp1. printf("\n Enter filename of the intermediate code").R. if(strcmp(op.Dept of Computer Science and Engineering 09J21D5818 ___________________________________________________ Program 6 Aim: A Program to Generate Machine Code."print")==0) JOGINPALLY B. #include<stdio. fp1=fopen(fname. ENGINEERING COLLEGE 58 .result[8].op). if(fp1==NULL || fp2==NULL) { printf("\n Error opening the file").op[10]. int no=0. fscanf(fp1. if(check_label(i)) fprintf(fp2.j=0.*fp2. fp2=fopen("target."r"). char operand1[8]."\nlabel#%d"."%s". int i=0."\n").&fname). scanf("%s".operand2[8]. i++."w").i).h> int label[20].ch.h> #include<string. char fname[10].h> #include<stdlib. } while(!feof(fp1)) { fprintf(fp2.txt". exit(0).

fprintf(fp2.result).operand2). JOGINPALLY B. fprintf(fp2."%s %s %s".result). fprintf(fp2."\n \t LOAD".R0"). case '+': fscanf(fp1.result)."\n\t STORE %s[%s]."%s %s". label[no++]=atoi(operand2).operand1.result).R1".operand1."\n \t STORE R0.result)."\n \t LOAD %s. fprintf(fp2.label#%s"."uminus")==0) { fscanf(fp1."\n \t MUL R1."\n\t LOAD -%s.operand2. } if(strcmp(op.operand1. } if(strcmp(op."goto")==0) { fscanf(fp1. fprintf(fp2.R1"."\n\t JMP %s.%s".operand2).operand2. } if(strcmp(op.result). fprintf(fp2. fprintf(fp2."%s".Dept of Computer Science and Engineering 09J21D5818 { fscanf(fp1."\n \t ADD R1."\n \t LOAD %s.result).operand1.R1".R.operand2."\n \t LOAD %s. fprintf(fp2.operand2).operand1.R0").operand1)."[]=")==0) { fscanf(fp1."\n\t STORE R1.%s"."%s %s"."%s %s %s". } switch(op[0]) { case '*': fscanf(fp1.operand1."\n \t STORE R0."%s %s %s".operand1. fprintf(fp2. fprintf(fp2.R0"."\n\t OUT %s".operand2.operand1). break.result).result). fprintf(fp2.%s". fprintf(fp2. fprintf(fp2.operand2).operand1). ENGINEERING COLLEGE 59 .result).%s".

"\n \t STORE R0.result).R0".R1". fprintf(fp2."\n\t JLT %s. fprintf(fp2.result). case '%': fscanf(fp1.R."\n\t JGT %s. break."\n \t LOAD %s.result). fprintf(fp2. fprintf(fp2. fprintf(fp2.R0")."\n \t DIV R1."%s %s". fprintf(fp2.R0".R1".Dept of Computer Science and Engineering 09J21D5818 break."\n \t SUB R1."%s %s %s". case '>': j++. fprintf(fp2."\n \t LOAD %s. ENGINEERING COLLEGE 60 ."\n \t LOAD %s. case '=': fscanf(fp1.operand1."\n \t DIV R1.result). break. break."%s %s %s". fprintf(fp2. fscanf(fp1. case '/': fscanf(fp1.operand2). break.operand1. break.operand1.operand2. fprintf(fp2.label#%s".operand2."\n \t LOAD %s. break.operand2."%s %s %s".operand1.operand1).operand1).operand2).operand2.operand2). } JOGINPALLY B."\n \t STORE R0.operand2.R1"."\n \t LOAD %s.operand1.operand1).operand2. fprintf(fp2.%s".R0". fprintf(fp2.result). fprintf(fp2.operand1).result).result).operand1).R0").result). case '<': fscanf(fp1.result).operand2.R0".operand1."\n \t LOAD %s.%s"."\n \t LOAD %s. fprintf(fp2. label[no++]=atoi(result).result)."\n\t STORE %s %s". fprintf(fp2.result).R0". fprintf(fp2."\n \t LOAD %s."%s %s %s"."\n \t STORE R0. fprintf(fp2.label#%d".result)."%s %s %s". fprintf(fp2.operand1.R0"). case '-': fscanf(fp1. label[no++]=atoi(result).%s".

return 0. } return 0. } Input: $vi int. } int check_label(int k) { int i.txt". }while(ch!=EOF). } do { ch=fgetc(fp2). exit(0).i<no.ch). fclose(fp1). fclose(fp1). ENGINEERING COLLEGE 61 .R.Dept of Computer Science and Engineering 09J21D5818 } fclose(fp2). printf("%c". if(fp2==NULL) { printf("Error opening the file\n"). fp2=fopen("target."r").i++) { if(k==label[i]) return 1.txt =t1 2 []=a 0 1 []=a 1 2 JOGINPALLY B. for(i=0.

R0 STORE R0.R0 LOAD t1.R0 LOAD 6.1 STORE a[1].R1 JOGINPALLY B.t3 LOAD a[2].R0 STORE R0.txt STORE t1.2 STORE a[2].R1 ADD R1. ENGINEERING COLLEGE 62 .R.Dept of Computer Science and Engineering 09J21D5818 []=a 2 3 *t1 6 t2 +a[2] t2 t3 -a[2] t1 t2 /t3 t2 t2 uminus t2 t2 print t2 goto t2 t3 =t3 99 uminus 25 t2 *t2 t3 t3 uminus t1 t1 +t1 t3 t4 print t4 Output: Enter filename of the intermediate code: int.2 STORE a[0].t3 LOAD a[t2].R1 ADD R1.3 LOAD t1.R0 LOAD t2.

R1 STORE R1.t2 LOAD t2.R0 JGT 5.t2 LOAD t3.R0 STORE R0.label#11 Label#11: OUT t2 JMP t2.R1 ADD R1.t3 LOAD t1. ENGINEERING COLLEGE 63 .R1 DIV R1.t1 LOAD t1.t4 OUT t4 JOGINPALLY B.R0 LOAD t2.R0 LOAD t3.label#13 Label#13: STORE t3.99 LOAD 25.R0 LOAD t3.R1 STORE R1.R1 MUL R1.R1 STORE R1.R0 STORE R0.R0 STORE R0.Dept of Computer Science and Engineering 09J21D5818 SUB R1.t2 LOAD t2.R0 STORE R0.t2 LOAD t2.R.

Dept of Computer Science and Engineering 09J21D5818 JOGINPALLY B.R. ENGINEERING COLLEGE 64 .

Sign up to vote on this title
UsefulNot useful