import edu.berkeley.sbp.misc.*;
import edu.berkeley.sbp.meta.*;
import edu.berkeley.sbp.chr.*;
+import edu.berkeley.sbp.tib.*;
import java.io.*;
public class HaskellHelper {
-
- public static Tree main(String grammarFile, String targetFile) throws Throwable {
+ public static void main(String[] argv) throws Throwable { help(argv[0], argv[1]); }
+ public static boolean isNull(Object o) { return o==null; }
+ public static Tree help(String grammarFile, String targetFile) throws Throwable {
try {
Tree<String> res = new CharParser(MetaGrammar.newInstance()).parse(new FileInputStream(grammarFile)).expand1();
- Union meta = Grammar.create(res, "s",
- new Grammar.Bindings() {
- /*
- public Sequence createSequence(Production p) {
- Sequence ret = super.createSequence(p);
- if (ret != null) return ret;
- return Sequence.create(p.nonTerminal, p.elements, p.drops, false);
- }
- */
- });
- System.out.println();
- System.out.println();
- System.out.println();
- CharInput input = new CharInput(new FileInputStream(targetFile), "", true);
+ Union meta = GrammarBuilder.buildFromAST(res, "s", new File[0]);
+ Input input = new Tib(new FileInputStream(targetFile));
Tree ret = new CharParser(meta).parse(input).expand1();
if (ret==null) throw new NullPointerException("CharParser returned null");
return ret;
throw e;
}
}
-
-
}