[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using bison (or bisonc++) to create parser for command completion
From: |
Hans Aberg |
Subject: |
Re: Using bison (or bisonc++) to create parser for command completion |
Date: |
Wed, 4 Feb 2009 08:54:57 +0100 |
On 4 Feb 2009, at 03:40, José Alburquerque wrote:
Hi. I'm not subscribed to this list, but I'm hoping someone here
can still help me. I'm attempting to develop a small front-end to
dvdauthor in C++ to logically create DVD's to be played in standard
DVD players. I would like to include "command completion"
functionality in an area of the GUI for accepting low level commands
to the DVD player based on a very simple language, already specified
for this purpose by the dvdauthor developers (if I'm not mistaken)
[1]. All I'm really asking for, if possible, is clarification on
whether bison can be used to create a parser for the simple language
and then somehow use the parser to tell what might come after
certain keywords. If so, is it straight forward? Finally, I've
looked a bit at bisonc++ and am wondering if it can be used instead
of bison for the same purposes (I'd rather have C++ classes, if
possible). Please, any clarification would be greatly appreciated.
You can use the .output file that Bison generates to get a set of
possible tokens for each state. The look at the top of the state stack
in the parser that Bison generates, and present that. Not in any
automated fashion, though, as far as I know.
One problem is that the LALR(1) parsing algorithm that Bison uses
makes state compaction which may admit some reductions before a state
where the error/lookahead tokens appears. So this method may note be
correct - strictly speaking, one should use LR(1). But the problem may
not be too severe.
Hans