Question

1) Please explain why an LL(1) parser is a linear-time, linear-space parser. 2) Please explain why...

1) Please explain why an LL(1) parser is a linear-time, linear-space parser.

2) Please explain why an LR(1) parser is a linear-time, linear-space parser.

Homework Answers

Answer #1

LL(1) Parsing:
The 1st L represents that the scanning of the Input will be done from Left to Right manner and second L shows that in this Parsing technique we are going to use Left most Derivation Tree. and finally the 1 represents the number of look ahead, means how many symbols are you going to see when you want to make a decision.

An ambiguous grammer cannot be LL(1) grammer.

When a syntax has LL(1) conflicts, a choice between two alternatives can arise during parsing which can not be resolved given a single token of lookahead. Existence of LL(1) conflicts is formalised by the set of inductive rules presented . Informally, LL(1) conflicts arise in three cases: 1) Both branches of a disjunction are nullable, which means that two potentially different values are associated with the empty string by the disjunction. 2) Branches of a disjunction have non-disjoint first sets, so both branches can accept a sequence starting with the same token. Given a single token of lookahead, a parser thus cannot decide which branch to choose. 3) The should-not-follow set of the left-hand side of a sequence and the first set of the right-hand side of that sequence both contain the same token kind, k. This means that there is a point in the left-hand side (after reading the sequence of tokens ts1 from ) where reading a token of kind k will make it impossible to decide whether we should stay in the left-hand side (and then read ts2), or start parsing in the right-hand side of the sequence.


Due to backtracking, LL(1) may end up being exhaustive in that it may
backtrack to the point that it reaches the last production in which it
will try to apply. This exhaustive search means LL(1) is bounded by an
exponential.

LR(1) parsing :

An LR parsing is non-backtracking shift reduce parsing.LR(1) parser is a finite-state automaton, equipped with a stack, which uses a combination of its current state and one lookahead symbol in order to determine which action to perform next. We present a validator which, when applied to a context-free grammar G and an automaton A, checks that A and G agree. Validating the parser provides the correctness guarantees required by verified compilers and other high-assurance software that involves parsing. The validation process is independent of which technique was used to construct A.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
please explain why!! 1. An electron is released from rest in a region of space with...
please explain why!! 1. An electron is released from rest in a region of space with a nonzero electric field. As the electron moves, does the electric potential energy of the system increase or decrease? Explain. 2. An electron is released from rest in a region of space with a nonzero electric field. As the electron moves, does the electron move from a position of high to low electric potential? Explain.
Linear Algebra Does the set of all polynomials with a_n=1 form a linear space? Explain?
Linear Algebra Does the set of all polynomials with a_n=1 form a linear space? Explain?
2. Are Pr(ll), Fe(lll), and Ca(ll) hard or soft Lewis acids? Explain. What are their respective...
2. Are Pr(ll), Fe(lll), and Ca(ll) hard or soft Lewis acids? Explain. What are their respective ionic radii in octahedral complexes?
Please explain what the identity matrix is. The course is linear algebra. The book describes it...
Please explain what the identity matrix is. The course is linear algebra. The book describes it simply as a matrix with 1's on the diagonal and 0's elsewhere. Why is that? Can you explain it for a first time learner of this material? Thank you! I appreciate it!
Analyze the space and time complexity for the linear bounded automaton that accepted the set of...
Analyze the space and time complexity for the linear bounded automaton that accepted the set of squares.
Globalization of business activities has accelerated since World War ll. Explain 1st, why globalization accelerated significantly...
Globalization of business activities has accelerated since World War ll. Explain 1st, why globalization accelerated significantly immediately after World War ll, boosting global business activity and 2nd describe how at least two additional factors extended that growth into the 21st Century.
Please explain the terms row space, column space and nullspace (kernel).
Please explain the terms row space, column space and nullspace (kernel).
In Hamiltonian Mechanics in the phase space specifically, why is it not possible for two orbits...
In Hamiltonian Mechanics in the phase space specifically, why is it not possible for two orbits to intersect? Does the theorem state that the two orbits can't intersect at the same time or at all times ? one way I imagine that is if I have 2 1D objects subject to a net force = 0, if both have the exact same momenta and different positions, as the two systems evolve with time, wouldn't the two orbits at some point...
Let T be a 1-1 linear transformation from a vector space V to a vector space...
Let T be a 1-1 linear transformation from a vector space V to a vector space W. If the vectors u, v and w are linearly independent in V, prove that T(u), T(v), T(w) are linearly independent in W
Please explain the following in details 1) why does sugar increase the production of CO2? 2)...
Please explain the following in details 1) why does sugar increase the production of CO2? 2) why does vinegar decrease the production of CO2?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT