From d54ce42ddb083aff2a1df4d8db79d6dbefab0189 Mon Sep 17 00:00:00 2001 From: Jack Firth Date: Sat, 2 Apr 2022 19:05:34 -0700 Subject: [PATCH] Add a comment explaining the most confusing SPFF detail --- grammar.rkt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grammar.rkt b/grammar.rkt index 5795e55..621b76e 100644 --- a/grammar.rkt +++ b/grammar.rkt @@ -141,6 +141,9 @@ (hash-update! (sppf-forest-hash forest) label (λ (children) (cons pair children)) '())) +;; SPPF trees walk each rule down the left side, and each right child of the left spine corresponds to +;; the rule's components. See https://twitter.com/doitwithalambda/status/1510217894776348681 for a +;; diagram of the binarised parse tree. (struct sppf-child-pair (left-child right-child) #:transparent) (struct sppf-key () #:transparent) (struct complete-sppf-key sppf-key (symbol input-start input-end) #:transparent)