Re: Top down parsing
- From: "aloha.kakuikanu" <aloha.kakuikanu@xxxxxxxxx>
- Date: 24 Oct 2006 15:39:11 -0700
amitsaraff@xxxxxxxxx wrote:
In the book "Principles of compiler design, Aho Ullman" the
following exercise caught my attention. The grammar given is
S -> aSa | aa
It is quoted that a "top down parse with backtracking" can establish
the inputs with 2,4 or 8 a's but not 6 a's .... How is this possible ?
The trick lies in the statement that the production S->aSa is tried
first, a recursive descent parser will only work in this case for an
even no. of inputs (try constructing the parse tree and look at the
discrepancy found for strings of length n where n/2 is odd.)
In other words, a "top down parse with backtracking" can't recognize
grammar
S -> aSa | aa
correctly?
.
- References:
- Top down parsing
- From: anandr86
- Re: Top down parsing
- From: amitsaraff
- Top down parsing
- Prev by Date: Re: Counter example for Mr. Diaby algorithm solving TSP problem in polynomial time
- Next by Date: Re: Solve math inequality with SAT (CNF)
- Previous by thread: Re: Top down parsing
- Next by thread: Solve math inequality with SAT (CNF)
- Index(es):
Relevant Pages
|