Re: Preview in grammar

"Ulrich Frank" <franku@fmi.uni-passau.de>
11 May 2006 01:52:43 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: Preview in grammar haberg@math.su.se (2006-05-04)
Re: Preview in grammar pbmann@gmail.com (2006-05-09)
Re: Preview in grammar haberg@math.su.se (2006-05-09)
Re: Preview in grammar DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-05-09)
Re: Preview in grammar franku@fmi.uni-passau.de (Ulrich Frank) (2006-05-09)
Re: Preview in grammar cfc@shell01.TheWorld.com (Chris F Clark) (2006-05-11)
Re: Preview in grammar franku@fmi.uni-passau.de (Ulrich Frank) (2006-05-11)
Re: Preview in grammar franku@fmi.uni-passau.de (Ulrich Frank) (2006-05-11)
Re: Preview in grammar Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2006-05-12)
Re: Preview in grammar cfc@shell01.TheWorld.com (Chris F Clark) (2006-05-12)
Re: Preview in grammar pbmann@gmail.com (2006-05-12)
Re: Preview in grammar pbmann@gmail.com (2006-05-12)
Re: Preview in grammar pbmann@gmail.com (2006-05-15)
[1 later articles]
| List of all articles for this month |

From: "Ulrich Frank" <franku@fmi.uni-passau.de>
Newsgroups: comp.compilers
Date: 11 May 2006 01:52:43 -0400
Organization: http://groups.google.com
References: 06-05-01106-05-018
Keywords: parse
Posted-Date: 11 May 2006 01:52:43 EDT

Hello Paul,


I didn't understand the way you want to calculate the lookahead token.
An example where I had the problem:


1) condition ::= expr comp expr
2) condition ::= NUM SETATTR comp INTVAL


3) expr ::= ATTR | TODAY | NOW | LETTER
4) comp ::= < | <=


the action-table looks like this


                                ATTR TODAY NOW LETTER INTVAL
state 44 action1 action2 action3 action4 action5


LALR-Parser merge equal states and therefore the comp-state of 1) and
the comp-state of 2) get merged (to state 44). My idea was to look at
the possible input tokens in this state. But because of this merging I
cannot differ between comp-state of 1) and comp-state of 2). If the
input satisfies rule 1), e.g. "TODAY <=" then the lookahead token list
includes ATTR, TODAY, NOW, LETTER and unfortunately INTVAL. But INTVAL
is not appropriate at this position of the query input.


How can this be solved with an additional stack?


Post a followup to this message

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