Question: Given the grammar defined by the following Extended BNF set of production rules: A sample program in this language: Note: (1) The tokens in bold

Given the grammar defined by the following Extended BNF set of production rules: Given the grammar defined by the following Extended BNF set of production

A sample program in this language:

rules: A sample program in this language: Note: (1) The tokens in

Note: (1) The tokens in bold letters are reserved words. (2) Other symbols as they appear in the production rules.

* Write a recursive descent parser for the above grammar.

* Your program will be tested with random programs.

* Your program will be graded according to the correctness, style, and documentation.

Please I need the program written in C (and Python if possible)

= program body S body lib-desi main ( declarations block lib-desi #include ; )* declarations const-deci var-dest const-decl const data-type name value ; )* var-des! ( var data-type name-list - )* name-list name_{, name )* data-type int float name = "user-defined-name" block { stmt-list } stmt-list statement ; statement )* statement ass-stmt inout-stmt if-stmt while-stmt block ass-stmt name exp term add-oper term )* term factor_{ mul-oper factor )* factor exp | 1 value value "float-number" "int-number" add-sign + - mul-sign * 17 % inout-stmt input >> output name-value if-stmt if_bool-exp) statement else-part endif else-part else statement 2 while-stmt while_( bool-exp) { stmt-list } bool-expname-value relational-oper name-value name | value relational-oper exp name name name-vaue #include; #include; main() const float bi=3.14; var int num.count. var float x; {input>>num; if (num !=0) x=bi*2 else x=x*3 endif; output>>x; } $

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!