[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
'(
- [elpa] externals/parser-generator 653b8edece 17/29: Added failing test for generate-f-sets, (continued)
- [elpa] externals/parser-generator 653b8edece 17/29: Added failing test for generate-f-sets, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 4c34af706f 29/29: Improved documentation, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator a175c1317a 08/29: Started on refactor of e-free-first function to properly handle a edge case, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 94fa7c3732 06/29: Cleaning up of e-free-first test, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator d2227ad65e 13/29: More wrestling with FIRST and E-FREE-FIRST calculation, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator d85a3ae246 16/29: Passing more tests, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator e2e464bb17 26/29: Updated version, date and TODO, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator dced2e199f 22/29: Sorting LR-action tables before outputting them in messages, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 69fc89898e 19/29: Passing all tests for FIRST and E-FREE-FIRST with new algorithm, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 6726c5231e 24/29: Fixed conflict, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 98dc561880 23/29: FIRST() and E-FREE-FIRST() passing LR-test for k=0,
Christian Johansson <=
- [elpa] externals/parser-generator 432e3732f2 20/29: Fixed some byte-compilation warnings, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator ba2bda38da 25/29: Added use of default conflict resolution flag in action-table generation, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 536198eb0a 27/29: Fixed typo in comment, Christian Johansson, 2022/02/12
- [elpa] externals/parser-generator 58548b8e10 21/29: Passing test for LR-parse with k=2 again, Christian Johansson, 2022/02/12