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

Give production rules in Backus–Naur form that generate all identifiers in the C programming language. In ‘C’ an identifier starts with a letter or an underscore (_) that is followed by one or more lowercase letters, uppercase letters, underscores, and digits.

Several extensions to Backus–Naur form are commonly used to define phrase-structure grammars. In one such extension, a question mark (?) indicates that the symbol, or group of symbols inside parentheses, to its left can appear zero or once (that is, it is optional), an asterisk (*) indicates that the symbol to its left can appear zero or more times, and a plus (+) indicates that the symbol to its left can appear one or more times. These extensions are part of extended Backus–Naur form (EBNF), and the symbols?, *, and + are called metacharacters. In EBNF the brackets used to denote nonterminal are usually not shown.

Short Answer

Expert verified

Backus-Naur form

<Identifier> ::==<letterorus><string>

<letterorus> ::==<lcletter>|<ucletter>|_

<String> ::==<symbol>|<symbole><string>

<Symbol> ::==<lcletter>|<ucletter>|_|<diigits>

<Digits>: ==0|1|23|4|5|6|7|8|9

<Lcletter> ::==a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v| w |x | y| z

<Ucletter>::==A | B | C | D | E | F | G | H | I | J | K| L | M| N| O |P | Q |R | S |T | U | V | W |X | Y | Z

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

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

01

About Backus-Nour form

The Backus-Naur form could be a notation for specifying a kind 2 grammar.

Productions during a type 2 grammar have one non-terminal symbol on the left.

Rather of listing all the productions separately, we will merge all those with the identical non terminal symbol on the left-hand side into one statement rather than using the symbolàin a very production,

we use the symbol:: =

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

02

Find the result

Backus-Naur form

<Identifier> ::==<letterorus><string>

<letterorus> ::==<lcletter>|<ucletter>|_

<String> ::==<symbol>|<symbole><string>

<Symbol> ::==<lcletter>|<ucletter>|_|<diigits>

<Digits>: ==0 |1 | 2| 3 | 4| 5 | 6 | 7 | 8 |9

<Lcletter> ::==a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v| w |x | y| z

<Ucletter>::==A | B | C | D | E | F | G | H | I | J | K| L | M| N| O |P | Q |R | S |T | U | V | W |X | Y | Z

Therefore, this can be the require Back-Naur form.

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

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