Skip to content

Commit

Permalink
style: clarify the way state kernels (aka cores) are built
Browse files Browse the repository at this point in the history
Use state_list_append in a more natural way.

* src/lr0.c (generate_states): Here.
  • Loading branch information
akimd committed Sep 20, 2020
1 parent 843f998 commit aac79ca
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lr0.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,14 @@ generate_states (void)
allocate_storage ();
closure_new (nritems);

/* Create the initial state. The 0 at the lhs is the index of the
item of this initial rule. */
item_index initial_core = 0;
state_list_append (0, 1, &initial_core);
/* Create the initial state, whose accessing symbol (by convention)
is 0, aka $end. */
{
/* The items of its core. */
kernel_size[0] = 1;
kernel_base[0][0] = 0;
state_list_append (0, kernel_size[0], kernel_base[0]);
}

/* States are queued when they are created; process them all. */
for (state_list *list = first_state; list; list = list->next)
Expand Down

0 comments on commit aac79ca

Please sign in to comment.