Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

UPDATE: We want to create a top-down parser which is able to analyze the Java style class declarations same as the following examples, class Car

UPDATE:

We want to create a top-down parser which is able to analyze the Java style class declarations same as the following examples,

class Car extends Vehicle

public class JavaIsCrazy implements Factory, Builder, Listener

public final class President extends Person implements Official

For this, we have the following grammar:

Index Grammar Rule
0
1 C -> P R class identifier X Y
2 P -> public
3 P ->
4 F -> final
5 f ->
6 X -> extends identifier
7 X ->
8 Y -> implements I
9 Y ->
10 I -> identifier J
11 J -> , I
12 J ->

For this homework, you need to submit the following:

Compute Nullable values for all nonterminals )LHS) and all production rules (RHS). Submit the Nullable calculation rules and the results. You do not need to submit the iterative table that is used for calculation.

To refer to productions you use production numbers mentioned above, since using the names are lengthy. The following is an example:

Instead of writing "Nullable (extends identifier)", you write "Nullable (6)".

Compute FIRST sets for all nonterminals (LHS) and all production rules (RHS) You submit the FIRST calculation rules and the result sets. You do not need to submit the iterative table that is used for calculation.

To refer to productions you use production numbers mentioned above, since using the names are lengthy. The following is an example:

Instead of writing "FIRST (extends identifier)", you write "FIRST (6)".

Compute FOLLOW sets for all nonterminals (LHS). (Don't forget to add a new start symbol and corresponding production rule including the end-of-input symbol, i.e. $. You submit the FOLLOW calculation rules for all and the result sets.

Submit the LL(1) parsing table for the grammar. (You added a new production rule with a new start symbol. For this production rule, we use the number 0 as its index number.)

To populate the table, you use rule numbers mentioned above instead of writing the production rules in the table. For example, in the table, instead of writing "F -> final" you only write "4".

----

please do not create a program to answer the problem. the problem must be answered with parsing.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago