[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/parser-generator 7eb8cab 397/434: Small fixes to docume
From: |
ELPA Syncer |
Subject: |
[elpa] externals/parser-generator 7eb8cab 397/434: Small fixes to documentation about syntax analysis |
Date: |
Mon, 29 Nov 2021 16:00:24 -0500 (EST) |
branch: externals/parser-generator
commit 7eb8cab8e2e9646aa27b602934e0d1f396910c1e
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Small fixes to documentation about syntax analysis
---
docs/Syntax-Analysis.md | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/docs/Syntax-Analysis.md b/docs/Syntax-Analysis.md
index 9659f1e..a4c0816 100644
--- a/docs/Syntax-Analysis.md
+++ b/docs/Syntax-Analysis.md
@@ -42,13 +42,15 @@ Grammar consists of `N`, `T`, `P` and `S`, where `N` is
non-terminals, `T` is te
Example:
``` emacs-lisp
+(require 'parser-generator)
+
(parser-generator-set-grammar '((S A B C) (a b c) ((S (A B)) (A (B a) e) (B (C
b) C) (C c e)) S))
```
Productions can include context-sensitive attributes like this:
``` emacs-lisp
-((S (A B %prec first)) (A (B a %weight) e) (B (C b) C) (C c e))
+((S (A B %prec first)) (A (B a %weight c) e) (B (C b) C) (C c e))
```
### Global attributes
@@ -112,6 +114,8 @@ Is a simple integer above zero. You set it like this:
`(parser-generator-set-loo
A optional translation is defined as a lambda function as the last element of
a production right-hand-side, example:
```emacs-lisp
+(require 'parser-generator)
+
(parser-generator-set-grammar
'((Sp S) ("a" "b") ((Sp S) (S (S "a" S "b" (lambda(args) (nreverse args))))
(S e)) Sp))
```
@@ -123,6 +127,8 @@ You cannot have a SDT + SA on the same production
right-hand side, just one or t
A optional semantic action is defined as a lambda function as the last element
of a production right-hand-side, example:
```emacs-lisp
+(require 'parser-generator)
+
(parser-generator-set-grammar
'((Sp S) ("a" "b") ((Sp S) (S (S "a" S "b" (lambda(args) (nreverse args))))
(S e)) Sp))
```
@@ -136,13 +142,13 @@ You cannot have a SDT + SA on the same production
right-hand side, just one or t
Calculate the first look-ahead number of terminals of the sentential-form `S`,
example:
``` emacs-lisp
+(require 'parser-generator)
(require 'ert)
(parser-generator-set-grammar
'((S A B C) (a b c) ((S (A B)) (A (B a) e) (B (C b) C) (C c e)) S))
(parser-generator-set-look-ahead-number 2)
(parser-generator-process-grammar)
-
(should
(equal
'((a) (a c) (a b) (c a) (b a) (e) (c) (b) (c b))
@@ -154,6 +160,7 @@ Calculate the first look-ahead number of terminals of the
sentential-form `S`, e
Calculate the e-free-first look-ahead number of terminals of sentential-form
`S`, if you have multiple symbols the e-free-first will only affect the first
symbol, the rest will be treated via first-function (above). Example:
``` emacs-lisp
+(require 'parser-generator)
(require 'ert)
(parser-generator-set-grammar
@@ -172,6 +179,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 'parser-generator)
(require 'ert)
(parser-generator-set-grammar
@@ -185,5 +193,4 @@ Calculate the look-ahead number of terminals possibly
following S.
(parser-generator--follow 'A)))
```
-
[Back to start](../../../)
- [elpa] externals/parser-generator 3170e8d 370/434: Context-sensitive precedence now avoids conflict-detection, (continued)
- [elpa] externals/parser-generator 3170e8d 370/434: Context-sensitive precedence now avoids conflict-detection, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 1be5fda 374/434: More work on support for conflict resolution, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 8e462cf 378/434: Validated generated action and goto-tables after precedence modification, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 6a7343e 383/434: Started on refactoring precedence table generation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 8013f69 384/434: Unit tests for testing precedence table generation now passes, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e070522 396/434: Fixed broken link in documentation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 5b95baf 401/434: More work on last feature, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 4da88bf 406/434: Added another test for e-identifier in middle of rule, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 72796d0 408/434: Fixed bug with FIRST calculation with multiple symbols and e-identifiers, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 843bc57 398/434: Fixed invalid reference to parser-generator to fetch translation by production number, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 7eb8cab 397/434: Small fixes to documentation about syntax analysis,
ELPA Syncer <=
- [elpa] externals/parser-generator 3a178ed 393/434: Exported LR parser now passes all tests, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator c606043 389/434: Passing all tests with new precedence generation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator cfa9561 407/434: Added TODO item, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 21fef5c 388/434: Passing all tests for infix calculator, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 4fe014a 394/434: Updating documentation regarding operator precedence, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator aafb3cc 411/434: Passing test for grammar containing e-identifier in middle or a rule, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator b8de1c4 414/434: LR-exporter now supports optional header, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator e157091 413/434: Fixed error signaling in invalid LR-parser and generated LR-parser, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 827aa5c 433/434: Another bug for same thing, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator ee78a6c 430/434: LR-parser now passes terminal data to SDT for non-terminals containing only one symbol, ELPA Syncer, 2021/11/29