The assignment content is about Predictive Parser, a program that generates a parsing table for a small language. The program uses arrays and strings to store the parser rules, first and follow sets, and the generated parsing table.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
PREDICTIVE PARSER #include<iostream> #include<string.h> #include<stdlib.h> #include<ctype.h> char pr1[7][10]={"A","B","B","C","C","D","D"}; char pr2[7][10]={"B","Cb","Dd","aC","#","Dc","#"}; char pr3[7][10]={"A->B","B->Cb","B->Dd","C->aC","C->#","D >Dc","D->#"}; char first[7][10]={"abcd","ab","cd","a#","#","c#","#"}; char follow[7][10]={"$","$","$","a$","b$","c$","d$"}; char table[5][6][10]; //char pro[i]; int numr(char c) { switch(c) { case 'A': return 0; case 'B': return 1; case 'C': return 2; case 'D': return 3; case 'a': return 0; case 'b': return 1; case 'c': return 2; case 'd': return 3;
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.