Re: Top down parsing
- From: amitsaraff@xxxxxxxxx
- Date: 22 Oct 2006 05:23:08 -0700
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.)
.
- Follow-Ups:
- Re: Top down parsing
- From: aloha.kakuikanu
- Re: Top down parsing
- References:
- Top down parsing
- From: anandr86
- Top down parsing
- Prev by Date: Top down parsing
- Next by Date: Re: Counter example for Mr. Diaby algorithm solving TSP problem in polynomial time
- Previous by thread: Top down parsing
- Next by thread: Re: Top down parsing
- Index(es):
Relevant Pages
|