Documente Academic
Documente Profesional
Documente Cultură
Homework #1
Due Date: 04 Oct 2018 in class
6. The symbol table generally has an entry for each ... what?
ANS: symbol table is a data structure used by a language translator such as
a compiler or interpreter, where each identifier (a.k.a. symbol) in a program's source code is
associated with information relating to its declaration or appearance in the source. Symbol table
stores the information related about the symbol.
7. What phase is type-checking done in?
ANS: Symantic Analyzer is the Phase where we check the type casting.
14. For each token, the lexer passes 2 pieces of info to the parser. What are they?
____________________________
15. For what types of token would additional information be needed?
ANS: Some Tokens are the additional information like
Add (a, b);
It is a function and the information about the a, b are store but the information about
Add (); not store so it is some additional information and store in the symbol table.
16. Some tokens (like “if”, “while”, “class”) are built into the language. What
are these
tokens called?
ANS: Keywords are a set of words which are used for special purposes while writing a
program. Few examples are: for, while, switch, break, goto, and etc.
21. Can the same ID have more than one meaning in a program?
ANS: The Same Id Have the One Meaning Not More than one Meaning.
22. In a CFG, what does epsilon mean? Please do not say “nothing”.
ANS: Epsilon (ε) is a way to make a zero length sequence visible it is not a grammer
symbol
23. What is the Greek letter for epsilon?
ANS:Epsilon (uppercase Ε, lowercase ε or lunate ϵ; Greek: έψιλον) is the fifth letter of the Greek
alphabet, corresponding phonetically to a mid front unrounded vowel /e/.
24. In a parse tree, the internal nodes correspond to what... Terminals or Non-
terminals?
ANS: The Internal Nodes are Non-Terminal.
30. The expression x-y-z means either (x-y)-z or x-(y-z). This is a question of
operator...
What?
ANS: Yes it is the Question of the Operator.
31. The expression x+y-z means either (x+y)-z or x+(y-z). This is a question of
operator... what?
ANS: Yes it is the Question of the Operator.
32. Is this grammar rule left- or right-recursive?
A→Ab
ANS: It is Not left recursive or right recursive Because in left Recursive we used
“+, *” and in the Right Recursive we used the”=” more than one.
33. What is the input to a parser (in the context of compiling)?
ANS: A parser take the input in the form of sequence of tokens and usually builds a data
structure in the form of parse tree.
37. We can create a parser by constructing a routine for each non-terminal. This
approach is called... what?
ANs: Top Down Recursive Decent Parsing.
ANS: Abstract syntax tree larger is larger than the parse tree.