Lex/Yacc (Flex/Bison): Obtaining a list of the next possible tokens for auto-complete feature

"Chris Hundhausen" <hundhaus@hawaii.edu>
13 Oct 2002 16:22:12 -0400

          From comp.compilers

Related articles
Lex/Yacc (Flex/Bison): Obtaining a list of the next possible tokens f hundhaus@hawaii.edu (Chris Hundhausen) (2002-10-13)
Re: Lex/Yacc (Flex/Bison): Obtaining a list of the next possible token gordan.sikic@inet.hr (Gordan Sikic) (2002-10-18)
| List of all articles for this month |

From: "Chris Hundhausen" <hundhaus@hawaii.edu>
Newsgroups: comp.lang.c++,comp.compilers
Date: 13 Oct 2002 16:22:12 -0400
Organization: http://groups.google.com/
Keywords: parse, question
Posted-Date: 13 Oct 2002 16:22:11 EDT

I'm building an interactive development environment (IDE) with
auto-complete and syntax highlighting. I used flex and bison to
construct the parser for the language supported by my IDE.

To support autocomplete, I need a function that accepts a partial
sentence of my language, and returns a list of the next possible
tokens. I'm unaware of any way to obtain such a list with flex/bison

Is there anyone out there who has done this and could give me some
advice? I've heard that ANTLR has this functionality, but I'd prefer
not to convert to ANTLR unless I have to. (If you'd done this in
ANTLR, please respond too, because I may have to convert to ANTLR if
flex/bison won't do the job.)

Thanks in advance,

[As I recall, it's just barely possible in yacc by decoding the parse
state tables, although the default reductions make it harder. -John]

Post a followup to this message

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