[DGD] Help with parse_string() grammar
Petter Nyström
md1pette at mdstud.chalmers.se
Mon Apr 10 13:41:01 CEST 2006
On Mon, 10 Apr 2006, Felix A. Croes wrote:
> The parser can't do that. It has to match tokens before it knows which
> production rules could possibly apply. And it matches them in the order
> of the specified rules. Basically, token matching does not depend on
> the context.
Oh I see. After realizing that, I think I've got something working. It
didn't turn out as beautiful as I'd hope and I had to use the nomatch
rule. But it seems to work.
One thing though, the parser matches tokens in the string from right to
left. For example, if I have the string, "A &1little&2 girl." and use LPC
function calls when the &c tokens are matched, the &2 token will be
matched before the &1 one. Since I want to build a state in the parser
object while parsing, that can decide how the remainder of the string will
be parsed, I would like if the matches were made in left to right order?
This seems tricky to me, but I have to ask. Is there a way one could write
the grammar rules to force matching to be made in the other direction?
Regards,
Jimorie
More information about the DGD
mailing list