adjust misc for changes in meta
[sbp.git] / src / edu / berkeley / sbp / misc / Java15.java
1 // Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
2
3 // Copyright 2006 the Contributors, as shown in the revision logs.
4 // Licensed under the Apache Public Source License 2.0 ("the License").
5 // You may not use this file except in compliance with the License.
6
7 package edu.berkeley.sbp.misc;
8 import edu.berkeley.sbp.*;
9 import edu.berkeley.sbp.misc.*;
10 import edu.berkeley.sbp.meta.*;
11 import edu.berkeley.sbp.util.*;
12 import edu.berkeley.sbp.chr.*;
13 import java.util.*;
14 import java.io.*;
15
16 public class Java15 {
17     /*
18     public static void main(String[] s) throws Exception {
19
20         try {
21             Tree<String> res = new CharParser(MetaGrammar.newInstance()).parse(new FileInputStream(s[0])).expand1();
22             
23             //AnnotationGrammarBindings resolver = new AnnotationGrammarBindings(Java15.class);
24             Grammar.Bindings resolver = new Grammar.Bindings() {
25                     public Object repeatTag() { return ""; }
26                 };
27             Union javaGrammar = Grammar.create(res, "s", resolver);
28
29             System.err.println("parsing " + s[1]);
30             Tree t = new CharParser(javaGrammar).parse(new FileInputStream(s[1])).expand1();
31
32             System.out.println("tree:\n" + t.toPrettyString());
33
34         } catch (Ambiguous a) {
35             FileOutputStream fos = new FileOutputStream("/Users/megacz/Desktop/out.dot");
36             PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
37             GraphViz gv = new GraphViz();
38             a.getAmbiguity().toGraphViz(gv);
39             gv.dump(p);
40             p.flush();
41             p.close();
42             a.printStackTrace();
43             
44         } catch (Exception e) {
45             e.printStackTrace();
46         }
47
48     }
49     */
50 }