[Top][All Lists]

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

Re: warning: a ';' might be needed at the end of action code

From: Akim Demaille
Subject: Re: warning: a ';' might be needed at the end of action code
Date: Fri, 1 Mar 2019 06:56:35 +0100

Hi John,

Please, let's stay on help-bison.

> Le 28 févr. 2019 à 18:28, John P. Hartmann <address@hidden> a écrit :
> On 2/28/19 18:19, Akim Demaille wrote:
>> You can write your own skeletons to get the tables only.
> That so.   Tell me more.

Just have a look at data/skeletons.  Take yacc.c for instance, and remove
what you don't want to keep.  Then run bison --skeleton=my-yacc.c.

There is a catch though: the API for the skeletons is not guaranteed
to remain as is, there is no commitment of backward compatibility in
the future.  However, this API does not change a lot.

> Here is a snippet.  As you can see, I have equates for the dollar offsets:
> uargs          :  F_UFUNC condexpression
>                  {
>                     mvc pollloc,lloc+dlr2
>                     la r0,1
>                     st r0,yylval2
>                     la r0,stackentry+dlr2 Address expression
>                     pcalltr testufargs
>                  }

Wow... This is amazing...

Can't you generate C and compile C?

Your skeleton might be able to improve this part too in fact.
The translation of $$ and $2 etc. is under the control of the
skeleton.  For instance for C output, we have:

# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
# ----------------------------------------------
                    [b4_symbol_if([$2], [has_type],
                                  [($1.b4_symbol([$2], [type]))],

# b4_lhs_value(SYMBOL-NUM, [TYPE])
# --------------------------------
[b4_symbol_value(yyval, [$1], [$2])])

# b4_rhs_value(RULE-LENGTH, POS, [SYMBOL-NUM], [TYPE])
# ----------------------------------------------------
[b4_symbol_value(address@hidden([$2], [$1])@}], [$3], [$4])])

reply via email to

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