4.4.3.1 Backus-Naur Form (BNF)/syntax diagrams Flashcards Preview

Computing Theory > 4.4.3.1 Backus-Naur Form (BNF)/syntax diagrams > Flashcards

Flashcards in 4.4.3.1 Backus-Naur Form (BNF)/syntax diagrams Deck (4)
Loading flashcards...
1
Q

What is BNF?

A

notation for describing a set of rules of a regular language.
one method of defining syntax of a language

2
Q

Why is BNF used over regular expressions?

A

Some languages cannot be defined by regular expressions, because it doesn’t allow recursion
BNF allows representations of a wider range of languages,

3
Q

Describe one example of why a syntactically correct loop may still produce an error when a program is compiled.

A

Variable may not have been declared;
Variable may be of inappropriate type;
Position of statement within program may be invalid;
Rightmost integer may be a lower value than the leftmost one;
One of the numbers / limits may be outside of the range of valid integers

4
Q

Explain why recursion has been used in this production rule.

A

Can contain any number of _
BNF does not support iteration / looping // BNF can only achieve iteration through recursion // would need infinite number of rules otherwise

Decks in Computing Theory Class (102):