checkpoint
[sbp.git] / src / edu / berkeley / sbp / tib / TibDoc.java
index 00ef9ce..2400ea4 100644 (file)
@@ -330,27 +330,27 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
 
     public static class TD {
 
-        public @nonterminal static class Doc extends Dump {
+        public @tag static class Doc extends Dump {
             public @arg Header head;
             public @arg Body body;
         }
 
-        public @nonterminal static class Header extends Dump {
+        public @tag static class Header extends Dump {
             public @arg KeyVal[] attrs;
             // FIXME: it would be nice to be able to
             // void KeyVal(String, String) { ... } imperatively
         }
         
-        public @nonterminal static class Body extends Dump {
+        public @tag static class Body extends Dump {
             public Section[] sections;
         }
         
-        public @nonterminal("Section") static class Section extends Dump {
+        public @tag("Section") static class Section extends Dump {
             public String      header;
             public Paragraph[] paragraphs;
         }
         
-        public @nonterminal static class KeyVal extends Dump {
+        public @tag static class KeyVal extends Dump {
             public @arg String key;
             public @arg Object val;
         }
@@ -522,8 +522,7 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
             Tree t = new CharParser(tibgram).parse(new Tib(new FileInputStream(s[1]))).expand1();
             System.out.println("tree:\n" + t.toPrettyString());
             
-            Reducer red = (Reducer)t.head();
-            Object result = red.reduce(t);
+            Object result = ((Functor)t.head()).invoke(t);
             System.out.println((TD.Doc)result);
             /*
             System.out.println("parsing " + s[0]);
@@ -535,15 +534,7 @@ toContex ll = prefix ++ (concatMap tl ll) ++ suffix
             System.out.println();
             System.out.println(f.expand1().toPrettyString());
             System.out.println();
-            Doc doc = (Doc)new ReflectiveGrammar(TibDoc.class).build(f.expand1());
-            System.out.println(doc);
-            System.out.println();
-            System.out.println();
-            System.out.println();
-            System.out.println();
-            StringBuffer sb = new StringBuffer();
-            doc.toHTML(new ToHTML.HTML(sb));
-            System.out.println(sb);
+
 
             FileOutputStream fos = new FileOutputStream("out.html");
             PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));