branch: externals/parser-generator commit c992a542639a50d2f34b625afe5a0f97ff6ff327 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added info in README.md about LR-items --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index aa3667c..66e088d 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,23 @@ We use push down transducer (PDT) based algorithms: #### Deterministic Shift-Reduce Parsing #### LR(k) #### Deterministic Right Parser for LR(k) Grammars + +A valid LR-item for a viable prefix has this structure: + +``` emacs-lisp +(A B C L) +``` + +Example with grammar with production: S -> SaSb and S is non-terminal and a, b are terminals. Look-ahead number: 1 + +``` emacs-lisp +(S nil (S a S b) (a)) +``` + +* A is the production LHS +* B, C is parts of the production RHS, if the dot is the left B is nil and C is the entire RHS. If the dot is at the right then B is the production RHS and C is nil, otherwise B and C contains parts of the RHS +* L is the terminal look-ahead + #### Formal Shift-Reduce Parsing Algorithms #### Simple Precedence Grammars #### Extended Precedence Grammars