summaryrefslogtreecommitdiff
path: root/fast/parse.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-23 22:59:16 +0100
committerPatrick Simianer <p@simianer.de>2014-08-23 22:59:16 +0100
commitcef65063cec641a93973b38a48e100fdd115db44 (patch)
tree32d5f10757e021a9fad01156fbff62a96212f006 /fast/parse.cc
parent190f68c880eb27506669e95e2bc0493e2ec42c4c (diff)
rewritten grammar
Diffstat (limited to 'fast/parse.cc')
-rw-r--r--fast/parse.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/fast/parse.cc b/fast/parse.cc
new file mode 100644
index 0000000..06c9fa0
--- /dev/null
+++ b/fast/parse.cc
@@ -0,0 +1,55 @@
+#include "parse.hh"
+
+
+namespace Parse {
+
+
+} //
+
+
+vector<G::T> tokenize(string s)
+{
+ istringstream ss(s);
+ vector<G::T> res;
+ while (ss.good()) {
+ string t;
+ ss >> t;
+ G::T i(t);
+ cout << i.word << endl;
+ res.push_back(i);
+ }
+ return res;
+}
+
+
+bool operator==(vector<G::Item> const& a, vector<G::Item> const& b)
+{
+ if (a.size() != b.size()) return false;
+ for (auto it: a)
+}
+
+int main(int argc, char** argv)
+{
+ string in("karten haie");
+ vector<G::T> tok = tokenize(in);
+ for (auto it: tok)
+ cout << it.word << ",";
+ cout << endl;
+ size_t n = tok.size();
+
+ G::Grammar g(argv[1]);
+
+ vector<Span> spans;
+ Parse::visit(spans, 1, 0, 6);
+ for (auto it: spans) {
+ cout << "(" << it.first << "," << it.second << ")" << endl;
+ }
+
+ Parse::Chart active(n);
+ Parse::Chart passive(n);
+
+ //init(tok, n, active, passive, g);
+
+ cout << *(g.flat.at(0)) << endl;
+}
+