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

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

[elpa] externals/parser-generator 98dc561880 23/29: FIRST() and E-FREE-F


From: Christian Johansson
Subject: [elpa] externals/parser-generator 98dc561880 23/29: FIRST() and E-FREE-FIRST() passing LR-test for k=0
Date: Sat, 12 Feb 2022 02:24:45 -0500 (EST)

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

    FIRST() and E-FREE-FIRST() passing LR-test for k=0
---
 parser-generator.el              |  9 ++++++---
 test/parser-generator-lr-test.el | 15 ++++++++++++---
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/parser-generator.el b/parser-generator.el
index f901b45077..0a2575efae 100644
--- a/parser-generator.el
+++ b/parser-generator.el
@@ -1463,7 +1463,10 @@
                            (message
                             "Found no subsets for %s %s"
                             rhs-element
-                            (1- i)))))
+                            (1- i)))
+                          (setq
+                           keep-iterating
+                           nil)))
                     (setq
                      keep-iterating
                      nil)))
@@ -1550,7 +1553,7 @@
 
       ;; Algorithm
       ;; 1. Iterate each symbol of input and expand into list of lists of 
terminals and the e-identifier
-      ;;     if input symbol is a terminal or the e-identifier push it to each 
expanded list
+      ;;     if input symbol is a terminal, the e-identifier or the 
EOF-identifier push it to each expanded list
       ;;     if input symbol is a non-terminal, expand it and push each 
possible expansion onto each expanded list
       ;; 2. Reverse each expanded list and place each list on a stack of 
unprocessed lists each with a input-index to zero
       ;; 3. Process each unprocessed list and expand into a list of lists of 
terminals and the e-identifier
@@ -1652,7 +1655,7 @@
                (parser-generator--valid-terminal-p input-symbol))
               (parser-generator--debug
                (message
-                "symbol is a terminal or the e-identifier"))
+                "symbol is a terminal, the e-identifier or the 
EOF-identifier"))
               (let ((expanded-list-index 0)
                     (expanded-list-count
                      (length expanded-lists)))
diff --git a/test/parser-generator-lr-test.el b/test/parser-generator-lr-test.el
index f8bc3d8f30..8fc8fbae76 100644
--- a/test/parser-generator-lr-test.el
+++ b/test/parser-generator-lr-test.el
@@ -1609,7 +1609,6 @@
 
   (message "Passed tests for (parser-generator-lr--parse-k-2)"))
 
-;; TODO Make this pass again
 (defun parser-generator-lr-test-parse-k-0 ()
   "Test `parser-generator-lr-parse' with k = 0."
   (message "Started tests for (parser-generator-lr-parse) k = 0")
@@ -1623,7 +1622,18 @@
   ;; (5) B → 1
 
   (parser-generator-set-grammar
-   '((S E B) ("*" "+" "0" "1") ((S (E $)) (E (E "*" B) (E "+" B) (B)) (B ("0") 
("1"))) S))
+   '(
+     (S E B)
+     ("*" "+" "0" "1")
+     (
+      (S (E $))
+      (E (E "*" B) (E "+" B) (B))
+      (B ("0") ("1"))
+      )
+     S
+     )
+   )
+  (parser-generator-set-e-identifier nil)
   (parser-generator-set-look-ahead-number 0)
   (parser-generator-process-grammar)
 
@@ -1755,7 +1765,6 @@
       "Action-tables k = 0: %s"
       (parser-generator-lr--get-expanded-action-tables)))
 
-    ;; TODO Make this work
     (should
      (equal
       '(



reply via email to

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