lOMoARcPSD|16248954
SPCC Viva Answers:
Annotated parse tree
AN ANNOTATED PARSE TREE is a parse tree showing the values of the attributes
at each node. The process of computing the attribute values at the nodes is called
annotating or decorating the parse tree.
Lexical error
During the lexical analysis phase this type of error can be detected.
Lexical error is a sequence of characters that does not match the pattern of any
token. Lexical phase error is found during the execution of the program.
Imp diagram for parser
1. Macro def table (MDT)
, lOMoARcPSD|16248954
2. What is literal, symbol
Symbols- A symbol has a value and a symbol type, each of which is
either specified explicitly by an assignment statement or implicitly from
context.
3. Lexical, Syntax Analysers
Lexical Analyser:
First phase of a compiler. It is also called a scanner.
Main task: read the input characters and produce as output a sequence of tokens.
Input: program as a single string of characters. Collects characters into logical
groupings and assigns internal codes to the groupings according to their structure.
Groupings: lexemes
Internal codes: tokens
Syntax Analyser:
The syntax analyzer or parser must determine the structure of the sequence of
tokens provided to it by the scanner. Check the input program to determine whether it
is syntactically correct. Produce either a complete parse tree of at least trace the
structure of the complete parse tree .
Two categories of parsers :
Top-down: produce the parse tree, beginning at the root down to the leaves.
Bottom-up: produce the parse tree, beginning at the leaves upward to the root.
4. Operator precedence Parser
, lOMoARcPSD|16248954
5. What is 1 in LL1?
The number of instructions in its look ahead that are required for parsing.
6. What is LR parser
Pg 5-119 tech knowledge
A bottom up parser which parses the grammar from left to right using rightmost
derivation in reverse direction. If LR(0) then has 0 look ahead symbols
7. What is code generation
8. What is Context Free Grammar?
9. What is an assembler?
10. What is one pass and 2 pass assembler?
, lOMoARcPSD|16248954
11. What is semantic analysis?
A parser constructs parse trees in the syntax analysis phase. The plain parse-tree
constructed in that phase is generally of no use for a compiler, as it does not carry
any information of how to evaluate the tree. The productions of context-free
grammar, which makes the rules of the language, do not accommodate how to
interpret them. Semantic analysis ensures that the declarations and statements of a
program are semantically correct, i.e their meaning is clear and consistent with the
way in which control structures and data types are supposed to be used. Semantic
analyzer takes the output of syntax analyzer and produces another tree.
The semantic analyzer produces an annotated syntax tree as an output.
12. Which tables are used in pass1 and pass2 of an assembler? Databases for
pass 1 and 2
SPCC Viva Answers:
Annotated parse tree
AN ANNOTATED PARSE TREE is a parse tree showing the values of the attributes
at each node. The process of computing the attribute values at the nodes is called
annotating or decorating the parse tree.
Lexical error
During the lexical analysis phase this type of error can be detected.
Lexical error is a sequence of characters that does not match the pattern of any
token. Lexical phase error is found during the execution of the program.
Imp diagram for parser
1. Macro def table (MDT)
, lOMoARcPSD|16248954
2. What is literal, symbol
Symbols- A symbol has a value and a symbol type, each of which is
either specified explicitly by an assignment statement or implicitly from
context.
3. Lexical, Syntax Analysers
Lexical Analyser:
First phase of a compiler. It is also called a scanner.
Main task: read the input characters and produce as output a sequence of tokens.
Input: program as a single string of characters. Collects characters into logical
groupings and assigns internal codes to the groupings according to their structure.
Groupings: lexemes
Internal codes: tokens
Syntax Analyser:
The syntax analyzer or parser must determine the structure of the sequence of
tokens provided to it by the scanner. Check the input program to determine whether it
is syntactically correct. Produce either a complete parse tree of at least trace the
structure of the complete parse tree .
Two categories of parsers :
Top-down: produce the parse tree, beginning at the root down to the leaves.
Bottom-up: produce the parse tree, beginning at the leaves upward to the root.
4. Operator precedence Parser
, lOMoARcPSD|16248954
5. What is 1 in LL1?
The number of instructions in its look ahead that are required for parsing.
6. What is LR parser
Pg 5-119 tech knowledge
A bottom up parser which parses the grammar from left to right using rightmost
derivation in reverse direction. If LR(0) then has 0 look ahead symbols
7. What is code generation
8. What is Context Free Grammar?
9. What is an assembler?
10. What is one pass and 2 pass assembler?
, lOMoARcPSD|16248954
11. What is semantic analysis?
A parser constructs parse trees in the syntax analysis phase. The plain parse-tree
constructed in that phase is generally of no use for a compiler, as it does not carry
any information of how to evaluate the tree. The productions of context-free
grammar, which makes the rules of the language, do not accommodate how to
interpret them. Semantic analysis ensures that the declarations and statements of a
program are semantically correct, i.e their meaning is clear and consistent with the
way in which control structures and data types are supposed to be used. Semantic
analyzer takes the output of syntax analyzer and produces another tree.
The semantic analyzer produces an annotated syntax tree as an output.
12. Which tables are used in pass1 and pass2 of an assembler? Databases for
pass 1 and 2