Transform the context-free grammar obtained in activity 5


Write a context-free grammar for arithmetic expressions consisting of non-negative binary integer numbers defined in Activity 1 and four operators, + (addition), -(subtraction), * (multiplication), and / (division). No precedence or associativity need to be considered in the grammar. In addition, no parentheses can be used in expressions. For example, (10 - 1) * 101 is not acceptable. The regular grammar you have obtained in Activity 1 should be included as part of your solution. Turn in your solution by the date when Section 12.2 is finished.

Transform the context-free grammar obtained in Activity 5 to a pushdown automaton using the algorithm in Section 12.2.2. Turn in your solution by the date when Section 12.3 is finished.

Write parsers for arithmetic expressions. Transform your grammar into a LL(1) grammar. You may need to do a left-factoring of common prefix of productions, and/or to remove any left-recursive productions in the grammar for aritmetic

expressions using the algorithm in Section 12.3.1. Then write a recursive-descent parser for the context-free grammar for arithmetic expressions using the algorithm in Section 12.3.1.

Turn in your solution by the date when Section 12.4 is finished.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Transform the context-free grammar obtained in activity 5
Reference No:- TGS0666064

Now Priced at $40 (50% Discount)

Recommended (92%)

Rated (4.4/5)