Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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: image text in transcribed

A sample program in this language:

image text in transcribed

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 using CodeBlocks

= 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions