19 Feb 2006 02:01:45 -0500

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) |

From: | "Ulrich Frank" <franku@fmi.uni-passau.de> |

Newsgroups: | comp.compilers |

Date: | 19 Feb 2006 02:01:45 -0500 |

Organization: | http://groups.google.com |

Keywords: | LL(1), question |

Posted-Date: | 19 Feb 2006 02:01:45 EST |

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?!!

And if I define rule1 as

rule1 = (ID)? rule2;

which is equivalent to the first rule1 definition, FIRST(rule1) also is

{ID, "where"} RIGHT?!!

Please say, that I'm right. Thanks.

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.