In this assignment, you will draw the automaton for a Canonical LR(1), also called CLR(1), parser for a reference grammar. You should define the production rules and alphabet of terminals for the grammar following the process described below. To learn how to construct the automaton of a CLR(1) parser, read Sections 4.7.1 to 4.7.3 of the reference textbook. Draw the automaton exactly in the way shown in the reference textbook. Note that your submission must be a handwritten version, a typed submission will get a 0 out of 10. Grammar Construction Process (note that & means empty): A -> BAC A -> DE B -> the last digit of your student ID C -> the second last digit of your student ID D -> the third last digit of your student ID E-> the fourth last digit of your student ID Then, if your student ID is odd then add the following rules: B-> ε D-> ε Otherwise, add the following rules: C -> ε E-> ε An example: Suppose your student ID is 20130165. Then your grammar is as follows A -> BAC A -> DE B -> 5 C -> 6 D -> 1 E-> 0 B-> ε D -> ε Alphabet of terminals is {5,6,1,0}

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.5: Virtual Functions
Problem 5E
icon
Related questions
Question
Student ID is 24241357
In this assignment, you will draw the automaton for a Canonical
LR(1), also called CLR(1), parser for a reference grammar. You
should define the production rules and alphabet of terminals for
the grammar following the process described below. To learn
how to construct the automaton of a CLR(1) parser, read
Sections 4.7.1 to 4.7.3 of the reference textbook. Draw the
automaton exactly in the way shown in the reference textbook.
Note that your submission must be a handwritten version, a
typed submission will get a 0 out of 10.
Grammar Construction Process (note that & means empty):
A -> BAC
A -> DE
B -> the last digit of your student ID
C -> the second last digit of your student ID
D -> the third last digit of your student ID
E-> the fourth last digit of your student ID
Then, if your student ID is odd then add the following rules:
B-> ε
D-> ε
Otherwise, add the following rules:
C -> ε
E-> ε
An example: Suppose your student ID is 20130165. Then your
grammar is as follows
A -> BAC
A -> DE
B -> 5
C -> 6
D -> 1
E-> 0
B-> ε
D -> ε
Alphabet of terminals is {5,6,1,0}
Transcribed Image Text:In this assignment, you will draw the automaton for a Canonical LR(1), also called CLR(1), parser for a reference grammar. You should define the production rules and alphabet of terminals for the grammar following the process described below. To learn how to construct the automaton of a CLR(1) parser, read Sections 4.7.1 to 4.7.3 of the reference textbook. Draw the automaton exactly in the way shown in the reference textbook. Note that your submission must be a handwritten version, a typed submission will get a 0 out of 10. Grammar Construction Process (note that & means empty): A -> BAC A -> DE B -> the last digit of your student ID C -> the second last digit of your student ID D -> the third last digit of your student ID E-> the fourth last digit of your student ID Then, if your student ID is odd then add the following rules: B-> ε D-> ε Otherwise, add the following rules: C -> ε E-> ε An example: Suppose your student ID is 20130165. Then your grammar is as follows A -> BAC A -> DE B -> 5 C -> 6 D -> 1 E-> 0 B-> ε D -> ε Alphabet of terminals is {5,6,1,0}
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT