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

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

[elpa] externals/parser-generator 21164b6 064/434: Added documentation f


From: ELPA Syncer
Subject: [elpa] externals/parser-generator 21164b6 064/434: Added documentation for (lr-items)
Date: Mon, 29 Nov 2021 15:59:09 -0500 (EST)

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

    Added documentation for (lr-items)
---
 README.md | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/README.md b/README.md
index 204af73..8d1196f 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,7 @@ Calculate the e-free-first look-ahead number of terminals 
of sentential-form `S`
 Calculate the look-ahead number of terminals possibly following S.
 
 ``` emacs-lisp
+(require 'ert)
 (parser--set-grammar '((S A B) (a c d f) ((S (A a)) (A B) (B (c f) d)) S))
 (parser--set-look-ahead-number 2)
 (should
@@ -138,6 +139,36 @@ Calculate the look-ahead number of terminals possibly 
following S.
    (parser--follow 'A)))
 ```
 
+### LR(k) items - V(S)
+
+Calculate the set of LR(k) items valid for any viable prefix S.
+
+``` emacs-lisp
+(require 'ert)
+(parser--set-grammar '((Sp S) (a b) ((Sp S) (S (S a S b)) (S e)) Sp))
+(parser--set-look-ahead-number 1)
+(should
+  (equal
+    '((S nil nil (a))
+    (S nil (S a S b) (a))
+    (S nil nil (e))
+    (S nil (S a S b) (e))
+    (Sp nil (S) (e)))
+    (parser--lr-items 'e)))
+```
+
+``` emacs-lisp
+(require 'ert)
+(parser--set-grammar '((Sp S) (a b) ((Sp S) (S (S a S b)) (S e)) Sp))
+(parser--set-look-ahead-number 1)
+(should
+  (equal
+    '((Sp (S) nil (e))
+      (S (S) (a S b) (e))
+      (S (S) (a S b) (a)))
+    (parser--lr-items 'S)))
+```
+
 ## Test
 
 Run in terminal `make clean && make tests && make compile`



reply via email to

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