help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "nested" languages


From: Laurence Finston
Subject: Re: "nested" languages
Date: Tue, 28 Jun 2005 12:47:06 +0200 (MEST)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]