[Top][All Lists]

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

Re: How do i use the %printer feature?

From: Adam Smalin
Subject: Re: How do i use the %printer feature?
Date: Fri, 4 Mar 2011 02:20:17 -0500

On Wed, Mar 2, 2011 at 4:42 AM, Akim Demaille <address@hidden> wrote:

> Le 24 févr. 2011 à 08:37, Adam Smalin a écrit :
> > I am using `%glr-parser` and the code below. I figure i would 1) See the
> > printf message or 2) Might be able to get a breakpoint on
> print_token_value
> > if i debug with an IDE. I see neither message or stop on my breakpoint.
> So
> > it appears %printer isnt ran or that i am using it incorrectly.
> >
> > How do i use %printer correctly? one reason i want to use it is to debug
> > error tokens as suggested
> >
> >
> > %glr-parser
> > %{
> >    ...
> >    static void print_token_value();
> > %}
> >
> > %printer { print_token_value(123); printf
> > ("helllllllllllllllllllllllllllooooooooooooooooooooooo %d", $$); } <*> <>
> >
> > %token INTEGER ...
> Hi
> Did you specify %debug?  Did you set yydebug to true?  You don't get any
> traces, or just not the ones from the %printer?
> Also, pay attention that the traces are sent to stderr, and you're
> outputting onto stdout, so they will not appear where you expect them.
I am unsure i do see i used the t(race)/debug flag. Would that specify
%debug and set yydebug to true? (i use bison --report=all -y
--report-file=conflicts -v -t -d file.y).

I am not sure what other traces exist or what is consider a tracer but i do
get a (trace?) dump when i hit a reduce/reduce error in syntax.
I am using the prompt. It should show me the msg since i can see my stdout
and stderror printfs i run in my own code.

But really, i dont know what i should expect from printer or if it will suit
my needs. Would it help me debug error handling syntax? Regular syntax is

reply via email to

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