bison-patches
[Top][All Lists]
Advanced

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

[PATCH 2/4] style: clarify the way state kernels (aka cores) are built


From: Akim Demaille
Subject: [PATCH 2/4] style: clarify the way state kernels (aka cores) are built
Date: Sun, 20 Sep 2020 08:38:25 +0200

Use state_list_append in a more natural way.

* src/lr0.c (generate_states): Here.
---
 src/lr0.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/lr0.c b/src/lr0.c
index fc3d0f4d..3388247d 100644
--- a/src/lr0.c
+++ b/src/lr0.c
@@ -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)
-- 
2.28.0




reply via email to

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