emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/parser-generator d7ad86c 200/434: Added TODO item for L


From: ELPA Syncer
Subject: [elpa] externals/parser-generator d7ad86c 200/434: Added TODO item for LRk Canonical Parser
Date: Mon, 29 Nov 2021 15:59:40 -0500 (EST)

branch: externals/parser-generator
commit d7ad86c5951ef3cdd68500ca60ebcbb446a9e579
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Added TODO item for LRk Canonical Parser
---
 parser-generator-lr.el           |  5 +----
 test/parser-generator-lr-test.el | 12 +++++++++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/parser-generator-lr.el b/parser-generator-lr.el
index b5b9896..e6c95db 100644
--- a/parser-generator-lr.el
+++ b/parser-generator-lr.el
@@ -117,13 +117,10 @@
                                       (progn
                                         ;; Reduction by first production
                                         ;; of empty look-ahead means grammar 
has been accepted
-                                        (message "accept of %s" u)
                                         (push (list u 'accept) action-table)
                                         (setq found-accept t)
                                         (setq found-action t))
 
-                                    (message "no accept of %s, p: %s" u 
production-number)
-
                                     ;; save reduction action in action table
                                     (push (list u 'reduce production-number) 
action-table)
                                     (setq found-action t))))))))))
@@ -138,7 +135,7 @@
         (when action-table
           (push (list goto-index (sort action-table 
'parser-generator--sort-list)) action-tables))))
     (unless found-accept
-      (error "Failed to find a accept action in generated action-tables: %s 
from goto-tabbles: %s" action-tables goto-tables))
+      (error "Failed to find an accept action in the generated 
action-tables!"))
     (setq action-tables (nreverse action-tables))
     (setq parser-generator-lr--action-tables (make-hash-table :test 'equal))
     (let ((table-length (length action-tables))
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index 56f717a..a994bcd 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -311,7 +311,9 @@
   (parser-generator-set-grammar '((Sp S) ("a" "b") ((Sp S) (S (S "a" S "b")) 
(S e)) Sp))
   (parser-generator-set-look-ahead-number 1)
   (parser-generator-process-grammar)
-  (parser-generator-lr-generate-parser-tables)
+  (let ((lr-items (parser-generator-lr-generate-parser-tables)))
+    (message "lr-items: %s" (parser-generator--hash-values-to-list lr-items t))
+    )
   (message "goto-tables: %s" (parser-generator--hash-values-to-list 
parser-generator-lr--goto-tables t))
   (message "action-tables: %s" (parser-generator--hash-values-to-list 
parser-generator-lr--action-tables t))
   (setq
@@ -370,9 +372,13 @@
   (parser-generator-set-grammar '((Sp S) ("a" "b") ((Sp S) (S (S "a" S "b")) 
(S e)) Sp))
   (parser-generator-set-look-ahead-number 2)
   (parser-generator-process-grammar)
-  (let ((lr-items (parser-generator--hash-values-to-list 
(parser-generator-lr-generate-parser-tables) t)))
-    (message "lr-items: %s" lr-items)
+  (let ((lr-items (parser-generator-lr--generate-goto-tables)))
+    (message "lr-items: %s" (parser-generator--hash-values-to-list lr-items t))
+
+    ;; TODO Fix so that lr-item (Sp (S) nil (e)) instead is (Sp (S) nil (e e))
+    
     (message "goto-tables: %s" (parser-generator--hash-values-to-list 
parser-generator-lr--goto-tables t))
+    (parser-generator-lr--generate-action-tables lr-items)
     ;; TODO Should generate accept somewhere in this action-table
     (message "action-tables: %s" (parser-generator--hash-values-to-list 
parser-generator-lr--action-tables t)))
   (setq



reply via email to

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