327 views
5 5 votes

Consider a Bottom-Up parser for a grammar $G$. During the parsing of an input string $w$, the parser reaches a configuration where the stack contains the prefix $\alpha$ and the remaining input is $a x$. If the parser decides to perform a 'Reduce' action using the production $A \rightarrow \beta$, which of the following must be TRUE?

  1. $a$ IS THE FIRST SYMBOL OF $\beta$
     
  2. THE PARSER IS GUARANTEED TO BE AN $\operatorname{LR}(0)$ PARSER
     
  3. $\alpha$ IS A SUFFIX OF $\beta$
     
  4. $\beta$ IS A SUFFIX OF $\alpha$

2 Answers

1 1 vote

Given Situation

  • Stack contains: α
  • Input remaining: ax
  • Parser performs: A→β

so stack will contain αnβ where n is number 
so β is a suffix of α
hence option D is correct

Answer:
Position:
Show:

Related questions

2 2 votes
3 3 answers
614
614 views
GO Classes asked Feb 4
614 views
A lexical analyzer is designed for a new language with the following rules for token generation:$\mathrm{KEYWORD1}: \verb|if|$ $\mathrm{KEYWORD2}: \verb|iff|$ $\mathrm{ID...
2 2 votes
5 5 answers
599
599 views
GO Classes asked Feb 4
599 views
Consider the following arammar $G$ :$$\begin{aligned}& S \rightarrow(L) \mid a \\& L \rightarrow L, S \mid S\end{aligned}$$Which of the following statement(s) is/are TRUE...
2 2 votes
2 2 answers
338
338 views
GO Classes asked Feb 4
338 views
Which of the following statement(s) is/are TRUE regarding Lexical Analysis and Regular Expressions?The number of states in a minimal Deterministic Finite Automaton (DFA) ...
1 1 vote
2 2 answers
324
324 views
GO Classes asked Feb 4
324 views
Consider the following Syntax Directed Translation (SDT) scheme where $S$ is the start symbol and $id.\mathrm{val}$ represents the numerical value of an identifier:$$\beg...