Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following grammar with goal symbol describes a micro-English language of simple sentences with a very limited vocabulary: -> . -> i | A |

The following grammar with goal symbol describes a micro-English language of simple sentences with a very limited vocabulary:

-> .

-> i

| A

| The

-> me

| a

| the

-> cat

| rat

| mat

-> like

| likes

| am

| is

| see

| sees

Some example sentences generated by this grammar are:

The cat sees a rat .

i like the mat .

The cat likes me .

Without changing the BNF above, convert the grammar to an attribute grammar that will disallow sentences like

The cat like the rat . or

i likes the mat .

or

i is the cat .

To do this, define attributes for the grammar symbols and attach attribute rules and predicates to the BNF productions to restrict the language to the set of English language valid sentences. Do not change the BNF.

Type your answer below.

List of attributes with brief descriptions of their meanings:

BNF productions and corresponding semantic rules and predicates:

Write in C++ a recursive descent parser that uses your attribute grammar to check the correctness of sentences of the grammar.

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

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions