Table of contents
1.
Introduction
2.
Backus-Naur Form
2.1.
BNF Symbol Representation
2.2.
Syntax
2.2.1.
Example 1
2.2.2.
Example 2
2.2.3.
Example 3
2.2.4.
Example 4
3.
Frequently Asked Questions
3.1.
What does ATL stand for?
3.2.
What is a class data value?
3.3.
Why do we need ATL?
3.4.
List the difference between class and instance.
3.5.
What does the Backus-Naur form do?
4.
Conclusion
Last Updated: Mar 27, 2024

Backus-Naur form (BNF)

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

In computer science, Backus-Naur Form or Backus normal form (BNF), introduced by John Bakus and Peter Naur in 1960, is a meta-language (a language that cannot describe another language) for context-free grammar. 

Backus-Naur Form

BNF is a formal method used for describing the syntax of languages such as computer programming languages, instruction sets, document formats, and communication protocols. 

Let's now explore more about the Backus-Naur form (BNF) and its usage.

Read about Instruction Format in Computer Architecture

Backus-Naur Form

BNF form is a sequence of characters representing metalinguistic variables enclosed in the angular brackets <>. The metalinguistic connectives are the marks "::=" and "|".

BNF Symbol Representation

The scripts used by the ATL(Active Template Library) Registrar use the following notations through BNF(Backus-Naur form) syntax.

Symbol/Convention

Meaning

::=

Equivalent

|

OR ( indicates a choice)

[X]

Here, X is optional.

X+

One or more Xs.

Bold text

A string literal.

Italicized text

Constructing the string literal.

Registrar scripts use string literals, as seen in the table above. These values include text that needs to be included in your script. The string literals used in the ATL Registrar script are listed in the following table.

String literal

Action

ForceRemove It removes the next Key (if it already exists) and then re-creates it.
val It specifies the <Key Name> a named value.
NoRemove It does not remove the next Key during the unregister.
b It specifies that the next value is binary (REG_BINARY).
d It specifies that the next value is a DWORD (REG_DWORD).
m It specifies that the next value is a multi-string (REG_MULTI_SZ).
s It represents that the next value is a string (REG_SZ).
Delete It deletes the next Key during register.

Syntax

A BNF specification is a sequence of derivation rules written as-

<symbol> ::= __expression__

Where:

<symbol> Symbols that appear on the left side are non-terminals (variable) and are always enclosed between the angular brackets <>. Whereas the symbols that never appear on the left side are the terminals. 

::=  As discussed earlier, this convention denotes that the symbol on the left side must be replaced with the expression on the right side.

__expression__  It consists of one or more sequences of either terminal or non-terminal symbols.

Example 1

<registry expression> ::= <Add Key> | <Delete Key>

It specifies that registry expression is equivalent to Add Key or Delete Key.

Example 2

<Key Name> ::= '<AlphaNumeric>+'

It specifies that the Key Name is equivalent to one or more(+) AlphaNumeric values.

Example 3

<AlphaNumeric> ::= any character not NULL

It specifies that AlphaNumeric is equivalent(::=) to any non-NULL character.

Example 4

<Add Key> ::= [ForceRemove | NoRemove | val]<Key Name>

This syntax specifies that Add Key is equivalent to Key Name and that the string literals, ForceRemove, NoRemove, and val, have their own meaning as discussed earlier.

Frequently Asked Questions

What does ATL stand for?

ATL stands for the active template library.

What is a class data value?

Information that is shared by all the instances or aggregate information about the instances is kept in a class data value.

Why do we need ATL?

We need ATL to provide efficient and easy-to-implement COM objects.

List the difference between class and instance.

The class is similar to the blueprint. The Object is a real item that was created using the "blueprint" (like the house). An instance represents an item that is virtual but not a true copy.

What does the Backus-Naur form do?

BNF (Backus-Naur Form) is a context-free grammar commonly used by developers of programming languages to specify the syntax rules of a language. 

Conclusion

In this blog, we have discussed Backus-Naur form symbols and syntax. We also discussed some examples of different string literals used in the syntax.

Check out the following articles to learn more about Backus-Naur Form and ATL classes.

 

To learn more about DSA, competitive coding, and many more knowledgeable topics, please look into the guided paths on Code Studio. Also, you can enroll in our courses and check out the mock test and problems available to you. Please check out our interview experiences and interview bundle for placement preparations.

Happy Coding!

Live masterclass