Eksamen Flashcards
If a language is context-free, is it then regular?
No.
Signs that a language is context-free:
- You can describe it with a PDA.
- You can describe it with a context-free grammar:
E.g. we have the language (c | ɛ) a (c | ɛ) b
(c | ɛ) can be made into a non-terminal called C.
S -> CaCb
C -> c | ɛ
Signs that a language is regular:
- You can describe it with a DFA or a NFA.
- You can describe it with a regular expression.
What can be in Chomsky-normal-form?
All context-free grammars/languages.
Can every:
pushdown-automata
be converted to a
deterministic pushdown-automata?
No.
Signs that a language isn’t regular.
- By using the pumping lemma. (It is hard to do if you don’t know that it isn’t regular) (Often used to prove that it isn’t regular not so much to find out if it isn’t regular)
List the four kinds of scope rules:
- Full Static scope rules
- Full Dynamic scope rules
- Mixed where envV is static and envP is dynamic
- Mixed where envV is dynamic and envP is static
Dynamic scope rules are:
When the environtment from call time is used
Static scope rules are:
When the environtment from declaration time is used
What are the three most common parameter mechanisms?
- Call by value.
- Call by reference.
- Call by name.
What is call/pass-by value?
The actual parameter is evaluated at call time.
E.g.
int func(a) { return a + 1 }
func(2 + 3)
Behind the scenes this happens: a = 5
So the return statement reads return a + 1;
What is call/pass-by reference?
No new variable is declared at call-time, instead the parameter is used directly.
E.g.
int x = 2 + 3;
int func(a) { a = a + 1; }
func(x);
Print(x); // x = 6
What is call/pass-by name?
The parameter passed isn’t evaluated before it is used in the function.
E.g
int func(a) { return a + 1; }
func(2 + 3)
The return statement in the body of func will read
return 2 + 3 + 1
instead of
return a + 1; (call by value).
Which operations are regular languages closed under?
complement (A’),
intersection(A ∩ B),
union(A U B),
concatenation(A o B),
Kleene star A*
What does Σ (Sigma) describe?
It describes an alphabet.
An alphabet is a finite set of symbols.
What is δ? (Delta)
The transition function.
Q x Σ –> Q (describes which state you go to and from with a given input.)