Related articles |
---|
Computing "first" in LR(1) parsing remove.haberg@matematik.su.se (2001-11-26) |
Re: Computing "first" in LR(1) parsing kan@cs.tu-berlin.de (Sönke Kannapinn) (2001-11-29) |
Re: Computing "first" in LR(1) parsing chrisd@reservoir.com (2001-11-29) |
Re: Computing "first" in LR(1) parsing max@gustavus.edu (2001-11-29) |
Re: Computing "first" in LR(1) parsing kgw-news@stiscan.com (2001-11-29) |
Re: Computing "first" in LR(1) parsing remove.haberg@matematik.su.se (2001-12-03) |
From: | kgw-news@stiscan.com |
Newsgroups: | comp.compilers |
Date: | 29 Nov 2001 23:10:31 -0500 |
Organization: | Solution Technology |
References: | 01-11-123 |
Keywords: | LR(1), parse |
Posted-Date: | 29 Nov 2001 23:10:31 EST |
On Tue, 27 Nov 2001 02:57:11, remove.haberg@matematik.su.se (Hans
Aberg) wrote: WEEKDAY
[...]
>
>But it does not say what happens if this procedure recurses, that is,
>if say when computing first(y1), one recurses back via some other
>relations to first(x). If that happens, is that not a LR(1) grammar,
>or how should this situation be handled?
Compute the empty relation first.
empty(x) if x->
or x->y[1],...,y[n] and empty(y[i])
This can be done by iterating until there are no changes
or if you have an inverted production list(used by)
you can add potentially affected productions to a todo list
until the todo list becomes empty.
Then first and last and next are easy and local.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.