Programming part: 1. Given the following CFG and the Predictive Parsing table. Write a program to trace input strings (1) (i+i)*i$ ,(2) i*(i-i)$ , (3) i(i+i)$ . Show the content of the stack after each match. E --> E+T; E--> E-T;E--> T; T-->T*F; T-->T/F; T-->F; F-->i; F->(E) states i + * E TQ TQ Q +TQ -TQ FR FR R *FR /FR F i (E)

Algebra and Trigonometry (6th Edition)
6th Edition
ISBN:9780134463216
Author:Robert F. Blitzer
Publisher:Robert F. Blitzer
ChapterP: Prerequisites: Fundamental Concepts Of Algebra
Section: Chapter Questions
Problem 1MCCP: In Exercises 1-25, simplify the given expression or perform the indicated operation (and simplify,...
icon
Related questions
Question

i need in C++ must attach output screen shot and editable code

Question is in photo below

 

Also attaching its javascript code might hrlp you

Code:

var cfg = new Cfg();

// E -> T E'

cfg.Rules.Add(new CfgRule("E", "T", "E'"));

// E' -> + T E'

cfg.Rules.Add(new CfgRule("E'", "+", "T", "E'"));

// E' ->

cfg.Rules.Add(new CfgRule("E'"));

// T -> F T'

cfg.Rules.Add(new CfgRule("T", "F", "T'"));

// T' -> * F T'

cfg.Rules.Add(new CfgRule("T'", "*", "F", "T'"));

// T' ->

cfg.Rules.Add(new CfgRule("T'"));

// F -> ( E )

cfg.Rules.Add(new CfgRule("F", "(", "E", ")"));

// F -> int

cfg.Rules.Add(new CfgRule("F", "int"));

Programming part:
Given the following CFG and the Predictive Parsing table. Write a program to trace input strings
(1) (i+i)*i$ ,(2) i*(i-i)$ , (3) i(i+i)$ . Show the content of the stack after each match.
1.
E --> E+T; E--> E-T;E--> T; T-->T*F; T-->T/F; T-->F; F-->i; F->( E)
states
i
$
TQ
TQ
Q
+TQ
-TQ
FR
FR
*FR
/FR
F
i
(E )
Transcribed Image Text:Programming part: Given the following CFG and the Predictive Parsing table. Write a program to trace input strings (1) (i+i)*i$ ,(2) i*(i-i)$ , (3) i(i+i)$ . Show the content of the stack after each match. 1. E --> E+T; E--> E-T;E--> T; T-->T*F; T-->T/F; T-->F; F-->i; F->( E) states i $ TQ TQ Q +TQ -TQ FR FR *FR /FR F i (E )
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Algebra and Trigonometry (6th Edition)
Algebra and Trigonometry (6th Edition)
Algebra
ISBN:
9780134463216
Author:
Robert F. Blitzer
Publisher:
PEARSON
Contemporary Abstract Algebra
Contemporary Abstract Algebra
Algebra
ISBN:
9781305657960
Author:
Joseph Gallian
Publisher:
Cengage Learning
Linear Algebra: A Modern Introduction
Linear Algebra: A Modern Introduction
Algebra
ISBN:
9781285463247
Author:
David Poole
Publisher:
Cengage Learning
Algebra And Trigonometry (11th Edition)
Algebra And Trigonometry (11th Edition)
Algebra
ISBN:
9780135163078
Author:
Michael Sullivan
Publisher:
PEARSON
Introduction to Linear Algebra, Fifth Edition
Introduction to Linear Algebra, Fifth Edition
Algebra
ISBN:
9780980232776
Author:
Gilbert Strang
Publisher:
Wellesley-Cambridge Press
College Algebra (Collegiate Math)
College Algebra (Collegiate Math)
Algebra
ISBN:
9780077836344
Author:
Julie Miller, Donna Gerken
Publisher:
McGraw-Hill Education