Theory Flashcards

1
Q

How can we classify a regular language?

A

Language is called regular if it can be generated by a regular expression

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

Every finite language is regular

True or false

A

True

Because it is the union of finitely many strings

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

When does a regular expression is ambiguous?

A

A regular expression is ambiguous if the corresponding marked regular expression generates two marked strings, such that if the indices are removed, the unmark strings obtained are identical

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

When a language is said to be closed?

A

A language is said to be close with respect to an operator (union, star, intersection), if the result language belongs to the same family as the operand language

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

List the operators the regular language family is closed with respect to

A

Concatenation , union, and star.

Therefore, the regular languages are also closed with respect to the derived operators, cross, repetition, option, nationality, etc.

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

When is a grammar considered to be in its reduced form?

A

A grammar is in reduced form if both the following conditions hold:

  • Every nonterminal A is reachable from the axiom
  • Every nonterminal A generates a nonempty to set of strings
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List the operators the free language family is closed with respect to

A

The family of free languages school with respect to this language operations, union, concatenation, star, and intersection.The LIB family is also closed with respect to string mirroring.

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

How do we obtain the mirror grammar of a language?

A

It obtained by mirroring the right member of every rule of the former grammar

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

When do we consider a grammar to be ambiguous?

A

If it admits two or more different synthetic trees (two different derivations). A grammar is said to be ambiguous if it generates at least an ambiguous string

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

What are the extended free grammar?

A

Extended BNF or EBNF, are grammars in which the right side of the rules are composed by regular expressions. They closure is the same as the free language family (LIB)

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

What is the method to convert an automata to a regular expression?

A

The BMC method, also known as node elimination method

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

What are the automata characteristics in order to be able to apply the BMC method?

A

The initial and final states must be uniques

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

How does the BMC method works?

A

It eliminate node by node adding compensation arcs to preserve the equivalence of the automata

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

How can we transform a non-deterministic automaton into deterministic one

A

By eliminating the spontaneous moves and the nondeterministic multiple transitions

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

What is the Berry-Sethi method (BS)?

A

It is in methods to turn a regular expression into a finite state automanton

It also can be used to determinize a non-deterministic automaton

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

Can the BS algorithm be used to determinize a nondeterministic automaton with spontaneous moves?

A

Yes, it can. You just need to skip over these spontaneous transitions.

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

What is the relationship between free languages and push down automata

A

The family of context-free languages coincides with that off the languages recognized by the one-state, non-deterministic push down automata

18
Q

What are the steps taken by a syntax analyzer when parsing a grammar

A

First, it reads the source string then, if the string belongs to the language, it exhibits a derivation or builds a syntax three of the string. Else it stops and notifies the error, possibly with a diagnostic

19
Q

What are the types of derivations or syntax trees formations a syntax analyzer can execute

A

A bottom up analysis which starts on the leaves and goes to the root, and a top down analysis which starts from the root and goes to the leaves

20
Q

What are the conflicts that in determines the pilot graph?

A

Shift-reduce conflict, reduce-reduce conflict, and convergence conflict

21
Q

Define the shift-reduce conflict

A

It happens when there is a reduction item with look ahead that overlaps with the terminal symbols on the outgoing arcs. This way, the push down automata is unable to choose shift or reduction.

22
Q

Define the reduce-reduce conflict

A

Two or more reduction items with look ahead that overlaps

PDA is unable to choose which reduction

23
Q

Define the convergence conflict

A

The convergence conflict occurs when there are two or more paths that merge into one state with non disjoint look ahead

24
Q

Define multiple transition in a pilot graph

A

A state has a multiple transition if it contains two or more items that their two or more next stages are defined for a single symbol (terminal or non-terminal)

A multiple transition can be convergent or not depending on the next stages of both items, if it is equal, then they are convergent

25
Q

When does a multiple transition have a conflict?

A

When it is multiple and the intersection between the look ahead groups isn’t empty

26
Q

Define the Early Parsing Algorithm

A

The algorithm starts by placing the initial state in the E[0] and calculating the closure on it. Every terminal shift maintains the pointer equal to the state that originates the new one, also it is necessary to keep calculating the closure on the new states. The nonterminal shifts are made when there are final states and they are represented as closure sets. To represent them also, you need to verify the origin of the machine you are in and the next state you are going to after completing the computation of such a machine. You also have to evaluate “j” such that it places the new state in the right group of computation denoted by the pointer.

27
Q

When does a grammar is ELL(1)?

A

When it does not have any left, most recursive derivations

When it’s pilot graph satisfies the ELR (1) conditions

When its pilot graph does not have any multiple transitions

28
Q

What are the static flow analysis used for?

A

Static flow analysis is a technique widely employed by compilers to translate high-level source programming into machine code

29
Q

When is a variable alive?

A

A variable is live at a point P, if the program control flow graph has a path from point P to another point Q and both conditions below hold

  • The path does not pass through any instruction that defines the variable
  • instruction Q uses the variable

Informally a variable is live at a point P, if some instruction that sooner or later can be executed starting from P uses the value, the variable happens to have point P

30
Q

What is livevness interval?

A

They are the states that are between two stages where given variables alive

31
Q

What is the flow equation method?

A

It is a method that examines the existence of some path that connects the point where the variable under examination is defined to the point where it is used

32
Q

What are the equations of the flow equation method?

A

The variables live in P are equal to the variables used in P plus the variables there are live out of P minus the ones defined in P

The variables live out of P are equal to the sum of the variables live in the successors nodes

33
Q

How can we use flow equation methods for memory location?

A

If two variables are not simultaneously live, they do not interfere and can be allocated in the same register or memory location

34
Q

When is a definition useless?

A

An instruction that defines a variable is useless if the variable is not live on at least one outgoing arc ofthe instruction

35
Q

What is the reaching definition assignment?

A

Analysis of the variable definitions, assignments that reach the points (instructions) of the program

36
Q

When does a definition of a variable reaches the input of an instruction?

A

A Definition of a variable reaches the input of an instruction if there is a path from the initial defining stage to the aimed one that do not contains another definition of that given variable

37
Q

When does a note supres variable?

A

If a note defines a variable, then every other definition of the same variable in some note, is sayed to be suppressed by P

38
Q

What are the formula of the reaching definition?

A

Variables out of P are equal to the ones defined in it, plus the ones that enter in it minus the ones that are suppressed in it

Variables that are in a P state are equal to the union of the variables that are out of the predecessors of P

39
Q

What are the types of attributes in a attribute grammar?

A

Left and right

40
Q

What are one sweep semantic evaluators?

A

Those that access each node only once

41
Q

What are the existence conditions of one sweep grammar?

A

Graph dependency is loop free

Graph dependency does not contain any pair from a left attribute to a right attribute in single node

Graph does not contain any ark from the left attribute, associated with a parent note, to any right attribute associated with child node

Brother graph is loop free as well

42
Q

How is the brother graph obtained?

A

Procedures only the right non terminals, and represents in a general overview, the dependencies of the attributes