This is about a topic of compiler design, LR and SLR parsing algorithm and LR grammar, Canonical collection and Item, Conflict in LR parsing shift reduce. Classification of Bottom up parsing.
A single pass assembler scans the program only once and creates the equivalent binary program. The assembler substitute all of the symbolic instruction with machine code in one pass.
This is about a topic of compiler design, LR and SLR parsing algorithm and LR grammar, Canonical collection and Item, Conflict in LR parsing shift reduce. Classification of Bottom up parsing.
A single pass assembler scans the program only once and creates the equivalent binary program. The assembler substitute all of the symbolic instruction with machine code in one pass.
Algorithms Lecture 1: Introduction to AlgorithmsMohamed Loey
We will discuss the following: Algorithms, Time Complexity & Space Complexity, Algorithm vs Pseudo code, Some Algorithm Types, Programming Languages, Python, Anaconda.
Algorithms Lecture 1: Introduction to AlgorithmsMohamed Loey
We will discuss the following: Algorithms, Time Complexity & Space Complexity, Algorithm vs Pseudo code, Some Algorithm Types, Programming Languages, Python, Anaconda.
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Introduction to AI for Nonprofits with Tapp Network
Compiler design lab programs
1. Mukesh Kumar
1110751908
CSE 7th
Sem
Course: Bachelor of Technology
Branch: Computer Science & Engineering
Semester: 7th
GURU JAMBHESHWAR UNIVERSITY OF
SCIENCE & TECHNOLOGY, HISAR
Submitted To: - Submitted By:-
Er. Isha Nagpal Mukesh Kumar
Asstt. Professor in CSE Deptt. 1110751908
Department of Computer Science & Engineering
Prannath Parnami Institute of Management & Technology, Hisar
Prannath Parnami Universe, Website: ppu.edu.in
2. Mukesh Kumar
1110751908
CSE 7th
Sem
INDEX
Sr.
No.
Name of Experiment Date Sign.
1. Write a program to design lexical analyzer.
2. Write a program to generate three address codes
for assignment, arithmetic and relational
expressions.
3. Write a program to check whether a string to the
grammar or not.
4. Write a program to find the number of
whitespaces & newline characters.
5. Write a program to find the leading terminals.
6. Write a program to find the trailing terminals.
7. Write a program for computation of first.
8. Write a program to show the operations of stack.
9. Write a program to perform the operations on
stack by using linked list.
10. Write a program to perform the operations on file.
3. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-01
Write a program to design lexical analyzer.
#include<ctype.h>
#include<stdio.h>
#include<string.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("static",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);
}
void main()
{
FILE *f1,*f2,*f3;
char c,str[10],st1[10];
int num[100],lineno=0,tokenvalue=0,i=0,j=0,k=0;
printf("n enter the c program");
gets(st1);
f1=fopen("input.txt","w");
while((c=getchar())!=EOF)
putc(c,f1);
fclose(f1);
f1=fopen ("input.txt","r");
f2=fopen ("identifier.txt","w");
f3=fopen ("specialchar.txt","w");
while((c=getc(f1))!=EOF)
{
if(isdigit(c))
{
tokenvalue=c-'0';
7. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-02
Write a program to generate three address code for assignment, arithmetic and
relational expressions.
#include<stdio.h>
#include<string.h>
int i,ch,j,l,addr=100;
char ex[10],exp[10],exp1[10],exp2[10],id1[5],op[5],id2[5];
void main()
{
clrscr();
while(1)
{
printf("n 1. Assignment Expression or Arithmetic Expression n 2. Relational or Expression n
3. Exit n Enter the choice:");
scanf("%d", &ch);
switch(ch)
{
case 1:
printf("n Enter the expression with Assignment Expression Operator or Arithmetic Operator:");
scanf("%s",exp);
l=strlen(exp);
exp2[0]='0';
i=0;
while(exp[i]!='=')
{
i++;
}
strncat(exp2,exp,i);
strrev(exp);
exp1[0]='0';
strncat(exp1,exp,l-(i+1));
strrev(exp1);
printf("three address code:ntemp=%sn%s=tempn",exp1,exp2);
break;
case 2:
8. Mukesh Kumar
1110751908
CSE 7th
Sem
printf("Enter the expression with relational operator");
scanf("%s%s%s",&id1,&op,&id2);
if(((strcmp(op,"<")==0)||(strcmp(op,">")==0)||(strcmp(op,"<=")
==0)||(strcmp(op,">=")==0)||(strcmp(op,"==")==0)||(strcmp(op,"!=")==0))==0)
printf("Expression is error");
else
{
printf("n %dtif%s%s%s goto %d",addr,id1,op,id2,addr+3);
addr++;
printf("n %dt T:=0",addr);
addr++;
printf("n %dt goto %d",addr,addr+2);
addr++;
printf("n %dt T:=1",addr);
}
break;
case 3:
exit(0);
}
}
}
13. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-04
Write a program to find the number of whitespaces & newline characters.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main ()
{
char str[200],ch;
int a=0, space=0,newline=0;
clrscr();
printf("enter a string ( press escape to quit entering)");
ch=getche();
while((ch!=27)&&(a<199))
{
str[a]=ch;
if (str[a] ==' ')
{
space++;
}
if(str[a]==13)
{
newline++;
printf("n");
}
a++;
ch=getche();
}
printf("n the no. of lines used =%d", newline);
printf("n the no. of spaces used =%d", space);
getch();
}
15. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-05
Write a program to find the leading terminals.
#include<stdio.h>
#include<string.h>
#include<conio.h>
int nt,t,top=0;
char s[50],NT[10],T[10],st[50],l[10][10],tr[50][50];
int searchnt(char a)
{
int count=-1,i;
for(i=0;i<nt;i++)
{
if(NT[i]==a)
return i;
}
return count;
}
int searchter(char a)
{
int count=-1,i;
for(i=0;i<t;i++)
{
if(T[i]==a)
return i;
}
return count;
}
void push(char a)
{
s[top]=a;
top++;
}
char pop()
{
top--;
return s[top];
}
void installl(int a,int b)
16. Mukesh Kumar
1110751908
CSE 7th
Sem
{
if(l[a][b]=='f')
{
l[a][b]='t';
push(T[b]);
push(NT[a]);
}}
void main()
{
int i,s,k,j,n;
char pr[30][30],b,c;
clrscr();
printf("Enter the no of production :");
scanf("%d",&n);
printf("Enter the productions one by onen");
for(i=0;i<n;i++)
scanf("%s", &pr[i]);
nt=0;
t=0;
for(i=0;i<n;i++)
{
if((searchnt(pr[i][0]))==-1)
NT[nt++]=pr[i][0];
}
for(i=0;i<n;i++){
for(j=3;j<strlen(pr[i]);j++){
if(searchnt(pr[i][j])==-1)
{
if(searchter(pr[i][j])==-1)
T[t++]=pr[i][j];
}}}
for(i=0;i<nt;i++){
for(j=0;j<t;j++)
l[i][j]='f';
}
for(i=0;i<nt;i++){
for(j=0;j<t;j++)
tr[i][j]='f';
}
23. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-07
Write a program for computation of first.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char t[5],nt[10],p[5][5],first[5][5],temp;
int i,j,not,nont,k=0,f=0;
clrscr();
printf("Enter the no. of Non-terminals in the grammer:");
scanf("%d",&nont);
printf("nEnter the Non-terminals in the grammer:");
for(i=0;i<nont;i++)
{
scanf("n%c",&nt[i]);
}
printf("nEnter the no. of Terminals in the grammer: ( Enter e for absiline ) ");
scanf("%d",¬);
printf("Enter the Terminals in the grammer:");
for(i=0;i<not||t[i]=='$';i++)
{
scanf("n%c",&t[i]);
}
for(i=0;i<nont;i++)
{
p[i][0]=nt[i];
first[i][0]=nt[i];
}
printf("nEnter the productions :n");
for(i=0;i<nont;i++)
{
scanf("%c",&temp);
printf("nEnter the production for %c ( End the production with '$' sign ) :",p[i][0]);
for(j=0;p[i][j]!='$';)
{
26. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-08
Write a program to show the operations of stack.
#include<stdio.h>
#include<conio.h>
#define MAXSIZE 10
void push();
int pop();
void traverse();
int stack[MAXSIZE];
int Top=-1;
void main()
{
int choice;
char ch;
do
{
clrscr();
printf("nENTER 1 FOR PUSH: ");
printf("nENTER 2 TO POP THE ELEMENT: ");
printf("nENTER 3 TO TRAVERSE THE ELEMENTS: ");
printf("n ENTER YOUR CHOICE: ");
scanf("%d",&choice);
switch(choice)
{
case 1:push();
break;
case 2:printf("nTHE DELETED ELEMENT IS %d",pop());
break;
case 3: traverse();
break;
default:printf("n SORRY!!!!!YOU HAVE ENTERED A WRONG CHOICE");
}
printf("n DO YOU WISH TO CONTINUE???(Y/N): ");
fflush(stdin);
scanf("%c",&ch);
}
while(ch=='y'|| ch=='Y');
}
27. Mukesh Kumar
1110751908
CSE 7th
Sem
void push()
{
int item;
if(Top==MAXSIZE-1)
{
printf("n SORRY STACK IS FULL");
getch();
exit();
}
else
{
printf("ENTER THE ELEMENT TO BE INSERTED: ");
scanf("%d",&item);
Top=Top+1;
stack[Top]=item;
}
}
int pop()
{
int item;
if(Top==-1)
{
printf("SORRY!! STACK IS EMPTY");
getch();
exit();
}
else
{
item=stack[Top];
Top=Top-1;
}
return(item);
}
void traverse()
{
int i;
if(Top==-1)
{
printf("OHH!! STACK IS EMPTY");
30. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-09
Write a program to perform the operations on stack by using linked list.
#include<stdio.h>
#include<conio.h>
struct stack
{
int no;
struct stack *next;
}
*start=NULL;
typedef struct stack st;
void push();
int pop();
void display();
void main()
{
int choice, item;
char ch;
do
{
clrscr();
printf("nENTER 1 FOR PUSH ITEM: ");
printf("nENTER 2 TO POP THE ITEM FROM STACK: ");
printf("nENTER 3 TO DISPLAY THE ITEMS OF STACK: ");
printf("n ENTER YOUR CHOICE: ");
scanf("%d",&choice);
switch(choice)
{
case 1:push();
break;
case 2: item=pop();
printf("THE DELETED ITEM IS -->%d", item);
break;
case 3: display();
break;
default:printf("n SORRY!!!!!YOU HAVE ENTERED A WRONG CHOICE");
}
printf("n DO YOU WISH TO CONTINUE???(Y/N): ");
31. Mukesh Kumar
1110751908
CSE 7th
Sem
fflush(stdin);
scanf("%c",&ch);
}
while(ch=='y'|| ch=='Y');
}
void push()
{
st *node ;
node=(st *)malloc(sizeof(st));
printf("n ENTER THE NUMBER TO BE INSERTED");
scanf("%d",&node->no);
node->next =start;
start=node;
}
int pop()
{
st *temp;
temp=start;
if(start==NULL){
printf("STACK IS ALREADY EMPTY: ");
getch();
exit();
}
else
{
start=start->next;
free(temp);
}
return(temp->no);
}
void display(){
st *temp;
temp=start;
while(temp->next!=NULL){
printf("n no=%d", temp->no);
temp=temp->next;
}
printf("n no=%d",temp->no);
}
33. Mukesh Kumar
1110751908
CSE 7th
Sem
Program-10
Write a program to perform the operations on file.
#include<stdio.h>
#include<stdlib.h>
int main()
{
char ch,source_file[20],target_file[20];
FILE *source, *target;
printf("Enter the name of file to copyn ");
gets(source_file);
source=fopen(source_file,"r");
if(source==NULL)
{
printf("Press any key to exit..n ");
exit(EXIT_FAILURE);
}
printf("Enter the name of target filen");
gets(target_file);
target=fopen(target_file,"w");
if(target==NULL)
{
fclose(source);
printf("Press any key to exit..n");
exit(EXIT_FAILURE);
}
while((ch=fgetc(source))!=EOF)
fputc(ch,target);
printf("File copied successfullyn");
fclose(source);
fclose(target);
return 0;
}