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

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

[elpa] externals/parser-generator f940be9 033/434: Added list of functio


From: ELPA Syncer
Subject: [elpa] externals/parser-generator f940be9 033/434: Added list of functions and usage examples
Date: Mon, 29 Nov 2021 15:59:03 -0500 (EST)

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

    Added list of functions and usage examples
---
 README.md | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 6c2a381..d06fc41 100644
--- a/README.md
+++ b/README.md
@@ -62,13 +62,13 @@ A production consists of a list of at least two elements. 
The first element is t
 Example, production `S -> A | B` is defined as:
 
 ``` emacs-lisp
-(S A B)
+'(S A B)
 ```
 
 Another example, production `S -> IF "{" EXPRESSION "}" | EXIT` is declared as:
 
 ``` emacs-lisp
-(S (IF "{" EXPRESSION "}") EXIT)
+'(S (IF "{" EXPRESSION "}") EXIT)
 ```
 
 ### Look-ahead number
@@ -79,6 +79,32 @@ Is a simple integer above zero.
 
 The start symbol is either a string or a symbol and should exists in the list 
of productions as the LHS.
 
+## Functions
+
+### Calculate FIRST(k, S)
+
+Calculate first `k` terminals of sentential-form `S`, example:
+
+``` emacs-lisp
+(parser--set-grammar '((S A B C) (a b c) ((S (A B)) (A (B a) e) (B (C b) C) (C 
c e)) S) 2)
+(should
+  (equal
+    '((a) (a c) (a b) (c a) (b a) (e) (c) (b) (c b))
+    (parser--first 'S)))
+```
+
+### Calculate E-FREE-FIRST(k, S)
+
+Calculate e-free-first `k` terminals of sentential-form `S`, example:
+
+``` emacs-lisp
+(parser--set-grammar '((S A B C) (a b c) ((S (A B)) (A (B a) e) (B (C b) C) (C 
c e)) S) 2)
+(should
+  (equal
+    '((c b) (c a))
+    (parser--e-free-first 'S)))
+```
+
 ## Test
 
 Run in terminal `make clean && make tests && make compile`



reply via email to

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