Commits

Anonymous committed be5b0a0 Merge with conflicts

Merge branch 'master' into memoization

Conflicts:
comparse.scm

Comments (0)

Files changed (2)

  (author "Moritz Heidkamp")
  (category parsing)
  (license "BSD")
- (depends lazy-seq)
+ (depends lazy-seq latch)
  (test-depends test lazy-seq)
  (foreign-depends))
  repeated zero-or-more one-or-more
  any-of all-of none-of none-of*
  preceded-by followed-by enclosed-by
- as-string memoize memo-table)
+ as-string recursive-parser
+ memoize memo-table)
 
 (import chicken scheme)
 
-(use data-structures lazy-seq srfi-1 srfi-14 srfi-69 extras trie)
+(use data-structures lazy-seq srfi-1 srfi-14 srfi-69 extras latch trie)
 
 (define ((result value) input)
   (cons value input))
           (memo-set! parser input))
       (parser input)))
 
+(define-syntax recursive-parser
+  (syntax-rules ()
+    ((_ body ...)
+     (lambda ()
+       (lambda (input)
+         (let-once
+          ((parser (begin body ...)))
+          (parser input)))))))
+
 (define (->lazy-seq x)
   (cond ((lazy-seq? x) x)
         ((string? x) (list->lazy-seq (string->list x)))