ICD2 - Parsing Flashcards

1
Q

The central idea of context-free grammars is to define a language by productions. These productions say that a nonterminal symbol can be replaced by ANSWER.

A

a sequence of terminals and nonterminals

a sequence of symbols

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

The specific type of grammar that was the main focus of the portion of the Syntax Analysis chapter that was assigned was ANSWER.

A

LL(1)

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

In a context-free grammar, the nonterminal that derives an entire member of the language being defined is called ANSWER.

A

a start symbol

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

Using the context-free grammar based on the two rules A -> b A and A -> b, ANSWER would be the derivation sequence for bbb.

A

A => Ab => Abb => bbb

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

ANSWER is the regular expression that corresponds to the language defined by the context-free grammar with the three rules A -> A a, A -> A b, A -> a.

A

a (a | b)*

That’s the bar, not a letter in between

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

ANSWER would be the derivation of ((1)) in the language defined by the context-free grammar consisting of the two rules E -> ( E ) and E -> 1.

A

E => (E) => ((E)) => ((1))

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

ANSWER are two derivations of the string cc that produce distinct syntax trees from the context-free grammar X -> X c Y , Y -> X, Y -> and X -> .

A

X => XcY => XcYcY => cYcY => ccY => cc
AND
X => XcY => XcX => XcXcY => cXcY => ccY => cc

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

When a grammar can produce two distinct syntax trees for the same string, the grammar is said to be ANSWER.

A

ambiguous

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

If I wanted to fix the grammar E -> E + E and E -> id, so that it would only produce one syntax, which is left recursive, the new grammar would be ANSWER.

A

E -> E + F and E -> F and F -> id

E -> E + F and E -> id and F -> id

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

One aspect of the if then else end syntax of Ruby is that it avoids the ANSWER problem.

A

dangling else

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

In the context-free grammar A -> B A , B -> A B, A -> B, A -> a, B -> b, and B -> the value of Nullable(A) is ANSWER.

A

true

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

In the context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> the value of Nullable(A) is ANSWER.

A

false

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

In the context-free grammar A -> B A , B -> A B, A -> B, A -> a, B -> b, and B -> the value of FIRST(A) is ANSWER.

A

{a,b}

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

In the context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> the value of FIRST(A) is ANSWER.

A

{a,b}

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

In the context-free grammar A -> B A , B -> A B, A -> B, A -> a, B -> b, and B -> the value of FOLLOW(A) is ANSWER.

A

{a,b}

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

In the context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> the value of FOLLOW(A) is ANSWER.

A

{b}

17
Q

The context-free grammar A -> B A , B -> A B, A -> a, B -> b, B -> is not LL(1) specifically because ANSWER.

A

FIRST(BA) and FIRST(a) both include a, so we do not know which A rule to use

18
Q

When you write a parser for a context-free grammar that satisfies the LL(1) criteria by representing each non-terminal by a function that chooses what functions to invoke by the LL(1) criteria, this sort of parser is called ANSWER.

A

a recursive descent parser

19
Q

Programming languages that view programming as describing a step-by-step process to do something are called ANSWER languages.

A

imperative

20
Q

Programming languages that view programming as describing characteristics of the problem domain and characteristics of the solution and leaving it to the language processor to find a solution are called ANSWER languages.

A

declarative