Group 4&5 Activity Syntax Analyzer
Group 4&5 Activity Syntax Analyzer
Group 4&5 Activity Syntax Analyzer
Bottom-up parsing:
TOP-DOWN PARSING
I. The role of the parser and Context Free Grammar
TRUE or FALSE
___________ 1. Semantic error are type mismatches between operators and operands.
___________ 2. Any language that can be generated using regular expressions can be generated by a
context-free grammar.
___________ 3. Logical errors can be anything from incorrect reasoning on the part ot the programmer to
use in a program.
___________ 4. Any languages that can be generated by a context-free grammar can also be generated
by any regular expression.
___________ 5. Parse trees have leaves labeled with non-terminals; interior nodes labeled with
terminals.
___________ 6. Cocke-Younger-Kasami and Earleys algorithm are under bottom-up parsing.
___________ 7. A language that can be generated by a grammar is said to be a context-free language. If
two grammars generate the same language, the grammars are said to be equivalent.
___________ 8. E->TE, E->+TE|e, T->FT, T-> *FT|e, F-> ( E )|id. It is an example of bottom-up
parsing.
___________ 9. A derivation is a sequence of sentential forms starting from start symbol.
___________ 10. There are three general types parser for grammars
BOTTOM-UP PARSING
I. Identification
1. It is the reverse of derivation. Thus, aiming to reach the start symbol from the yield of
the grammar.
2. A bottom-up parser traces a in reverse.
3. The general method of bottom-up parsing.
4. Four primary operations/actions of the bottom-up parser.
5. Continuation of 5
6. Continuation of 6
7. Continuation of 7
8. Once the token string is divided, the left substring could be implemented by means of
a
9. It is a form of reduction that allows further reductions back to the start symbol.
10. This is the prefix part of a handle
III.
( E )
int
IV.
Tracing:
BOTTOM-UP PARSING
I. Identification
1. Reduction 6. Accept
2. Rightmost derivation 7. Error
3. Shift-reduce parsing 8. Stack
4. Shift 9. Handle
5. Reduce 10. Viable prefix
III. Explain
1. It is caused when the grammar allows a rule to be reduced for particular token, but, at the
same time, allowing another rule to be shifted for that same token.
2. A reduce/reduce conflict occurs if there are two or more rules that apply to the same
sequence of input
Parse tree: