Examples of Wyvern


Examples of wyvern.tools.parsing.Wyvern

    WyvernResolver.clearFiles();
    WyvernResolver.addFile("tokenizer", tokenizer);
    WyvernResolver.addFile("parser", parser);
    WyvernResolver.addFile("typer", typer);

    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(user), "test input");
    Type result = res.typecheck(Globals.getStandardEnv(), Optional.<Type>empty());
    res = new DSLTransformer().transform(res);
    Assert.assertEquals("Int", result.toString());

    Value out = res.evaluate(Globals.getStandardEnv());
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "test.get()";
    WyvernResolver.clearFiles();
    WyvernResolver.addFile("parser", parser);
    WyvernResolver.addFile("supplier", supplier);

    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(client), "test input");
    Type result = res.typecheck(Globals.getStandardEnv(), Optional.<Type>empty());
    res = new DSLTransformer().transform(res);
    Value finalV = res.evaluate(Globals.getStandardEnv());
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "module TestModule\n" +
        "type M\n" +
        "  type A\n" +
        "    def create() : A\n" +
        "";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
   
    // System.out.println("Parsed OK.");
   
    // System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

        "module TestModule\n" +
        "type M\n" +
        "  class A\n" +
        "    def create() : A = new\n" +
        "";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
   
    System.out.println("Parsed OK.");
   
    System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

//        "val m2a : m2.A = m2.A.create()\n" +
//        "printInteger(m1a.foo())\n" + // 2
        "\n" +
        "printInteger(36)" + // This is to make this work for debugging as the above decls are w/o module.
        "";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
   
    System.out.println("Parsed OK.");
   
    System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    this.expectedType = expectedType;
  }

  @Override
  public void execute() throws IOException, CopperParserException {
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(code+"\n"), "test input");
    Assert.assertEquals(expectedType, res.typecheck(Globals.getStandardEnv(), Optional.<Type>empty()).toString());
    res = new DSLTransformer().transform(res);
    Value finalV = res.evaluate(Globals.getStandardEnv());
    Assert.assertEquals(expectedValue, finalV.toString());
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

    WyvernResolver.clearFiles();
    for (Pair<String,String> pair : modules) {
      WyvernResolver.addFile(pair.first, pair.second+"\n");
    }

    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(main), "test input");
    Assert.assertEquals(expectedType, res.typecheck(Globals.getStandardEnv(), Optional.<Type>empty()).toString());
    res = new DSLTransformer().transform(res);
    Value finalV = res.evaluate(Globals.getStandardEnv());
    Assert.assertEquals(expectedValue, finalV.toString());
  }
View Full Code Here

Examples of wyvern.tools.parsing.Wyvern

   * @throws IOException
   * @throws CopperParserException
   */
  public static TypedAST getAST(String program) throws CopperParserException, IOException {
    TagBinding.resetHACK();
    return (TypedAST)new Wyvern().parse(new StringReader(program), "test input");
  }
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.