On Tue, 28 Jun 2005, Neil Conway wrote:

> I'm trying to use Bison to construct a parser for a language A that
> needs to allow syntax from a second language B to be embedded within it

[...]

> Ideally I'd like to have A's parser
> "call into" B's parser, have it accept as much input as it can, and then
> return control to A's parser.

[...]

> Is this possible?
> One idea would be to use hand-written parsers for both
> languages, although it would be nice to stick with Bison if possible.

I think this would be possible using Bison.  "Accepting as much input as
it can" is tricky.  I believe it would be best for it to be a complete
statement (in the generic sense) of language B, i.e., the code passed to
your B parser will have to reduce to the start symbol of the B language.

I see no difficulty in principle in creating a second parser function
using Bison, say 'zzparse()', and calling it in one or more of the actions
in your A parser.

Laurence Finston


_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to