branch: externals/parser-generator commit 00ffcde76a7d97f07d3c25871203dc2f887f0f7d Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added TODO items --- parser.el | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/parser.el b/parser.el index 043e661..c0e7f77 100644 --- a/parser.el +++ b/parser.el @@ -701,18 +701,30 @@ (puthash 'e lr-items-e lr-items)) - ;; 2 Suppose that we have constructed V(X1,X2,...,Xi-1) + ;; TODO 2 Suppose that we have constructed V(X1,X2,...,Xi-1) ;; we construct V(X1,X2,...,Xi) as follows: - - ;; (a) If [A -> a . XiB, u] is in V(X1,...,Xi-1) - ;; add [A -> aXi . B, u] to V(X1,...,Xi) - - ;; (b) If [A -> a . Bb, u] has been placed in V(X1,...,Xi) - ;; and B -> D is in P - ;; then add [B -> . D, x] to V(X1,...,Xi) for each x in FIRST(bu) - ;; provided it is not already there - - ;; (c) Repeat step (2b) until no more new items can be added to V(X1,...,Xi) + (let ((prefix-acc) + (prefix-new) + (prefix-previous (gethash 'e lr-items))) + (dolist (prefix γ) + (setq prefix-acc (append prefix-acc prefix)) + + (dolist (lr-item prefix-previous) + ;; TODO (a) If [A -> a . XiB, u] is in V(X1,...,Xi-1) + ;; add [A -> aXi . B, u] to V(X1,...,Xi) + ) + + ;; TODO (c) Repeat step (2b) until no more new items can be added to V(X1,...,Xi) + (let ((added-new t)) + (while added-new + (setq added-new nil) + (dolist (lr-item prefix-new) + ;; TODO (b) If [A -> a . Bb, u] has been placed in V(X1,...,Xi) + ;; and B -> D is in P then add [B -> . D, x] to V(X1,...,Xi) for each x in FIRST(bu) + ;; provided it is not already there + ))) + + (setq prefix-previous prefix-acc))) lr-items)))