Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) The syntax of a simple Reverse Polish programming language includes the following EBNF grammar rules. begin{tabular}{ll} E::=LIT(n)VAR(V)EE+EEEE B: & E=E=E> S::=EVAR(V)B I

image text in transcribed

a) The syntax of a simple "Reverse Polish" programming language includes the following EBNF grammar rules. \begin{tabular}{ll} E::=LIT(n)VAR(V)EE+EEEE \\ B: & E=E=E> \\ S::=EVAR(V)B I IF S ENDIF | REPEAT S B UNTIL \\ \hline \end{tabular} where n is any number and v is any identifier. (i) Translate the grammar rules into regular context-free production rules of the form [5%] cc1,c2,,cn. (ii) Parse the following string using this grammar, showing your answer as a parse tree. [8\%] REPEATVAR(x)LIT(2)VAR(x)VAR(x)LIT(0)>UNTIL (iii) Draw the Abstract Syntax Tree (AST) that can be derived from the parse tree you [8\%] gave in answer to part (ii) of this question. b) Suggest how the grammar given in part (a) of this question might be changed to allow [4\%] statement blocks, so that a sequence of statements can be formed into a new statement

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

Explain all drawbacks of application procedure.

Answered: 1 week ago