Package wyvern.tools.typedAST.interfaces

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


        "val test = (new.x())+9/3-3\n" +
            "  val d = 4\n" +
            "  def x():Int = 7\n" +
            "test\n";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
    Assert.assertEquals("IntegerConstant(7)",res.evaluate(Globals.getStandardEnv()).toString());
  }
  @Test
  public void testNew3() throws IOException, CopperParserException {
    String input =
View Full Code Here


            "  val d = new\n" +
            "    val k = 19\n" +
            "  def x():Int = 7\n" +
            "test\n";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
    Assert.assertEquals("IntegerConstant(19)",res.evaluate(Globals.getStandardEnv()).toString());
  }
  @Test
  public void testNew4() throws IOException, CopperParserException {
    String input =
View Full Code Here

        "val x = 3\n" +
        "val test = new\n" +
        "  val x = x\n" +
        "test.x\n";
    TypedAST res = (TypedAST)new Wyvern().parse(new StringReader(input), "test input");
    res.typecheck(Globals.getStandardEnv(), Optional.empty());
    Assert.assertEquals("IntegerConstant(3)",res.evaluate(Globals.getStandardEnv()).toString());
  }
 
  // admittedly this is only a starting point....
  @Test
View Full Code Here

  }

  @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

    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

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.