Package wyvern.tools.typedAST.interfaces

Examples of wyvern.tools.typedAST.interfaces.TypedAST.typecheck()


    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());
    Assert.assertEquals("IntegerConstant(13)", out.toString());
View Full Code Here


    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

        "";
    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()");
   
    // System.out.println(res.evaluate(Globals.getStandardEnv()).toString());
   
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "()");   
  }
View Full Code Here

   
    // System.out.println("Parsed OK.");
   
    // System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    // System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "()");   
  }
View Full Code Here

        "";
    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()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
View Full Code Here

   
    System.out.println("Parsed OK.");
   
    System.out.println("typecheck returned: " + res.typecheck(Globals.getStandardEnv(), Optional.empty()));
   
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "()");   
  }
View Full Code Here

        "";
    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()));
   
    // Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()).toString(), "TYPE()");
   
    // System.out.println("evaluate returned: " + res.evaluate(Globals.getStandardEnv()).toString());
   
View Full Code Here

public class CopperTests {
  @Test(expected= ToolError.class)
  public void testVal2() throws IOException, CopperParserException {
    String input = "val yx:Int = false\nyx";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
  }
  @Test(expected= RuntimeException.class)
  public void testVal3() throws IOException, CopperParserException {
    String input = "val yx:Int = 3\nyx = 9\nyx";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
View Full Code Here

  }
  @Test(expected= RuntimeException.class)
  public void testVal3() throws IOException, CopperParserException {
    String input = "val yx:Int = 3\nyx = 9\nyx";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
  }
  @Test
  public void testDeclParams2() throws IOException, CopperParserException {
    String input =
        "def foo(x:Int,y:Int):Int = 5+x*y\n" +
View Full Code Here

  public void testDeclParams2() throws IOException, CopperParserException {
    String input =
        "def foo(x:Int,y:Int):Int = 5+x*y\n" +
            "foo(7,2)";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    Assert.assertEquals(res.typecheck(Globals.getStandardEnv(), Optional.empty()), Int.getInstance());
    Assert.assertEquals(res.evaluate(Globals.getStandardEnv()).toString(), "IntegerConstant(19)");
  }
  @Test
  public void testFwdDecls() throws IOException, CopperParserException {
    String 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.