SYNTAX ANALYSIS
TOP DOWN AND BOTTOM UP PARSING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Syntax tree
|
|
Parse tree
|
|
DAG
|
|
Annotated tree
|
Detailed explanation-1: -The output of this phase is a parse tree. This way, the parser accomplishes two tasks, i.e., parsing the code, looking for errors and generating a parse tree as the output of the phase. Parsers are expected to parse the whole code even if some errors exist in the program.
Detailed explanation-2: -The output from the parser is assumed to be a representation of the parse tree (example shown above) for the stream of tokens produced by the scanner. There are many approaches to parsing, including both top-down and bottom-up approaches, as well as using leftmost or rightmost derivation.
Detailed explanation-3: -Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term parsing comes from Latin pars (orationis), meaning part (of speech).