Re: FIRST_k, FOLLOW_k, k>1

Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Sat, 8 Feb 2020 11:00:48 +0100

          From comp.compilers

Related articles
FIRST_k, FOLLOW_k, k>1 borucki.andrzej@gmail.com (Andy) (2020-02-06)
Re: FIRST_k, FOLLOW_k, k>1 borucki.andrzej@gmail.com (Andy) (2020-02-06)
Re: FIRST_k, FOLLOW_k, k>1 DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-02-08)
Re: FIRST_k, FOLLOW_k, k>1 borucki.andrzej@gmail.com (Andy) (2020-02-08)
Re: FIRST_k, FOLLOW_k, k>1 DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-02-09)
Re: FIRST_k, FOLLOW_k, k>1 gaztoast@gmail.com (honey crisis) (2020-02-08)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups: comp.compilers
Date: Sat, 8 Feb 2020 11:00:48 +0100
Organization: Compilers Central
References: 20-02-004 20-02-005
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="80801"; mail-complaints-to="abuse@iecc.com"
Keywords: parse, LL(1)
Posted-Date: 08 Feb 2020 09:36:36 EST

Am 06.02.2020 um 23:16 schrieb Andy:
> I search examples,
> E->aWbXYcdZ
> W->w
> X->x
> Y->y
> Z->z
>
> if for FIRST(k=4) wil be: E={awbx} W={wbxy} X={xycd} Y={ycdz} Z={z}
> what is convention?


Your grammar definitely is LL(1). You should provide a grammar that
requires longer lookahead.


IMO the FIRST set covers all *different* sequences, in your case
FIRST(E)={a} hence LL(1).
Only if there exist multiple alternatives starting with 'a' they have to
be listed as e.g. FIRST(E)={ax, ay}.


Dunno about the FOLLOW set, perhaps it can stay LL(1)?


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.