Permalink
Browse files

clearley.earley -> clearley.glr

  • Loading branch information...
mthvedt committed Jan 20, 2013
1 parent 6963591 commit 58100344f3591842881e67db87de5f63c38b2ed6
Showing with 6 additions and 5 deletions.
  1. +4 −2 src/clearley/core.clj
  2. +2 −3 src/clearley/{earley.clj → glr.clj}
View
@@ -8,10 +8,12 @@
See the high-level docs for a further background and overview."
(require [clojure string]
[clojure.pprint])
- (use [clearley utils rules earley]))
+ (use [clearley utils rules glr]))
; Anything a programmer would need when requiring Clearley is here.
; Because I like short files, other stuff is shuffled into various files.
+; TODO add execute
+
(defn rule
"Creates a context-free grammar rule. A rule has a required seq of clauses,
an optional name, and an optional action.
@@ -109,7 +111,7 @@
(pstr-charts (parse-charts input rules tokenizer goal))))))
(defn print-match
- "Prints a pretty shorthand tree to *out*."
+ "Pretty-prints a match tree to *out*."
[match]
((fn f [{:keys [rule submatches]} depth]
(println (apply str (repeat depth " ")) (clause-str rule))
@@ -1,5 +1,4 @@
-; TODO rename
-(ns clearley.earley
+(ns clearley.glr
(require [clearley.collections.ordered-set :as os]
[clearley.collections.ordered-multimap :as omm]
[clearley.npda :as npda])
@@ -113,7 +112,7 @@
; (think of a Forth operator reducing the top of a stack)
; Final output (for a valid parse) will be a singleton list
(defn reduce-ostream-helper [ostream item]
- (if (instance? clearley.earley.Item item)
+ (if (instance? clearley.glr.Item item)
(let [{:keys [match-count original]} item]
(cons (match original (vec (reverse (take match-count ostream))))
(drop match-count ostream)))

0 comments on commit 5810034

Please sign in to comment.