[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/parser-generator 04a3ec5 141/434: Added separate file f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/parser-generator 04a3ec5 141/434: Added separate file for syntax analysis |
Date: |
Mon, 29 Nov 2021 15:59:27 -0500 (EST) |
branch: externals/parser-generator
commit 04a3ec5cbc92129c473a6c9d0ea1582989769ff1
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added separate file for syntax analysis
---
README.md | 139 +----------------------------------
docs/Lexical-Analysis.md | 24 ------
README.md => docs/Syntax-Analysis.md | 22 +-----
3 files changed, 7 insertions(+), 178 deletions(-)
diff --git a/README.md b/README.md
index 438ecd7..a0d263d 100644
--- a/README.md
+++ b/README.md
@@ -11,144 +11,11 @@ This is just started, so most stuff are *WIP*.
We use a regular-language based lexical analyzer that can be implemented by a
finite-state-machine (FSM). Read more [here](docs/Lexical-Analysis.md).
-## Syntax Analysis / Parsing
+## Syntax Analysis
-We use push down transducer (PDT) based algorithms.
+We use deterministic push down transducer (PDT) based algorithms. Read more
[here](docs/Syntax-Analysis.md).
-### With Backtracking
-
-* The Bottom-Up Parsing Algorithm *WIP*
-* The Top-Down Parsing Algorithm *WIP*
-* The Cocke-Younger-Kasami Algorithm *WIP*
-* The Parsing Method of Earley *WIP*
-
-### Without Backtracking
-
-* LL(k) *WIP*
-* Deterministic Shift-Reduce Parsing *WIP*
-* [LR(k)](docs/Deterministic-Right-Parser-for-LRk-Grammars.md)
-* Formal Shift-Reduce Parsing Algorithms *WIP*
-* Simple Precedence Grammars *WIP*
-* Extended Precedence Grammars *WIP*
-*Weak Precedence Grammars *WIP*
-* Bounded-Right-Context Grammars *WIP*
-* Mixed Strategy Precedence Grammars *WIP*
-* Operator Precedence Grammars *WIP*
-* Floyd-Evans Production Language *WIP*
-
-## Grammar
-
-Grammar consists of `N`, `T`, `P` and `S`, where `N` is non-terminals, `T` is
terminals, `P` is productions and `S` is start-production. Example:
-
-* N = `'(S A B C)`
-* T = `'(a b c)`
-* P = `'((S (A B)) (A (B a) e) (B (C b) C) (C c e))`
-* S = `'S`
-
-``` emacs-lisp
-(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))
-```
-
-### e
-
-The symbol defined in variable `parser-generator--e-identifier`, with
default-value: 'e`, symbolizes the e symbol. The symbol is allowed in some
grammars and not in others.
-
-### Non-terminals
-
-A non-terminal is either a symbol or a string so `"A"` and `A` are equally
valid.
-
-### Terminals
-
-A terminal is either a symbol or a string so `"{"` and `A` are equally valid.
-
-### Sentential-form
-
-A list of one or more non-terminals and terminals, example `'(A "A" c ":")`,
the e-symbol is allowed depending on grammar.
-
-### Productions
-
-A production consists of a list of at least two elements. The first element is
the left-hand-side (LHS) and should contain at least one element. The
right-hand-side (RHS) consists of the rest of the elements, if there is more
than one list in RHS then each list will be treated as a alternative production
RHS.
-
-Example, production `S -> A | B` is defined as:
-
-``` emacs-lisp
-'(S A B)
-```
-
-Another example, production `S -> IF "{" EXPRESSION "}" | EXIT` is declared as:
-
-``` emacs-lisp
-'(S (IF "{" EXPRESSION "}") EXIT)
-```
-
-### Start
-
-The start symbol is the entry-point of the grammar and should be either a
string or a symbol and should exists in the list of productions as the LHS.
-
-### Look-ahead number
-
-Is a simple integer above zero. You set it like this:
`(parser-generator--set-look-ahead-number 1)` for `1` number look-ahead.
-
-### Syntax-directed-translation (SDT)
-
-*WIP* Where should this be defined?
-
-### Semantic-actions (SA)
-
-*WIP* Where should this be defined?
-
-## Functions
-
-### FIRST(S)
-
-Calculate the first look-ahead number of terminals of the sentential-form `S`,
example:
-
-``` emacs-lisp
-(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))
- (parser-generator--first 'S)))
-```
-
-### E-FREE-FIRST(S)
-
-Calculate the e-free-first look-ahead number of terminals of sentential-form
`S`, example:
-
-``` emacs-lisp
-(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
- '((c b) (c a))
- (parser-generator--e-free-first 'S)))
-```
-
-### FOLLOW(S)
-
-Calculate the look-ahead number of terminals possibly following S.
-
-``` emacs-lisp
-(require 'ert)
-
-(parser-generator--set-grammar '((S A B) (a c d f) ((S (A a)) (A B) (B (c f)
d)) S))
-(parser-generator--set-look-ahead-number 2)
-(parser-generator--process-grammar)
-
-(should
- (equal
- '((a))
- (parser-generator--follow 'A)))
-```
+[docs/Syntax-Analysis.md]:
## Test
diff --git a/docs/Lexical-Analysis.md b/docs/Lexical-Analysis.md
index ae71ff9..711703c 100644
--- a/docs/Lexical-Analysis.md
+++ b/docs/Lexical-Analysis.md
@@ -70,28 +70,4 @@ Returns the next token in stream and moves index one forward.
(parser-generator-lex-analyzer--pop-token)))
```
-## Example
-
-``` emacs-lisp
-(setq
- parser-generator-lex-analyzer--function
- (lambda (index length)
- (let* ((string '(("a" 1 . 2) ("b" 2 . 3) ("c" 3 . 4) ("d" 4 . 5)))
- (string-length (length string))
- (max-index (+ index length))
- (tokens))
- (while (and
- (< index string-length)
- (< index max-index))
- (push (nth index string) tokens)
- (setq index (1+ index)))
-(nreverse tokens))))
-(parser-generator-lex-analyzer--reset)
-(setq parser-generator--look-ahead-number 1)
- (should
- (equal
- '(("a" 1 . 2))
- (parser-generator-lex-analyzer--peek-next-look-ahead)))
-```
-
[Back to start](../../../)
diff --git a/README.md b/docs/Syntax-Analysis.md
similarity index 77%
copy from README.md
copy to docs/Syntax-Analysis.md
index 438ecd7..a37ff83 100644
--- a/README.md
+++ b/docs/Syntax-Analysis.md
@@ -1,28 +1,15 @@
-# Emacs Parser Generator
-
-[](https://www.gnu.org/licenses/gpl-3.0.txt)
-[](https://travis-ci.org/cjohansson/emacs-parser-generator)
-
-The idea of this plugin is to provide functions for various kinds of
context-free grammar parser generations with support for
syntax-directed-translations (SDT) and semantic-actions. This project is about
implementing algorithms described in the book `The Theory of Parsing,
Translation and Compiling (Volume 1)` by `Alfred V. Aho and Jeffrey D. Ullman`
(1972). Also this project is about me learning how to parse languages.
-
-This is just started, so most stuff are *WIP*.
-
-## Lexical Analysis
-
-We use a regular-language based lexical analyzer that can be implemented by a
finite-state-machine (FSM). Read more [here](docs/Lexical-Analysis.md).
-
-## Syntax Analysis / Parsing
+# Syntax Analysis / Parsing
We use push down transducer (PDT) based algorithms.
-### With Backtracking
+## With Backtracking
* The Bottom-Up Parsing Algorithm *WIP*
* The Top-Down Parsing Algorithm *WIP*
* The Cocke-Younger-Kasami Algorithm *WIP*
* The Parsing Method of Earley *WIP*
-### Without Backtracking
+## Without Backtracking
* LL(k) *WIP*
* Deterministic Shift-Reduce Parsing *WIP*
@@ -150,6 +137,5 @@ Calculate the look-ahead number of terminals possibly
following S.
(parser-generator--follow 'A)))
```
-## Test
-Run in terminal `make clean && make tests && make compile`
+[Back to start](../../../)
- [elpa] externals/parser-generator 89d128c 123/434: Added TODO item, (continued)
- [elpa] externals/parser-generator 89d128c 123/434: Added TODO item, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 044f33a 151/434: Added more support for SDT, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 96f128f 155/434: More various stuff, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator a586a0e 162/434: More work on incremental parsing, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 6d323a4 120/434: Implemented reduce action of LR-parser algorithm, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 9b44827 124/434: Optimized LR-parser with hash-tables, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 01fc56f 127/434: Updated list of grammars, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 4ef0430 133/434: White-space fix, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator b2fd896 136/434: Added support for indexed tokens, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 4746c64 137/434: Updated example for LR parse with indexed tokens, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 04a3ec5 141/434: Added separate file for syntax analysis,
ELPA Syncer <=
- [elpa] externals/parser-generator 71e4eaa 145/434: Merge branch 'master' of git.cvj.se:/home/git/emacs-parser-generator, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 173fe94 152/434: Preparations for translation, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator be557ba 013/434: More work on refactor, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator fdbdff7 157/434: Added unit test for SDT in LR-parser, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 2d56ab0 160/434: Made separate functions for parse and translate in LR-parser, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator 7cfdea2 165/434: Passing tests for incremental lexer, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator b072fdd 175/434: Passed test for trailing e-identifier in EFF function, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator d435e50 122/434: Passing unit test for LR-parse, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator a31da28 173/434: Updated Parser WIP items, ELPA Syncer, 2021/11/29
- [elpa] externals/parser-generator aaec6fa 189/434: Work on e-free first tests, ELPA Syncer, 2021/11/29