Re: Computation of FIRST set

Ulrich Hobelmann <u.hobelmann@web.de>
19 Feb 2006 11:03:07 -0500

          From comp.compilers

Related articles
Computation of FIRST set franku@fmi.uni-passau.de (Ulrich Frank) (2006-02-19)
Re: Computation of FIRST set u.hobelmann@web.de (Ulrich Hobelmann) (2006-02-19)
| List of all articles for this month |
From: Ulrich Hobelmann <u.hobelmann@web.de>
Newsgroups: comp.compilers
Date: 19 Feb 2006 11:03:07 -0500
Organization: Compilers Central
References: 06-02-135
Keywords: parse
Posted-Date: 19 Feb 2006 11:03:06 EST

Ulrich Frank wrote:
> Hello NG,
>
> I have a big problem with ANTLR and the computation of the first set of
> a rule. I've already read corresponing articles on the computation of
> the first set but additionally want to ask you.
>
> In the lexer I define a token ID : ('a'..'z'); and in the parser I have
> the following rules:
>
> rule1 = ID rule2 | rule2;
> rule2 = "where" rule3;
> rule3 ...
>
> So FIRST(rule1) = {ID, "where"} and FIRST(rule2) = {"where"}
> RIGHT?!!


Yes.


> And if I define rule1 as
>
> rule1 = (ID)? rule2;
>
> which is equivalent to the first rule1 definition, FIRST(rule1) also is
> {ID, "where"} RIGHT?!!


Yes to both.


> Please say, that I'm right. Thanks.


Looks very much like it, yes. No need to be confused. ;)


--
Suffering from Gates-induced brain leakage...



Post a followup to this message

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