Question: Use the following grammar in which program, var, begin, end , integer, and print are reserved words. Use photo 4 , final 2 4 .
Use the following grammar in which program, var, begin, end integer, and print are reserved words. Use photo finaltxt as the input. needs to be tokenized
Have your program compiler check the grammar of the program and display No Error
if the given grammar liked the program or issue some errors otherwise.
Have your program detect the following errors and issue a corresponding error message:
"program is expected" if program is spelled wrong
"var is expected" if var is spelled wrong
"begin is expected" if begin is spelled wrong
"end is expected" if end is spelled wrong
"integer is expected" if integer is spelled wrong
"print is expected" if print is spelled wrong
"unknown identifier" if the variable is not defined
; semicolon is missing" if the grammar required a ;
comma is missing" if the grammar required a
period is missing" if the grammar required a
The left parentheses is missing
The right parentheses is missing
Output : Ready to compile or this is the list of errors
The whole program grammar consists of ONE line, and each nonterminal in the grammar will be defined over and over until it hits a terminal.
The table is provided in python:
parsingtable
"programI;varDbeginSend", # P
LKLKLKLKLKLK # I
LKLKLKLKLKLKJKJKJKJKJKJKJKJKJKJK # K
A:T;A:T;A:T;A:T;A:T;A:T; # D
VAVAVAVAVAVA # A
"I,", "I,", "I,", "I,", "I,", "I,", # V
"integer", # T
BUBUBUBUBUBUBU # S
SSSSSSS # U
RRRRRRW # B
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
