[Top][All Lists]

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

Re: Interactive parsing with Bison

From: Hans Aberg
Subject: Re: Interactive parsing with Bison
Date: Sun, 25 Jun 2006 10:55:24 +0200

On 25 Jun 2006, at 01:23, Richard Stallman wrote:

How about making GDB act as the interface for debugging Bison
grammars?  GDB already has an IDE, through Emacs.

Paul Eggert had some ideas in the Bison Patches list that were not cc'ed to you.

Another idea occurs to me: generate a function for each state, just to
have a place to put a breakpoint corresponding to that state.  Right
now, Bison generates code for each rule, and that's all.  That makes
grammars compact, which is good for ordinary execution.  However,
having a piece of code for each state could facilitate using GDB as
the debugging interface.

The function's source code could hold whatever information you want
to present about that state, for debugging purposes.

By continuing this idea, maybe you could set it up so that any C debugger
is a good debugger for Bison parsers.

As such, I think that an ordinary C-debugger might be used to debug the Bison parsing, displaying the exact position in the .y file in a GUI, but there needs to be two extensions, I think:

First, the debugger IDE must be able to display multiple arrows, as though there were multiple program counters in each function call. The reason for this, is because parsing proceeds over sets of rules, with a parsing position marked in each of them. (This is the stuff displayed in the Bison generated .output file of each state.)

Second, IDE's are often limited at displaying only one position per input source code line. This would be insufficient for displaying a parsing position in each grammar rule of the .y file, which normally has several symbols on the same line. So here, one needs an arrow pointing between the grammar symbols of each active rule.

  Hans Aberg

reply via email to

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