Examples of Wyvern


Examples of wyvern.tools.parsing.Wyvern

      System.exit(-1);
    }
   
    try {
      Reader reader = new FileReader(file);
      TypedAST res = (TypedAST) new Wyvern().parse(reader, filename);
      res.typecheck(Globals.getStandardEnv(), Optional.empty());
      res = new DSLTransformer().transform(res);
      Value finalV = res.evaluate(Globals.getStandardEnv());
      TreeWriter t = new TreeWriter();
      finalV.writeArgsToTree(t);
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

import java.util.Optional;

public class Compiler {
  public static TypedAST compileSources(String filename, List<String> sources) {
    try {
      TypedAST ast = (TypedAST) new Wyvern().parse(new StringReader(sources.get(0)), "test input");
      ast.typecheck(Globals.getStandardEnv(), Optional.<Type>empty());
      return ast;
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    // For test.. by Stanley
    //Path path = Paths.get(args[0]);
    //Files.lines(path).forEach(s -> System.out.println(s));
   
    try (FileInputStream fis = new FileInputStream(file)) {
      TypedAST res = (TypedAST)new Wyvern().parse(new InputStreamReader(fis), "test input");
      Type checkedType = res.typecheck(Globals.getStandardEnv(), Optional.empty());
      System.out.println("Result type: "+checkedType);
      res = new DSLTransformer().transform(res);
      Value finalV = res.evaluate(Globals.getStandardEnv());
      System.out.println("Result: "+finalV);
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    return new String(new char[] {(char)charCode});
  }

  public static TypedAST splice(ParseBuffer buffer) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(buffer.getSrcString()), "inner");
      return new SpliceExn(res);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    }
  }

  public static TypedAST spliceUnsafe(String str) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(str), "inner");
      return new SpliceExn(res);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    }
  }

  public static TypedAST splice(ParseBuffer buffer, String filename) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(buffer.getSrcString()), "inner");
      return new SpliceExn(res);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    }
  }

  public static SpliceBindExn spliceBinding(ParseBuffer buffer, List<NameBinding> bindings) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(buffer.getSrcString()), "inner");
      return new SpliceBindExn(res, bindings);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    }
  }

  public static SpliceBindExn spliceBinding(ParseBuffer buffer, List<NameBinding> bindings, String filename) {
    try {
      TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(buffer.getSrcString()), filename);
      return new SpliceBindExn(res, bindings);
    } catch (IOException | CopperParserException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "module TestModule\n" +
        "type TestType\n" +
        "  type TestTypeInner\n" +
        "    def bar() : Int\n" +
        "";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
   
    // System.out.println(res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    private TypedAST res;

    public WyvernBinder(String filename, Reader source) {
      res = null;
      try {
        res = (TypedAST)new Wyvern().parse(source, filename);
      } catch (IOException | CopperParserException e) {
        throw new RuntimeException(e);
      }
      res.typecheck(Globals.getStandardEnv(), Optional.<Type>empty());
      res = new DSLTransformer().transform(res);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.