OM SAKTHI
ADHIPARASAKTHI COLLEGE OF ENGINEERING
(NAAC ACCREDITED)
G. B. Nagar, Kalavai - 632 506, Ranipet District, Tamil Nadu.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Name :
Register Number :
Subject Code : CS3501
Subject Name : COMPILER DESIGN LABORATORY
Semester :V Year: III
CERTIFICATE
Certified that this is the bonafide record of work done by the above student
in the ______________________________laboratory during the year 2024-2025.
SIGNATURE OF FACULTY-IN-CHARGE SIGNATURE OF HEAD OF THE DEPARTMENT
Submitted for the Practical Examination held on
Internal Examiner External Examiner
OM SAKTHI
ADHIPARASAKTHI COLLEGE OF ENGINEERING
(NAAC ACCREDITED)
G. B. Nagar, Kalavai - 632 506, Ranipet District, Tamil Nadu.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS3501-COMPILER DESIGN LABORATORY
Name : Reg.No.:
Year/Semester :
CONTENTS
SL.NO PAGE
DATE NAME OF THE EXPERIMENT MARKS SIGNATURE
NO.
DEVELOP A LEXICAL
ANALYZER TO RECOGNIZE A
1 FEW PATTERNS IN C
MPLEMENTATION OF
LEXICAL ANALYZER
2 USING LEX TOOL
GENERATE YACC
SPECIFICATION FOR A FEW
3 SYNTACTIC CATEGORIES
GENERATE THREE ADDRESS
CODEFOR A SIMPLE
4 PROGRAM USING LEX AND
YACC
IMPLEMENTATION OF
5 TYPECHECKING
IMPLEMENTATION OF
6 CODEOPTIMIZATION
TECHNIQUE
IMPLEMENTATION OF
BACKEND OFTHE COMPILER
7
Ex.No.:1DEVELOP A LEXICAL ANALYZER TO RECOGNIZE A FEW PATTERNS IN C
Date:
AIM: To develop a lexical analyzer to identify identifiers, constants, comments, operators etc
using C program.
ALGORITHM: Step1: Start the program.
Step2: Declare all the variables and file pointers.
Step3: Display the input program.
Step4: Separate the keyword in the program and display it.
Step5: Display the header files of the input program
Step6: Separate the operators of the input program and display it.
Step7: Print the punctuation marks.
Step8: Print the constant that are present in input program.
Step9: Print the identifiers of the input program.
PROGRAM :
#include<string.h>
#include<ctype.h>
#include<stdio.h>
#include<stdlib.h>
void keyword(char str[10])
{
if(strcmp("for",str)==0||strcmp("while",str)==0||strcmp("do",str)==0||strcmp("int",str)
==0||strcmp("float",str)==0||strcmp("char",str)==0||strcmp("double",str)==0||strcmp("p
rintf",str)==0||strcmp("switch",str)==0||strcmp("case",str)==0)
printf("\n%s is a keyword",str);
else
printf("\n%s is an identifier",str);
}
int main()
{
FILE *f1,*f2,*f3;
char c,str[10],st1[10];
int num[100],lineno=0,tokenvalue=0,i=0,j=0,k=0;
f1=fopen("input","r");
f2=fopen("identifier","w");
f3=fopen("specialchar","w");
while((c=getc(f1))!=EOF)
{
if(isdigit(c))
{
tokenvalue=c-'0';
c=getc(f1);
while(isdigit(c))
{
tokenvalue*=10+c-'0';
c=getc(f1);
}
num[i++]=tokenvalue;
ungetc(c,f1);
}
else
if(isalpha(c))
{
putc(c,f2);
c=getc(f1);
while(isdigit(c)||isalpha(c)||c=='_'||c=='$')
{
putc(c,f2);
c=getc(f1);
}
putc(' ',f2);
ungetc(c,f1);
}
else
if(c==' '||c=='\t')
printf(" ");
else
if(c=='\n')
lineno++;
else
putc(c,f3);
}
fclose(f2);
fclose(f3);
fclose(f1);
printf("\n the no's in the program are:");
for(j=0;j<i;j++)
printf("\t%d",num[j]);
printf("\n");
f2=fopen("identifier","r");
k=0;
printf("the keywords and identifier are:");
while((c=getc(f2))!=EOF)
if(c!=' ')
str[k++]=c;
else
{
str[k]='\0';
keyword(str);
k=0;
}
fclose(f2);
f3=fopen("specialchar","r");
printf("\n Special Characters are");
while((c=getc(f3))!=EOF)
printf("\t%c",c);
printf("\n");
fclose(f3);
printf("Total no of lines are:%d",lineno);
}
OUTPUT:
RESULT:
Thus the program for developing a lexical analyzer to recognize a few patterns
in C has been executed successfully.
Ex.No.:2 IMPLEMENTATION OF LEXICAL ANALYZER USING LEX TOOL
Date:
AIM:
(Tokenizing) Use Lex and yacc to extract tokens from a given source code.
DESCRIPTION:
➢ A language for specifying lexical analyzer
. ➢ There is a wide range of tools for construction of lexical analyzer. The majority of
these tools are based on regular expressions.
➢ The one of the traditional tools of that kind is lex.
Lex:-
➢ The lex is used in the manner depicted. A specification of the lexical analyzer is
preferred by creating a program lex.1 in the lex language
. ➢ Thenlex.1isrunthroughthelexcompilertoproducea‘c’programlex.yy.c.
➢Theprogramlex.yy.cconsistsofatabularrepresentationofatransitiondiagramconstructe
df rom the regular expression of lex.1 together with a standard routine that uses table
of recognize lexemes.
➢Lex.yy.cisrunthroughthe‘C’compilertoproduceasobjectprograma.out,whichisthelexi
cal Analyzer that transform as input stream into sequence of tokens.
ALGORITHM:
1. lexp.l %{int COMMENT=0; %} identifier[a-z A-Z][a-zA-Z0-9]* %% First, a
specification of a lexical analyzer is prepared by creating a program lexp.l in the LEX
language.
2. TheLexp.lprogramisrunthroughtheLEXcompilertoproduceanequivalentcod ein C
language named Lex.yy.c
3. The program lex.yy.cconsists ofatableconstructedfromthe RegularExpressionsof
Lexp.l, together with standard routines that uses the table to recognize lexemes.
4. Finally,lex.yy.cprogramisrunthroughtheCCompilertoproduceanobjectprog ram
a.out, which is the lexical analyzer that transforms an input stream into a sequence of
tokens.
PROGRAM:
%{
#include <stdio.h>
#include <stdlib.h>
int COMMENT = 0;
%}
identifier [a-zA-Z_][a-zA-Z0-9_]*
%%
#.* { printf("\n%s isaPreprocessorDirective", yytext); }
int |float |main |if|else |printf|scanf|for |char |getch|while
{printf("\n%sisaKeyword",yytext);}
"/*" {COMMENT = 1;}
"*/" {COMMENT = 0;}
{identifier}\( {if (!COMMENT) printf("\nFunction:\t%s", yytext);}
\{ {if (!COMMENT) printf("\nBlockBegins");}
\} {if (!COMMENT) printf("\nBlockEnds");}
{identifier}(\[[0-9]*\])? {if (!COMMENT) printf("\n%s is anIdentifier", yytext);}
\"[^\"\n]*\" {if (!COMMENT) printf("\n%s isaString", yytext);}
[0-9]+ {if (!COMMENT) printf("\n%s isaNumber", yytext);}
\)(\;)? { if (!COMMENT) printf("\t");
ECHO;
printf("\n");
}
\( {ECHO;}
==|<=|>=|<|> { if (!COMMENT) printf("\n%s isaRel.Operator", yytext);}
.|\n
%%
int main(int argc, char **argv)
{
if (argc > 1)
{
FILE *file;
file = fopen(argv[1], "r");
if (!file)
{
printf("\nCould not open the file: %s", argv[1]);
exit(0);
}
yyin = file;
}
yylex();
}
int yywrap()
{
return 0;
}
OUTPUT:
RESULT: Thus the execution of lex program is implemented successfully
Ex.No:3 GENERATE YACC SPECIFICATION FOR A FEW SYNTACTIC CATEGORIES.
Date
AIM :
To write a c program to do exercise on syntax analysis using YACC.
INTRODUCTION :
YACC (yet another compiler) is a program designed to produce designed to compile a
LALR (1) grammar and to produce the source code of the synthetically analyses of the
language produced by the grammar.
ALGORITHM :
1. Start the program.
2. Write the code for parser. l in the declaration port.
3. Write the code for the ‘y’ parser.
4. Also write the code for different arithmetical operations.
5. Write additional code to print the result of computation.
6. Execute and verify it.
7. Stop the program.
A.)PROGRAM TO RECOGNIZE A VALID ARITHMETIC EXPRESSION
THAT USES OPERATOR +, - , * AND /.
Arith.l
%{
#include "y.tab.h"
%}
%%
"=" { printf("\nOperator is EQUAL\n"); }
"+" { printf("\nOperator is ADDITION\n"); }
"-" { printf("\nOperator is SUBTRACTION\n"); }
"*" { printf("\nOperator is MULTIPLICATION\n"); }
"/" { printf("\nOperator is DIVISION\n"); }
[a-zA-Z]+[0-9]* {
printf("\nIdentifier is %s\n", yytext);
return ID;
}
return yytext[0];
return 0;
%%
int yywrap() {
return 1;
}
Arith.y
%{
#include <stdio.h>
#include <stdlib.h>
// Function prototype for error reporting
void yyerror(const char *s);
int yylex(void);
%}
// Token declarations
%token ID
%%
// Grammar rules
statement:
ID '=' E { printf("\nValid arithmetic expression\n"); }
|E { printf("\nValid arithmetic expression\n"); }
;
E:
E '+' ID { /* Handle addition */ }
| E '-' ID { /* Handle subtraction */ }
| E '*' ID { /* Handle multiplication */ }
| E '/' ID { /* Handle division */ }
| ID { /* Handle identifier */ }
;
%%
// Error reporting function
void yyerror(const char *s) {
fprintf(stderr, "Error: %s\n", s);
}
int main(void) {
extern FILE *yyin;
yyin = stdin; // Set input source to standard input
while (!feof(yyin)) {
yyparse();
}
return 0;
}
OUTPUT:
B) PROGRAM TO RECOGNISE A VALID VARIABLE WHICH STARTS WITH A
LETTER FOLLOWED BY ANY NUMBER OF LETTERS OR DIGITS.
Program name: variable_test.l
%{
/* This LEX program returns the tokens for the Expression */
#include "y.tab.h"
#include <stdio.h>
%}
%%
"int" { return INT; }
"float" { return FLOAT; }
"double" { return DOUBLE; }
[a-zA-Z_][a-zA-Z0-9_]* {
printf("Identifier is %s\n", yytext);
return ID;
}
\n { return 0; }
. { return yytext[0]; }
%%
int yywrap() {
return 1;
}
Program name variable_test.y
%{
#include <stdio.h>
#include <stdlib.h>
/* Function prototypes */
int yylex(void);
void yyerror(const char *s);
/* This YACC program is for recognizing the Expression */
%}
%token ID INT FLOAT DOUBLE
%%
// Define grammar rules
D: T L
;
L: L ',' ID
| ID
;
T: INT
| FLOAT
| DOUBLE
;
%%
// Function to handle parsing errors
void yyerror(const char *s) {
fprintf(stderr, "Error: %s\n", s);
}
// Main function to drive the parser
int main(int argc, char **argv) {
extern FILE *yyin;
// Open a file if necessary, or use stdin
if (argc > 1) {
yyin = fopen(argv[1], "r");
if (!yyin) {
perror("Failed to open file");
return EXIT_FAILURE;
}
}
do {
yyparse();
} while (!feof(yyin));
return 0;
}
OUTPUT:
C) PROGRAM TO RECOGNISE THE GRAMAR(ANB WHERE N>=10)
Program name: anb.l
%{
/* Lex Program for anb (n >= 10) */
#include "y.tab.h"
#include <stdio.h>
%}
%%
a { return A; }
b { return B; }
. { return yytext[0]; } // Changed to return the first character
\n { return '\n'; }
%%
int yywrap() {
return 1;
}
Program name: anb.y
%{
/* YACC program for recognizing anb (n >= 10) */
#include <stdio.h>
#include <stdlib.h>
void yyerror(const char *s);
int yylex(void); // Add this line to declare yylex
%}
%token A B
%%
stmt: A A A A A A A A A A anb '\n' {
printf("\nValid string\n");
return 0;
}
;
anb: A anb
|AB
| /* Base case for recursion */
;
%%
int main() {
printf("\nEnter some valid string\n");
yyparse();
return 0;
}
void yyerror(const char *s) {
printf("\nInvalid string\n");
}
OUTPUT:
D) IMPLEMENTATION OF CALCULATOR USING LEX AND YACC
Program name:calci.l
%{
#include<stdlib.h>
#include "y.tab.h"
extern int yylval;
%}
%%
[0-9]+ {yylval=atoi(yytext); return NUMBER;}
[\n] return 0;
[\t];
. return yytext[0];
%%
yywrap()
{ return 0;}
Program name:calci.y
%{
#include <stdio.h>
#include <stdlib.h>
int yylex(void);
void yyerror(const char *s);
%}
%token NAME NUMBER
%left GE LE NE EQ '<' '>' '%'
%left '-' '+'
%left '*' '/'
%nonassoc UMINUS
%%
statement:
NAME '=' exp { printf("%s = %d\n", $1, $3); }
| exp { printf("= %d\n", $1); }
;
exp:
NUMBER { $$ = $1; }
| exp '+' exp { $$ = $1 + $3; }
| exp '-' exp { $$ = $1 - $3; }
| exp '*' exp { $$ = $1 * $3; }
| exp '/' exp {
if ($3 == 0) {
yyerror("Division by zero");
$$ = 0; // or handle the error as needed
} else {
$$ = $1 / $3;
}
}
| '-' exp %prec UMINUS { $$ = -$2; }
| '(' exp ')' { $$ = $2; }
;
%%
int main() {
printf("Enter the expression: ");
yyparse();
return 0;
}
void yyerror(const char *s) {
printf("Error: %s\n", s);
}
OUTPUT:
RESULT:
Thus the implementation of yacc specifications executed successfully.
Ex.No:4 GENERATE THREE ADDRESS CODE FOR A SIMPLE
PROGRAM USING LEX AND YACC
Date:
AIM:
To generate three address code for a simple program using LEX and YACC.
ALGORITHM:
LEX:
1.Declare the required header file and variable declaration with in ‘%{‘ and ‘%}’.
2. LEX requires regular expressions to identify valid arithmetic expression token of
lexemes. 3. LEX call yywrap() function after input is over. It should return 1 when
work is done or should return 0 when more processing is required.
YACC:
1. Declare the required header file and variable declaration with in ‘%{‘ and ‘%}’.
2. Define tokens in the first section and also define the associativity of the operations
3. Mention the grammar productions and the action for each production.
4. Call yyparse() to initiate the parsing process.
5. yyerror() function is called when all productions in the grammar in second section
doesn't match to the input statement.
6. Make_symtab_entry() function to make the symbol table entry
PROGRAM: newlex.l
%{
#include"y.tab.h"
extern char yyval;
%}
%%
[0-9]+ {yylval.symbol=(char)(yytext[0]);return NUMBER;}
[a-z] {yylval.symbol= (char)(yytext[0]);return LETTER;}
. {return yytext[0];}
\n {return 0;}
%%
newlex.y
%{
#include"y.tab.h"
#include<stdio.h>
char addtotable(char,char,char);
int index1=0;
char temp = 'A'-1;
struct expr{
char operand1;
char operand2;
char operator;
char result;
};
%}
%union{
char symbol;
}
%left '+' '-'
%left '/' '*'
%token <symbol> LETTER NUMBER
%type <symbol> exp
%%
statement: LETTER '=' exp ';' {addtotable((char)$1,(char)$3,'=');};
exp: exp '+' exp {$$ = addtotable((char)$1,(char)$3,'+');}
|exp '-' exp {$$ = addtotable((char)$1,(char)$3,'-');}
|exp '/' exp {$$ = addtotable((char)$1,(char)$3,'/');}
|exp '*' exp {$$ = addtotable((char)$1,(char)$3,'*');}
|'(' exp ')' {$$= (char)$2;}
|NUMBER {$$ = (char)$1;}
|LETTER {(char)$1;};
%%
struct expr arr[20];
void yyerror(char *s)
{
printf("Errror %s",s);
}
char addtotable(char a, char b, char o){
temp++;
arr[index1].operand1 =a;
arr[index1].operand2 = b;
arr[index1].operator = o;
arr[index1].result=temp;
index1++;
return temp;
}
void threeAdd()
{
int i=0;
char temp='A';
while(i<index1)
{
printf("%c:=\t",arr[i].result);
printf("%c\t",arr[i].operand1);
printf("%c\t",arr[i].operator);
printf("%c\t",arr[i].operand2);
i++;
temp++;
printf("\n");
}
}
void fouradd()
{
int i=0;
char temp='A';
while(i<index1)
{
printf("%c\t",arr[i].operator);
printf("%c\t",arr[i].operand1);
printf("%c\t",arr[i].operand2);
printf("%c",arr[i].result);
i++;
temp++;
printf("\n");
}
int find(char l)
{
int i;
for(i=0;i<index1;i++)
if(arr[i].result==l) break;
return i;
}
void triple()
{
int i=0;
char temp='A';
while(i<index1)
{
printf("%c\t",arr[i].operator);
if(!isupper(arr[i].operand1))
printf("%c\t",arr[i].operand1);
else
{
printf("pointer");
printf("%d\t",find(arr[i].operand1));
}
if(!isupper(arr[i].operand2))
printf("%c\t",arr[i].operand2);
else
{
printf("pointer");
printf("%d\t",find(arr[i].operand2));
}
i++;
temp++;
printf("\n");
}
}
int yywrap()
{
return 1;
}
int main()
{
printf("Enter the expression: ");
yyparse();
threeAdd();
printf("\n");
fouradd();
printf("\n");
triple();
return 0;
}
OUTPUT:
RESULT:
Thus the execution of three address code using LEX and YACC is implemented
successfully
EX.No:5 IMPLEMENTATION OF TYPE CHECKING
DATE:
AIM:
To write a C program for implementing type checking for given expression.
INTRODUCTION:
The type analysis and type checking is an important activity done in the semantic
analysis phase. The need for type checking is
1. To detect the errors arising in the expression due to incompatible operand.
2. . To generate intermediate code for expressions due to incompatible operand. Role
of type checker
ALGORITHM:
1. Start a program.
2. Include all the header files.
3. Initialize all the functions and variables.
4. Get the expression from the user and separate into the tokens.
5. After separation, specify the identifiers, operators and number.
6. Print the output.
7. Stop the program
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i,k,flag=0;
char vari[15],typ[15],b[15],c;
printf("Enter the number of variables:");
scanf(" %d",&n);
for(i=0;i<n;i++)
{
printf("Enter the variable[%d]:",i);
scanf(" %c",&vari[i]);
printf("Enter the variable-type[%d](float-f,int-i):",i);
scanf(" %c",&typ[i]);
if(typ[i]=='f')
flag=1;
}
printf("Enter the Expression(end with $):");
i=0;
getchar();
while((c=getchar())!='$')
{
b[i]=c;
i++; }
k=i;
for(i=0;i<k;i++)
{
if(b[i]=='/')
{
flag=1;
break; } }
for(i=0;i<n;i++)
{
if(b[0]==vari[i])
{
if(flag==1)
{
if(typ[i]=='f')
{ printf("\nthe datatype is correctly defined..!\n");
break; }
else
{ printf("Identifier %c must be a float type..!\n",vari[i]);
break; } }
else
{ printf("\nthe datatype is correctly defined..!\n");
break; } }
}
return 0;
}
OUTPUT:
RESULT:
Thus the type checking program was executed successfully
EX.No.:6 IMPLEMENTATION OF CODE OPTIMIZATION TECHNIQUE
Date:
AIM:
To write a program for implementation of Code Optimization Technique.
ALGORITHM:
Step1: Generate the program for factorial program using for and do-while loop to
specify optimization technique.
Step2: In for loop variable initialization is activated first and the condition is checked
next. If the condition is true the corresponding statements are executed and specified
increment / decrement operation is performed.
Step3: The for loop operation is activated till the condition failure.
Step4: In do-while loop the variable is initialized and the statements are executed then
the condition checking and increment / decrement operation is performed. Step5:
When comparing both for and do-while loop for optimization dowhile is best because
first the statement execution is done then only the condition is checked. So, during the
statement execution itself we can find the inconvenience of the result and no need to
wait for the specified condition result.
Step6: Finally when considering Code Optimization in loop do-while is best with
respect to performance.
PROGRAM:
#include<stdio.h>
#include<string.h>
struct op
{
char l;
char r[20];
}
op[10],pr[10];
int main()
{
int a,i,k,j,n,z=0,m,q;
char *p,*l;
char temp,t;
char *tem;
printf("Enter the Number of Values:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("left: ");
scanf(" %c",&op[i].l);
printf("right: ");
scanf(" %s",&op[i].r);
}
printf("Intermediate Code\n") ;
for(i=0;i<n;i++)
{
printf("%c=",op[i].l);
printf("%s\n",op[i].r);
}
for(i=0;i<n-1;i++)
{
temp=op[i].l;
for(j=0;j<n;j++)
{
p=strchr(op[j].r,temp);
if(p)
{
pr[z].l=op[i].l;
strcpy(pr[z].r,op[i].r);
z++;
}
}
}
pr[z].l=op[n-1].l;
strcpy(pr[z].r,op[n-1].r);
z++;
printf("\nAfter Dead Code Elimination\n");
for(k=0;k<z;k++)
{
printf("%c\t=",pr[k].l);
printf("%s\n",pr[k].r);
}
for(m=0;m<z;m++)
{
tem=pr[m].r;
for(j=m+1;j<z;j++)
{
p=strstr(tem,pr[j].r);
if(p)
{
t=pr[j].l;
pr[j].l=pr[m].l;
for(i=0;i<z;i++)
{
l=strchr(pr[i].r,t) ;
if(l)
{
a=l-pr[i].r;
printf("pos: %d\n",a);
pr[i].r[a]=pr[m].l;
}}}}}
printf("Eliminate Common Expression\n");
for(i=0;i<z;i++)
{
printf("%c\t=",pr[i].l);
printf("%s\n",pr[i].r);
}
for(i=0;i<z;i++)
{
for(j=i+1;j<z;j++)
{
q=strcmp(pr[i].r,pr[j].r);
if((pr[i].l==pr[j].l)&&!q)
{
pr[i].l='\0';
}
}
}
printf("Optimized Code\n");
for(i=0;i<z;i++)
{
if(pr[i].l!='\0')
{
printf("%c=",pr[i].l);
printf("%s\n",pr[i].r);
}
}
}
OUTPUT:
RESULT:
Thus the code optimization was executed successfully.
EX.No:7 IMPLEMENTATION OF BACK END OF THE COMPILER
Date:
AIM:
TO implement the back end of the compiler which takes the three address code
and produces the 8086 assembly language instructions that can be assembled and run
using a 8086 assembler. The target assembly instructions can be simple move, add,
sub, jump. Also simple addressing modes are used.
ALGORITHM:
1. Start the program
2. Open the source file and store the contents as quadruples.
3. Check for operators, in quadruples, if it is an arithmetic operator generator it or if
assignment operator generates it, else perform unary minus on register C.
4. Write the generated code into output definition of the file in outp.c
5. Print the output.
6. Stop the program.
PROGRAM: (BACK END OF THE COMPILER)
#include <stdio.h>
#include <string.h>
int main() {
char icode[10][30], str[30], opr[10];
int i = 0;
printf("\nEnter the set of intermediate code (terminated by 'exit'):\n");
// Reading intermediate code
do {
scanf("%s", icode[i]);
} while (strcmp(icode[i++], "exit") != 0);
// Adjust the index to account for the 'exit' command
i--;
printf("\nTarget code generation");
printf("\n************************");
// Generating target code
for (int j = 0; j < i; j++) {
strcpy(str, icode[j]);
switch (str[3]) {
case '+':
strcpy(opr, "ADD");
break;
case '-':
strcpy(opr, "SUB");
break;
case '*':
strcpy(opr, "MUL");
break;
case '/':
strcpy(opr, "DIV");
break;
default:
printf("\nUnknown operation: %c", str[3]);
continue;
}
printf("\n\tMov %c, R%d", str[2], j);
printf("\n\t%s %c, R%d", opr, str[4], j);
printf("\n\tMov R%d, %c", j, str[0]);
}
return 0;
}
OUTPUT:
RESULT:
Thus the code Generation Program was executed successfully.