4.4.3 - ToC (Context-Free Languages) Flashcards

1
Q

What is Backus-Nour Form

A

A formal, mathematical way of defining syntax unambiguously

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does BNF consist of

A

Terminal Symbols
Production Rules
Non-Terminal Symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are terminal symbols/elements

A

Elements that cannot be broken down anymore e.g, a letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are non terminal symbols or elements

A

Elements that are defined by constants (i.e. can’t be divided into other elements)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do context free languages work

A

Context-free languages describe which strings are and are not
possible in a language by laying out production rules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are production rules

A

A production rule is a statement that allows for one values to be replaced by another valid one e.g a –> aa (a can be replaced by aa)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a recursive statement in BNF

A

Where a statement is defined in terms of itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When is recursion used in BNF

A

It is used as a sort of while loop when you dont know the specific length a value will take

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What can BNF do that Regex cant

A

Represent languages that involve recursion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is meant by this symbol:
<>

A

Represents a syntactic item of the language (basically a data type)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is meant by this symbol:
::=

A

“Is defined by”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are 2 other ways that BNF can be represented

A
  • Syntax Diagrams 1:1
  • Parse Trees
How well did you know this?
1
Not at all
2
3
4
5
Perfectly