branch: externals/parser-generator
commit a18a23df4f51c083ff6628baee7ab3c06badcedc
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Updated info about SDT and SA
---
docs/Syntax-Analysis.md | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/Syntax-Analysis.md b/docs/Syntax-Analysis.md
index fc1b0f1a..f609665 100644
--- a/docs/Syntax-Analysis.md
+++ b/docs/Syntax-Analysis.md
@@ -78,11 +78,23 @@ Is a simple integer above zero. You set it like this:
`(parser-generator-set-loo
### Syntax-directed-translation (SDT)
-*WIP* Where should this be defined?
+A optional translation is defined as a lambda function as the last element of
a production right-hand-side, example:
+
+```
+(parser-generator-set-grammar '((Sp S) ("a" "b") ((Sp S) (S (S "a" S "b"
(lambda(args) (nreverse args)))) (S e)) Sp))
+```
+
+You cannot have a SDT+SA on the same production right-hand side, just one or
the other.
### Semantic-actions (SA)
-*WIP* Where should this be defined?
+A optional semantic-action is defined as a lambda function as the last element
of a production right-hand-side, example:
+
+```
+(parser-generator-set-grammar '((Sp S) ("a" "b") ((Sp S) (S (S "a" S "b"
(lambda(args) (nreverse args)))) (S e)) Sp))
+```
+
+You cannot have a SDT+SA on the same production right-hand side, just one or
the other.
## Functions