Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COMPILER CONSTRUCTION Given the grammar defined by the following set ofproduction rules in the EBNF module-declaration module . module module-heading declarations compound-stmt module-heading module name

image text in transcribed

COMPILER CONSTRUCTION
Given the grammar defined by the following set ofproduction rules in the EBNF module-declaration module "." module module-heading declarations compound-stmt module-heading module "name" ";" declarations const-decl var-decl task-decl const-decl const (const-item ";" )+ 1 const-item "name" "integer-value" var-decl var (var-item ".") var-item name-list ":" i name-list "name" ("," "name") task-decl task-heading declarations nteger task-heading-> task "name" ";" compund-stmt begin stmt-list end stmt-list ( statement "." ) statement ass-stmt l inout-stmt | stmt l while- ass-stint "name" ":-'' arith-exp arith-exp term (add-sign term) term factor (mul-sign factor ) factor"(" arith-exp")" I name-value name-value "name" "integer-value" add-sign "+" "-" mul-sign "*" | 7" inout-stmt input "(" "name" ")" 1 out "(" name-value if-stmt if bool-exp then statement else-part fi else-part else statement | while-stmt while bool bool-exp name-value relational-oper name-value stmt | compound-stmt | ")" -exp do statement Notes: (1) The tokens in bold letters are reserved words. (2) The words between " are terminals (terminal tokens). Write a recursive descent parser for the above grammar using C programming language, By using CodeBlock

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_2

Step: 3

blur-text-image_3

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions