[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/3] yacc: compute the best type for the state number
From: |
Akim Demaille |
Subject: |
Re: [PATCH 0/3] yacc: compute the best type for the state number |
Date: |
Sun, 6 Oct 2019 14:15:48 +0200 |
Hi Kaz,
Thanks for your input in this thread!
> Le 1 oct. 2019 à 20:40, Kaz Kylheku <address@hidden> a écrit :
>
> On 2019-10-01 01:35, Paul Eggert wrote:
>> On 9/29/19 11:34 AM, Akim Demaille wrote:
>>> As a matter of fact, we used two types:
>>> - most arrays (such as state stack, and its correspondance in the LAC
>>> infrastructure) are using int16_t. A few "temporary" variables also
>>> have this type.
>>> - yystate, which is an intermediate variable, was an int.
>> Actually those arrays use int_fast16_t not int16_t, as C99/C11/C18
>> does not require support for int16_t. It could well be more efficient
>> for them to use int_least16_t instead, for better caching; see below.
>
> I would make two typedefs: one for the storage type of Yacc
> state values, and one for the "register" type for manipulating
> them in local variables.
>
> The latter of course, being capable of representing all the values of
> the former. E.g. example definitions:
>
> typedef short yy_small_state_t;
> typedef int yy_state_t;
I like these names, I think eventually we'll move to that.
> The special value -1 should be given a manifest constant,
AFAIR, we don't need such a special value for states. And in other
cases, we can't use -1 which is a valid value for some of our tables.
For instance:
#define YYPACT_NINF (-130)
#define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF)
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
-130, 36, 110, -130, -22, -130, -130, 2, -130, -130,
-130, -130, -130, -130, -19, -130, -9, 40, -130, -17,
-2, -130, 57, -130, 21, 66, 77, -130, -130, -130,
78, -130, 87, 92, 44, -130, -130, -130, 165, -130,
But we agree special values should be named and care must be taken
during conversions.
- [PATCH 0/3] yacc: compute the best type for the state number, Paul Eggert, 2019/10/01
- Re: [PATCH 0/3] yacc: compute the best type for the state number, Hans Åberg, 2019/10/01
- Re: [PATCH 0/3] yacc: compute the best type for the state number, Kaz Kylheku, 2019/10/01
- Re: [PATCH 0/3] yacc: compute the best type for the state number, Akim Demaille, 2019/10/02
- Re: [PATCH 0/3] yacc: compute the best type for the state number, Kaz Kylheku, 2019/10/02
- Re: [PATCH 0/3] yacc: compute the best type for the state number, Paul Eggert, 2019/10/02