7 Mar 2000 01:03:23 -0500

Related articles |
---|

Computing FIRST(X) for a left recursive grammar muzzetta@videobank.it (2000-03-06) |

Re: Computing FIRST(X) for a left recursive grammar vugluskr@unicorn.math.spbu.ru (2000-03-06) |

Re: Computing FIRST(X) for a left recursive grammar torbenm@diku.dk (2000-03-06) |

Re: Computing FIRST(X) for a left recursive grammar joachim.durchholz@halstenbach.com.or.de (Joachim Durchholz) (2000-03-06) |

Re: Computing FIRST(X) for a left recursive grammar rsherry@home.com (Robert Sherry) (2000-03-07) |

Re: Computing FIRST(X) for a left recursive grammar johnmce@texas.net (2000-03-07) |

From: | Robert Sherry <rsherry@home.com> |

Newsgroups: | comp.compilers |

Date: | 7 Mar 2000 01:03:23 -0500 |

Organization: | @Home Network |

References: | 00-03-029 |

Keywords: | LALR |

By response is based upon material in chapter 4 of the book

"Compilers Principles, Techniques and tools". This book is often called

the dragon book. I would advise that you obtain access to this book.

Now here is FIRST(list):

FIRST(list) = { epsilon, NEWLINE, FIRST(expr) }

We include epsilon because list goes to epsilon.

We include FIRST(expr) because list can reduce to epsilon.

Alessandro Muzzetta wrote:

*>*

*> Hello,*

*>*

*> can some kind soul please answer this silly question of mine...*

*>*

*> Assuming you have the following yacc rules*

*>*

*> list: /* empty */*

*> | list NEWLINE*

*> | list expr NEWLINE*

*> ;*

*> expr: ...*

*> ;*

*>*

*> How do I calculate FIRST(list) for this left recursive grammar?*

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.