Chapter 7 - Context-Free Grammars Flashcards

1
Q

What is a context-free grammar?

A

A language that is more general than a regular expression, and is made up of these features:
A finite set (N) of nonterminal symbols - nonterminals
A finite set (T) of terminal symbols - terminals
A finite set (P) of productions - production is a sequence of terminal and nonterminal symbols
The start symbol (S)

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

What does left-recursive and right-recursive mean?

A

Left-recursive = A -> Ax
Right-recursive = A -> xA

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

What is a production (in simple terms)?

A

Basically, a chain. You can go from one symbol, to another which it corresponds to. This eventually will generate a valid word that is part of the language

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

What is a linear grammar?

A

Has at most only one nonterminal symbol in its right-hand side.
These linear grammars are always regular languages.

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

What is a derivation tree?

A

A derivation tree is a graphical representation of the process you follow when using a procedure to generate a word.

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

What does ambiguity mean when it comes to derivation trees?

A

Ambiguity means that there are multiple trees which can represent the same word.
It can also mean multiple leftmost or rightmost derivations, which also results in the same word being formed.

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