Explain what metasymbols are and discuss their use as part of BNF rules.

What will be an ideal response?


The three symbols <, >, and ::= used as part of BNF rules are termed metasymbols. This means that they are symbols of one language (BNF) that are being used to describe the characteristics of another language.In addition to these three, there are two other metasymbols used in BNF definitions. The vertical bar, |, means OR, and it is used to separate two alternative definitions of a nonterminal. This could be done without the vertical bar by just writing two separate rules: ::= "definition 1"
::= "definition 2"

However, it is sometimes more convenient to use the | character and write a single rule:

::= "definition 1" | "definition 2"

For example, the rule

::= + | - | * | /

says that an arithmetic operator is defined as either a +, or a ?2-, or an *, or a /. Without the | operator, we would need to write four separate rules, which would make the grammar much larger. Here is a rule that defines the nonterminal :
::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

The final metasymbol used in BNF definitions is the Greek character lambda, Ë, which represents the null string-nothing at all. It is possible that a nonterminal can be "empty," and the symbol Ë is used to indicate this. For example, the nonterminal can be defined as an optional sign preceding an integer value, such as +7, ?2-5, and 8. To define the idea of an optional sign in BNF, we could say:

::=
::= + | - |?

which says that may be either a + or a -, or it may be omitted entirely.

Computer Science & Information Technology

You might also like to view...

A database ________ organizes information into fields and records

Fill in the blank(s) with correct word

Computer Science & Information Technology

CSS3 added support for the HSL system, which enables you to create colors by specifying values or percentages for hue, ____, and light.

A. settings B. saturation C. shading D. shadows

Computer Science & Information Technology

COGNITIVE ASSESSMENT Which of the following is NOT true about system units?

A. The case on a smartphone often is in front of the display. B. The case on wearable devices typically consumes the entire device. C. On most laptops, the keyboard and pointing device often are on top of the case. D. Desktops that house the display and system unit in the same case are called all-in-one.

Computer Science & Information Technology

What are some of the differences between the file system concept of Linux and that of other operating systems?

What will be an ideal response?

Computer Science & Information Technology