[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is this allowed to give nonterminal and its type same name?
From: |
Akim Demaille |
Subject: |
Re: Is this allowed to give nonterminal and its type same name? |
Date: |
Thu, 20 Dec 2018 06:29:34 +0100 |
> Le 20 déc. 2018 à 04:46, Askar Safin <address@hidden> a écrit :
>
> Hi. Is this allowed to give nonterminal and its type same name? I tried (
> https://paste.gg/p/anonymous/50205298be234f788a3ab9b38cc94ec2 ) and got
> compile error
Please, make self-contained messages, for sake of the archives.
So, you have
%define api.value.type union
%type <expr *> expr;
which ends into
/// Symbol semantic values.
union semantic_type
{
// expr
expr * expr;
// product
expr * product;
// prim
expr * prim;
// NUMBER
int NUMBER;
#line 140 "foott.tab.c" // glr.c:240
};
that the compiler won't like.
Give a try to
%define api.token.prefix {TOK_}
which gives
/// Symbol semantic values.
union semantic_type
{
// expr
expr * TOK_expr;
// product
expr * TOK_product;
// prim
expr * TOK_prim;
// NUMBER
int TOK_NUMBER;
#line 140 "foott.cc" // glr.c:240
};