Re: Preview in grammar

haberg@math.su.se (Hans Aberg)
4 May 2006 10:47:09 -0400

          From comp.compilers

Related articles
Preview in grammar franku@fmi.uni-passau.de (Ulrich Frank) (2006-05-03)
Re: Preview in grammar marcov@stack.nl (Marco van de Voort) (2006-05-04)
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)
[7 later articles]
| List of all articles for this month |

From: haberg@math.su.se (Hans Aberg)
Newsgroups: comp.compilers
Date: 4 May 2006 10:47:09 -0400
Organization: Mathematics
References: 06-05-011
Keywords: parse, comment
Posted-Date: 04 May 2006 10:47:09 EDT

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


> for my thesis I need a parser generator for generating a parser for a
> language similar to OQL (Object Query Language). I already found a lot
> of parser generators in the web or books but I need a special
> functionality which is not provided by every generated parser. Namely
> I need a preview which token comes next in an uncomplete input string.
> For example when you type "select abc" the preview would be "from". Or
> in "select abc from def where abc" the preview would be "<, <=, >, >=,
> equals".


If understood you right, you want to interactively tell the possible
grammar completions of an input. This has been discussed somewhat in the
Bison lists. Then, LALR(1) is not suitable, because it merges the LR(1)
states in a way that the lookahead tokens may be put on some action coming
up later on in the parsing. Therefore, I think you need to look for a
LR(1) parser. Then the problem would just to check for the lookaheads in
the various states in the generated push-down automaton. In Bison, this is
the output files one can generate. Bison, though, currently only supports
LALR(1).


--
    Hans Aberg
[Good point, LALR has never been great for error reporting. -John]


Post a followup to this message

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