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

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Hi John,

Please, let's stay on help-bison.

> Le 28 févr. 2019 à 18:28, John P. Hartmann <[email protected]> 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])
# ----------------------------------------------
# See README.
m4_define([b4_symbol_value],
[m4_ifval([$3],
          [($1.$3)],
          [m4_ifval([$2],
                    [b4_symbol_if([$2], [has_type],
                                  [($1.b4_symbol([$2], [type]))],
                                  [$1])],
                    [$1])])])


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


# b4_rhs_value(RULE-LENGTH, POS, [SYMBOL-NUM], [TYPE])
# ----------------------------------------------------
# See README.
m4_define([b4_rhs_value],
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3], [$4])])




_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.