|FIRST function computation problem. firstname.lastname@example.org (2003-06-22)|
|Re: FIRST function computation problem. derkgwen@HotPOP.com (Derk Gwen) (2003-07-02)|
|Re: FIRST function computation problem. email@example.com (2003-07-02)|
|Re: FIRST function computation problem. firstname.lastname@example.org (2003-07-02)|
|Re: FIRST function computation problem. email@example.com (=?Windows-1252?Q?S=F6nke_Kannapinn?=) (2003-07-02)|
|Date:||22 Jun 2003 23:18:16 -0400|
|Posted-Date:||22 Jun 2003 23:18:16 EDT|
I have a problem with FIRST function for 1 lookahead symbol evalation.
To lookup such the symbols for some nonterminal A I am doning follows:
1. go through all rules that left part is A. Here I do following:
a) If I have rule A --> aB, where a is terminal. I just add this
terminal to lookahead set for A.
b) If I have rule A --> e, where e is epsilon, I add e to lookahead
set for A.
c) If I have rule A --> B C ... where B - nonterminal, I at first
compute the lookahead set for B, if B's lookahead set contains
epsilon, check C and etc. I found that recursive function here is the
best. But I do not know how to work with rules like follows: A --> B,
B --> C A D... To compute lookahead set for A I have to at first
compute lookaheads for B, but if lookaheads for C contain epsilon I
need to know the same about A to understand do checking of D or
Please, help to decide this problem and there may be the good FIRTS
Return to the
Search the comp.compilers archives again.