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

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

[elpa] externals/parser-generator ed9933eeba 57/82: Passing a lot of LLk


From: Christian Johansson
Subject: [elpa] externals/parser-generator ed9933eeba 57/82: Passing a lot of LLk tests
Date: Thu, 12 May 2022 13:28:18 -0400 (EDT)

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

    Passing a lot of LLk tests
---
 parser-generator-ll.el           | 22 ++++++----
 test/parser-generator-ll-test.el | 86 ++++++++++------------------------------
 2 files changed, 36 insertions(+), 72 deletions(-)

diff --git a/parser-generator-ll.el b/parser-generator-ll.el
index 4dbd6bdfbe..7afaa48c35 100644
--- a/parser-generator-ll.el
+++ b/parser-generator-ll.el
@@ -108,7 +108,8 @@
            (list
             (format
              "State action table lacks actions for state: '%S'!"
-             state))))
+             state)
+            state)))
 
         (if look-ahead-list
             (progn
@@ -131,10 +132,14 @@
              state-action-table)
             (signal
              'error
-             (format
+             (list
+              (format
               "Invalid look-ahead '%S' in state: '%S', valid look-aheads: '%S'"
               look-ahead
               state
+              possible-look-aheads)
+              look-ahead
+              state
               possible-look-aheads))))
 
         (let* ((action
@@ -439,12 +444,13 @@
               (let ((sub-symbol (nth sub-symbol-index right-hand-side)))
                 (if (parser-generator--valid-non-terminal-p
                      sub-symbol)
-                    (let ((local-follow (nth non-terminal-index 
local-follow-sets)))
-                      (push
-                       (list
-                        (list sub-symbol)
-                        local-follow)
-                       modified-right-hand-side)
+                    (let ((local-follow-set (nth non-terminal-index 
local-follow-sets)))
+                      (dolist (local-follow local-follow-set)
+                        (push
+                         (list
+                          (list sub-symbol)
+                          local-follow)
+                         modified-right-hand-side))
                       (setq
                        non-terminal-index
                        (1+ non-terminal-index)))
diff --git a/test/parser-generator-ll-test.el b/test/parser-generator-ll-test.el
index cf9d9fd63d..567e2ee955 100644
--- a/test/parser-generator-ll-test.el
+++ b/test/parser-generator-ll-test.el
@@ -459,29 +459,29 @@
         (
          ((E) ($))
          (
-          (("a") reduce (((T) ($ "+")) ((E2) ($))) 0)
-          (("(") reduce (((T) ($ "+")) ((E2) ($))) 0)
+          (("a") reduce (((T) ($)) ((T) ("+")) ((E2) ($))) 0)
+          (("(") reduce (((T) ($)) ((T) ("+")) ((E2) ($))) 0)
           )
          )
         (
          ((E2) ($))
          (
-          (("+") reduce ("+" ((T) ($ "+")) ((E2) ($))) 1)
+          (("+") reduce ("+" ((T) ($)) ((T) ("+")) ((E2) ($))) 1)
           (($) reduce (e) 2)
           )
          )
         (
          ((T) ("+"))
          (
-          (("a") reduce (((F) ("*" "+")) ((T2) ("+"))) 3)
-          (("(") reduce (((F) ("*" "+")) ((T2) ("+"))) 3)
+          (("a") reduce (((F) ("*")) ((F) ("+")) ((T2) ("+"))) 3)
+          (("(") reduce (((F) ("*")) ((F) ("+")) ((T2) ("+"))) 3)
           )
          )
         (
          ((T2) ("+"))
          (
           (("+") reduce (e) 5)
-          (("*") reduce ("*" ((F) ("*" "+")) ((T2) ("+"))) 4)
+          (("*") reduce ("*" ((F) ("*")) ((F) ("+")) ((T2) ("+"))) 4)
           )
          )
         (
@@ -494,66 +494,24 @@
         (
          ((E) (")"))
          (
-          (("a") reduce (((T) (")" "+")) ((E2) (")"))) 0)
-          (("(") reduce (((T) (")" "+")) ((E2) (")"))) 0)
+          (("a") reduce (((T) (")")) ((T) ("+")) ((E2) (")"))) 0)
+          (("(") reduce (((T) (")")) ((T) ("+")) ((E2) (")"))) 0)
           )
          )
         (
          ((E2) (")"))
          (
-          (("+") reduce ("+" ((T) (")" "+")) ((E2) (")"))) 1)
+          (("+") reduce ("+" ((T) (")")) ((T) ("+")) ((E2) (")"))) 1)
           ((")") reduce (e) 2)
           )
          )
-        (
-         ((T) (")"))
-         (
-          (("a") reduce (((F) (")" "*")) ((T2) (")"))) 3)
-          (("(") reduce (((F) (")" "*")) ((T2) (")"))) 3)
-          )
-         )
-        (
-         ((T2) (")"))
-         (
-          (("*") reduce ("*" ((F) (")" "*")) ((T2) (")"))) 4)
-          ((")") reduce (e) 5)
-          )
-         )
-        (
-         ((F) (")"))
-         (
-          (("a") reduce ("a") 7)
-          (("(") reduce ("(" ((E) (")")) ")") 6)
-          )
-         )
-        (
-         ((F) ("*"))
-         (
-          (("a") reduce ("a") 7)
-          (("(") reduce ("(" ((E) (")")) ")") 6)
-          )
-         )
-        (
-         ((T) ($))
-         (
-          (("a") reduce (((F) ($ "*")) ((T2) ($))) 3)
-          (("(") reduce (((F) ($ "*")) ((T2) ($))) 3)
-          )
-         )
-        (
-         ((T2) ($))
-         (
-          (("*") reduce ("*" ((F) ($ "*")) ((T2) ($))) 4)
-          (($) reduce (e) 5)
-          )
-         )
-        (
-         ((F) ($))
-         (
-          (("a") reduce ("a") 7)
-          (("(") reduce ("(" ((E) (")")) ")") 6)
-          )
-         )
+        (((T) (")")) ((("a") reduce (((F) (")")) ((F) ("*")) ((T2) (")"))) 3) 
(("(") reduce (((F) (")")) ((F) ("*")) ((T2) (")"))) 3)))
+        (((T2) (")")) ((("*") reduce ("*" ((F) (")")) ((F) ("*")) ((T2) 
(")"))) 4) ((")") reduce (e) 5)))
+        (((F) (")")) ((("a") reduce ("a") 7) (("(") reduce ("(" ((E) (")")) 
")") 6)))
+        (((F) ("*")) ((("a") reduce ("a") 7) (("(") reduce ("(" ((E) (")")) 
")") 6)))
+        (((T) ($)) ((("a") reduce (((F) ($)) ((F) ("*")) ((T2) ($))) 3) (("(") 
reduce (((F) ($)) ((F) ("*")) ((T2) ($))) 3)))
+        (((T2) ($)) ((("*") reduce ("*" ((F) ($)) ((F) ("*")) ((T2) ($))) 4) 
(($) reduce (e) 5)))
+        (((F) ($)) ((("a") reduce ("a") 7) (("(") reduce ("(" ((E) (")")) ")") 
6)))
         ("a" ((("a") pop)))
         ("+" ((("+") pop)))
         ("*" ((("*") pop)))
@@ -764,28 +722,28 @@
     '(
       ("((S) ($ $))"
        (
-        ("(a b)" (reduce (a b ((A) (($ $)))) 1))
+        ("(a b)" (reduce (a b ((A) ($ $))) 1))
         ("($ $)" (reduce (e) 0))
         )
        )
       ("((A) ($ $))"
        (
         ("(b $)" (reduce (b) 3))
-        ("(a a)" (reduce (((S) ((a a))) a a) 2))
-        ("(a b)" (reduce (((S) ((a a))) a a) 2))
+        ("(a a)" (reduce (((S) (a a)) a a) 2))
+        ("(a b)" (reduce (((S) (a a)) a a) 2))
         )
        )
       ("((S) (a a))"
        (
         ("(a a)" (reduce (e) 0))
-        ("(a b)" (reduce (a b ((A) ((a a)))) 1))
+        ("(a b)" (reduce (a b ((A) (a a))) 1))
         )
        )
       ("((A) (a a))"
        (
         ("(b a)" (reduce (b) 3))
-        ("(a a)" (reduce (((S) ((a a))) a a) 2))
-        ("(a b)" (reduce (((S) ((a a))) a a) 2))
+        ("(a a)" (reduce (((S) (a a)) a a) 2))
+        ("(a b)" (reduce (((S) (a a)) a a) 2))
         )
        )
       ("b" (("(b b)" pop) ("(b a)" pop) ("(b $)" pop)))



reply via email to

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