search
Log In

Recent questions tagged parsing

1 vote
1 answer
1
Find First and Follow of the given grammar $S \rightarrow aSa | bSb|A$ $A \rightarrow aBb$ $B \rightarrow aB|bB|\epsilon$
asked Feb 1, 2018 in Compiler Design Mk Utkarsh 432 views
0 votes
1 answer
2
3 votes
2 answers
3
1 vote
1 answer
4
The power of parsers is as follows: CLR(1) > LALR(1) > SLR(1) > LR(0) > LL(1) Can we say that if a language is not parsed by powerful parser then less powerful parsers can't parse that language? Likewise, if a language can be parsed by less powerful ... it be parsed by all powerful parsers than that? Is there a formal proof for the above two questions? How to compare SLR and LALR parser formally?
asked Jan 25, 2018 in Compiler Design Chiranjeevi Kanaka 1k views
1 vote
2 answers
5
Consider the grammar given S->AA A->aA / b How many entries will be blank in the GOTO table for SR(0) items? What is the meaning of SR(0) items?
asked Jan 25, 2018 in Compiler Design Avdhesh Singh Rana 203 views
1 vote
0 answers
6
Consider the following grammar G: The grammar G is A. LL (1) grammar and not LR (0) B. LL (1) and LR (0) C. Not LL (1) but LR (0) D. Neither LL (1) nor LR (0) Here B should be correct option?
asked Jan 24, 2018 in Compiler Design rahul sharma 5 103 views
1 vote
1 answer
7
Since it is a Bottom Up Parser do we need to evaluate expressions following Right Hand Derivations or Left Hand Derivations,i.e. should we evaluate D -> d first or B -> B first?
asked Jan 23, 2018 in Compiler Design vishal chugh 283 views
1 vote
1 answer
8
Options given A. LL (1) grammar and not LR (0) B. LL (1) and LR (0) C. Not LL (1) but LR (0) D. Neither LL (1) nor LR (0) Answer given is option D. I believe answer should be option (B). Please help.
asked Jan 21, 2018 in Compiler Design nishitshah 213 views
2 votes
1 answer
9
Consider the grammar : $S\rightarrow SS+ | SS* | a$ Which of the following is true: A) SLR(1) but not LL(1) B) LALR(1) but not SLR(1) C) LR(1) but not LALR(1) D) Neither LL(1) nor LR(1) I feel the grammar is unambiguous as I couldn't get more ... any inputs I tried. (Their key is suggesting the answer D saying it's ambiguous) Shouldn't A be the answer? Please guide me and correct me if I'm wrong
asked Jan 20, 2018 in Compiler Design Deepak Shinde 287 views
2 votes
1 answer
10
Which of the following statements is correct? (A) For any context free grammar there is a parser that takes at most O(n2) to parse a string for n terminals. (B) Recursive descent method can't be used to both parse and implement syntax-directed translation. (C) Software tools for generating parsers directly from grammars often use top-down methods. (D) None of the above.
asked Jan 20, 2018 in Compiler Design Mk Utkarsh 213 views
2 votes
1 answer
11
S $\rightarrow A$ A $\rightarrow AB/$\epsilon$ B $\rightarrow aB/b$ is this grammar LALR(1) ?
asked Jan 19, 2018 in Compiler Design Mk Utkarsh 133 views
3 votes
1 answer
13
If a grammar is LL(1) then it would be definitely CLR(1) i.e. LR(1) or LALR(1)
asked Jan 18, 2018 in Compiler Design mohit kumar 5 177 views
1 vote
0 answers
14
2 votes
1 answer
15
What is Abstract Syntax Tree(AST)? Difference between AST and parse tree?At which phase of compiler such trees are created? Who is the condensed form of whom?
asked Jan 14, 2018 in Compiler Design ankit_thawal 128 views
1 vote
1 answer
16
According to my understanding, we LALR is constructed by reducing LR(1) automaton states. So I think it should be LR(1) However, we construct SLR(1) items from the LR(0) automaton, and we say with surety that number of states in SLR(...) is equal to number of states in LALR(...), how can this be?
asked Jan 13, 2018 in Compiler Design vaibhav101 347 views
2 votes
1 answer
17
Code optimization is in syllabus or not . like dead code elimination ..... loop inveriant
asked Jan 11, 2018 in Compiler Design Nitesh Choudhary 100 views
1 vote
1 answer
18
Consider the below given grammar: A→AA+ A→a Consider the below given statements: S1: The grammar is not LL(1). S2: The grammar is CLR(1) but not LALR(1). S3: The grammar is ambiguous. S4: The grammar is LALR(1) as well as CLR(1). Choose the correct option:( Marks: ... mber of states in LALR(1) is 5. Only S1 and S2 are correct. Answer given is option (3). But I cant understand why S3 is incorrect.
asked Jan 10, 2018 in Theory of Computation ankit_thawal 110 views
1 vote
0 answers
19
Consider the following grammar: $S \rightarrow A$ $S \rightarrow xb$ $A \rightarrow aAb$ $A \rightarrow B$ $B \rightarrow x$ The average length of the stack used while parsing the string "axb$" using LR(1) parser is _________. I am getting 5, but answer is 2.5.
asked Jan 7, 2018 in Compiler Design Shubhanshu 163 views
3 votes
1 answer
20
If operator precedence parser can parse ambiguous grammar so why don't we use this parser all the time, Why should we care about all the parsers just use this.
asked Jan 4, 2018 in Compiler Design The Technical Guy 375 views
2 votes
3 answers
21
Check whether this grammar is LL(1) or not?
asked Jan 4, 2018 in Compiler Design The Technical Guy 207 views
1 vote
0 answers
22
2 votes
0 answers
23
Consider the grammar with the following productions. S→aaB/aaC B→b C→c Which of the following option is true ? (A) The grammar is LL(3) (B) The grammar is LL(1) (C) The grammar is LL(2) (D) It can’t be LL(k) grammar for any k, as it contains left factoring.
asked Dec 31, 2017 in Compiler Design ankitgupta.1729 1.2k views
1 vote
1 answer
25
if a Grammer is LR(0) then will it always be a CLR(1) and LALR(1)
asked Dec 31, 2017 in Compiler Design The Technical Guy 199 views
0 votes
1 answer
26
$S \rightarrow aBA$ $A \rightarrow \epsilon$ $B \rightarrow a$ Here in the given grammar, what will be the look ahead of B's production:- $S \rightarrow a.BA , \$ $ $B \rightarrow .a \text{ , X}$ What will come at the place of X, I think it should be "\$", As $ A \rightarrow \epsilon$, So, B's lookahead should be \$. right?
asked Dec 27, 2017 in Compiler Design Shubhanshu 142 views
0 votes
0 answers
27
A)LL(k) grammar has one to one correspondence to DCFL B)LR(k) grammar has one to one correspondence to CFL Which one is true?
asked Dec 26, 2017 in Compiler Design srestha 94 views
0 votes
1 answer
28
The grammar $A\rightarrow AA|\left ( A \right )|\epsilon$ is not suitable for predictive parsing because the grammar is (A) Ambiguous (B) Left Recursive (C) Right Recursive (D) an operator grammar
asked Dec 25, 2017 in Compiler Design srestha 311 views
0 votes
1 answer
29
S-> Aa A-> Ab A-> c Which of the following item is present in LR(1) item with S'->. S, $ a) A->. Ab,$ b) A->. Ab,a c) A->. Ab,a/b d) None
asked Dec 23, 2017 in Theory of Computation Neeraj Mehta 96 views
...