



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




College Of Engineering (Software Engineering)
Semester: SPRING- 23 Date of Experiment: _____________________ Student name: MAHEEN JAVED Faculty Signature: ______________________ Student ID: 10743 Remarks/Comments: ____________________ Lab 06 Top Down Parser I (Finding the first set of a given grammar) PLOs PLO 1 – Engineering Knowledge Bloom’s Taxonomy C1 – Recall PLO 3 – Design & Development C3 – Apply PLO8 – Ethics P2 – Set
CLO’s Aspects of Assessments Excellent (75-100%) Average (50-75%) Poor (<50%) Marks CLO 1 0% Recall the associated concepts form theory regarding basic concepts of compiler construction & C# Language Complete understanding of the concepts of Compiler Construction / actively participate during lecture. Complete understanding of the concepts of Compiler Construction / less actively participate during lecture. Student lacks clear understanding of concepts of Compiler Construction / Unable to read and interpret it. CLO 8 0% Design & Development Design Lexical Analyzer for given Regular Expressions, and also design syntax Analyzer for given Context free grammars using C# programming language A complete solution / Explain necessary theories according to task description with great use of time and resource material. Solution was complete but need minor modifications / student could have followed specification more closely. Solution was complete but did not work, needed several modifications / did not make correct use of resource material or instructions. CLO 7 10% Lab Safety Properly handle lab infrastructure/safety precautions Properly handle lab equipment & obey safety measures. Moderate level lab handling and safety measurements Minor or no safety measurements has been considered. Total Marks: 10
#include<stdio.h> #include<ctype.h> void Find_First(char[], char); void Array_Manipulation(char[], char); int limit; char production[25][25]; int main() { char option; char ch; char array[25]; int count; printf("\nEnter Total Number of Productions:\t"); scanf("%d", &limit); for(count = 0; count < limit; count++) { printf("\nValue of Production Number [%d]:\t", count + 1); scanf("%s", production[count]); } do { printf("\nEnter a Value to Find First:\t"); scanf(" %c", &ch); Find_First(array, ch); printf("\nFirst Value of %c:\t{ ", ch); for(count = 0; array[count] != '\0'; count++) { printf(" %c ", array[count]); }
for(k = 0; temporary_result[k] != '\0'; k++) { Array_Manipulation(array,temporary_result[k]); } for(k = 0; temporary_result[k] != '\0'; k++) { if(temporary_result[k] == '$') { x = 1; break; } } if(!x) { break; } j++; } } } } return; } void Array_Manipulation(char array[], char value) { int temp; for(temp = 0; array[temp] != '\0'; temp++) { if(array[temp] == value) { return; } }
array[temp] = value; array[temp + 1] = '\0'; }