Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

construct a derivation tree for −109 using the grammar given in Example 15.

Short Answer

Expert verified

The derivation tree of -1 0 9 is

Step by step solution

01

About Backus-Nour form.

A type-2 grammar is designated by the notation known as Backus-Naur form

The left side of a type 2 grammar's production is one non-terminal symbol.

I can merge all of the productions into a single statement using the same left non-terminal symbol \(\to\) rather than listing each one separately in production,

Using the symbol:: =

Enclose all non-terminal symbols in brackets <>, and list all right-hand sides of productions in the same statement, separating them by bars.

02

Using the grammar given in Example 15.

\(G{\bf{ }} = {\bf{ }}\left( {V,{\bf{ }}T,{\bf{ }}S,{\bf{ }}P} \right)\) is the phrase structure grammar described with

\(V{\bf{ }} = {\bf{ }}\left\{ {0,1,2,3,4,5,6,7,8,9 + ,{\bf{ }} - {\rm{signed integer, sign, integer, digit}}} \right\}\)

\(T{\bf{ }} = {\bf{ }}\left\{ { + ,{\bf{ }} - ,{\bf{ }}0,1,2,3,4,5,6,7,8,9} \right\}\),

The initial symbol is a signed integer, and the outputs are

signed integeràsing integer,

sign \(\to\) +,

sign \(\to\) -,

integer \(\to\) digit,

integer \(\to\) digit integer,

digit \(\to\) 0,

digit \(\to\) 1,

…………

…………

digit \(\to\) 9.

Signed integer\(\to\)sign integer

\(\to\)sign (digit integer)

\(\to\)sign digit (digit integer)

\(\to\)sign digit digit digit

\(\to\)- digit digit digit

\(\to\)- 1 digit digit

\(\to\)- 1 0 digit

\(\to\)- 1 09

03

Let’s construct a derivation tree for −109.

Hence, the above derivation tree of -1 0 9.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Find a phrase-structure grammar that generates each of these languages.

\({\bf{a)}}\)the set of bit strings of the form \({{\bf{0}}^{{\bf{2n}}}}{{\bf{1}}^{{\bf{3n}}}}\), where \({\bf{n}}\) is a nonnegative integer

\({\bf{b)}}\)the set of bit strings with twice as many \({\bf{0's}}\) as \({\bf{1's}}\)

\({\bf{c)}}\)the set of bit strings of the form \({{\bf{w}}^{\bf{2}}}\), where \({\bf{w}}\) is a bit string

let \({{\bf{G}}_{\bf{1}}}\) and \({{\bf{G}}_{\bf{2}}}\) be context-free grammars, generating the language\({\bf{L}}\left( {{{\bf{G}}_{\bf{1}}}} \right)\) and \({\bf{L}}\left( {{{\bf{G}}_{\bf{2}}}} \right)\), respectively. Show that there is a context-free grammar generating each of these sets.

a) \({\bf{L}}\left( {{{\bf{G}}_{\bf{1}}}} \right){\bf{UL}}\left( {{{\bf{G}}_{\bf{2}}}} \right)\)

b) \({\bf{L}}\left( {{{\bf{G}}_{\bf{1}}}} \right){\bf{L}}\left( {{{\bf{G}}_{\bf{2}}}} \right)\)

c) \({\bf{L}}{\left( {{{\bf{G}}_{\bf{1}}}} \right)^{\bf{*}}}\)

Construct a deterministic finite-state automaton that recognizes the set of all bit strings that end with 10.

Describe the set of strings defined by each of these sets of productions in EBNF.

\(\begin{array}{c}\left( {\bf{a}} \right){\bf{string :: = L + D?L + }}\\{\bf{L :: = a }}\left| {{\bf{ b }}} \right|{\bf{ c }}\\{\bf{D :: = 0 | 1}}\\\left( {\bf{b}} \right){\bf{string :: = signD + |D + }}\\{\bf{sign :: = + | - }}\\{\bf{D :: = 0 | 1|2|3|4|5|6|7|8|9}}\\\left( {\bf{c}} \right){\bf{string :: = L*}}\left( {{\bf{D + }}} \right){\bf{?L* }}\\{\bf{L :: = x |y }}\\{\bf{D :: = 0 | 1}}\end{array}\)

Let \({\bf{G = }}\left( {{\bf{V, T, S, P}}} \right)\) be the context-free grammar with \({\bf{V = }}\left\{ {\left( {\bf{,}} \right){\bf{S,A,B}}} \right\}{\bf{, T = }}\left\{ {\left( {\bf{,}} \right)} \right\}\) starting symbol \({\bf{S}}\), and productions

Show that \({\bf{L}}\left( {\bf{G}} \right)\) is the set of all balanced strings of parentheses, defined in the preamble to Supplementary Exercise \(55\) in Chapter \(4\).

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free