From 79465df15c0ad8113edf10bbec806c4e71efdd20 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 18 Nov 2005 20:42:13 +0000 Subject: [PATCH] fixed comments svn: r1347 original commit: df94948e8fb9fe1c881499401fb4e95bc6a0820f --- collects/algol60/cfg-parser.ss | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/collects/algol60/cfg-parser.ss b/collects/algol60/cfg-parser.ss index a67e16a..3491e8c 100644 --- a/collects/algol60/cfg-parser.ss +++ b/collects/algol60/cfg-parser.ss @@ -3,21 +3,25 @@ ;; `parser', except that it works on an arbitrary CFG (returning ;; the first sucecssful parse). -;; It's a backtracking parser. Alternative for a non-terminal are -;; computed in parallel, and multiple attempts to compute the same -;; result block until the first one completes. If you get into -;; deadlock, such as when trying to match +;; I'm pretty sure that this is an implementation of Earley's +;; algorithm. + +;; To a first approximation, it's a backtracking parser. Alternative +;; for a non-terminal are computed in parallel, and multiple attempts +;; to compute the same result block until the first one completes. If +;; you get into deadlock, such as when trying to match ;; := ;; then it means that there's no successful parse, so everything ;; that's blocked fails. -;; Caching remember the series of results for a particular -;; non-terminal at a particular starting location. Otherwise, the -;; parser uses backtracking search. Backtracking is implemented -;; through explicit success and failure continuations. Multiple -;; results for a particular nonterminal and location are kept only -;; when they have different lengths. (Otherwise, in the spirit of -;; finding one successful parse, only the first result is kept.) +;; A cache holds the series of results for a particular non-terminal +;; at a particular starting location. (A series is used, instead of a +;; sinlge result, for backtracking.) Otherwise, the parser uses +;; backtracking search. Backtracking is implemented through explicit +;; success and failure continuations. Multiple results for a +;; particular nonterminal and location are kept only when they have +;; different lengths. (Otherwise, in the spirit of finding one +;; successful parse, only the first result is kept.) ;; The parser-tools's `parse' is used to transform tokens in the ;; grammar to tokens specific to this parser. In other words, this