|
|
@ -3,21 +3,25 @@
|
|
|
|
;; `parser', except that it works on an arbitrary CFG (returning
|
|
|
|
;; `parser', except that it works on an arbitrary CFG (returning
|
|
|
|
;; the first sucecssful parse).
|
|
|
|
;; the first sucecssful parse).
|
|
|
|
|
|
|
|
|
|
|
|
;; It's a backtracking parser. Alternative for a non-terminal are
|
|
|
|
;; I'm pretty sure that this is an implementation of Earley's
|
|
|
|
;; computed in parallel, and multiple attempts to compute the same
|
|
|
|
;; algorithm.
|
|
|
|
;; result block until the first one completes. If you get into
|
|
|
|
|
|
|
|
;; deadlock, such as when trying to match
|
|
|
|
;; 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
|
|
|
|
;; <foo> := <foo>
|
|
|
|
;; <foo> := <foo>
|
|
|
|
;; then it means that there's no successful parse, so everything
|
|
|
|
;; then it means that there's no successful parse, so everything
|
|
|
|
;; that's blocked fails.
|
|
|
|
;; that's blocked fails.
|
|
|
|
|
|
|
|
|
|
|
|
;; Caching remember the series of results for a particular
|
|
|
|
;; A cache holds the series of results for a particular non-terminal
|
|
|
|
;; non-terminal at a particular starting location. Otherwise, the
|
|
|
|
;; at a particular starting location. (A series is used, instead of a
|
|
|
|
;; parser uses backtracking search. Backtracking is implemented
|
|
|
|
;; sinlge result, for backtracking.) Otherwise, the parser uses
|
|
|
|
;; through explicit success and failure continuations. Multiple
|
|
|
|
;; backtracking search. Backtracking is implemented through explicit
|
|
|
|
;; results for a particular nonterminal and location are kept only
|
|
|
|
;; success and failure continuations. Multiple results for a
|
|
|
|
;; when they have different lengths. (Otherwise, in the spirit of
|
|
|
|
;; particular nonterminal and location are kept only when they have
|
|
|
|
;; finding one successful parse, only the first result is kept.)
|
|
|
|
;; 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
|
|
|
|
;; The parser-tools's `parse' is used to transform tokens in the
|
|
|
|
;; grammar to tokens specific to this parser. In other words, this
|
|
|
|
;; grammar to tokens specific to this parser. In other words, this
|
|
|
|