Please Write The Program in (C++, or Python)

Thank you 7. Given the following CFG and the Predictive Parsing table. Write a program to trace an input string given by the user. Save

7. Given the following CFG and the Predictive Parsing table. Write a program to trace an input string given by the user. Save it as Progl. Test your program with the following input strings: (1) (a ta)*a$, (2) a*(a/a)S, (3) a(a+a)$. Show the content of the stack after each match. CFG after removing left-recursion rules E TQ Qо +TQ Q -TQ Given CFG E E+T ЕО Е-Т E T FIRST FOLLOW TO T*F ( ) S) a T OT/F T FR R*FR T F F(E FO a a RO /FR – ) $ / ) $ R F ( a FO(E) F a Predictive parsing table $ states a E TQ TQ +TQ -TQ FR T FR R *FR /FR (E) a LA EOT P



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *