Package wyvern.tools.typedAST.core.values

Examples of wyvern.tools.typedAST.core.values.IntegerConstant


public class TrivDSLParser implements ExtParser {
  @Override
  public TypedAST parse(ParseBuffer input) {
    New newv = new New(new HashMap<>(), null);
    TypedAST dbody = new IntegerConstant(Integer.parseInt(input.getSrcString().trim()));
    newv.setBody(new DeclSequence(Arrays.asList(new DefDeclaration("getValue", new Arrow(Unit.getInstance(), Int.getInstance()), new ArrayList<>(), dbody, false))));
    return newv;
  }
View Full Code Here


    Type metaType = Util.javaToWyvType(HasParser.class);


    final ExtParser parseri = str -> {
      New newv = new New(new HashMap<>(), null);
      TypedAST dbody = new IntegerConstant(Integer.parseInt(str.getSrcString().trim()));
      newv.setBody(new DeclSequence(Arrays.asList(new DefDeclaration("getValue", new Arrow(Unit.getInstance(), Int.getInstance()), new ArrayList<>(), dbody, false))));
      return newv;
    };

    HasParser inner = new HasParser() {
View Full Code Here

    Type metaType = Util.javaToWyvType(HasParser.class);


    final ExtParser parseri = str -> {
      New newv = new New(new HashMap<>(), null);
      TypedAST dbody = new IntegerConstant(Integer.parseInt(str.getSrcString().trim()));
      newv.setBody(new DeclSequence(Arrays.asList(new DefDeclaration("getValue", new Arrow(Unit.getInstance(), Int.getInstance()), new ArrayList<>(), dbody, false))));
      return newv;
    };

    HasParser inner = new HasParser() {
View Full Code Here

  }

  @Test
  public void testSplice1() throws IOException, CopperParserException {
    TypedAST testAST = new Sequence(
        new ValDeclaration("x", new IntegerConstant(4), null),
        new Application(new TSLBlock(new Fn(Arrays.asList(new NameBindingImpl("x", Int.getInstance())),
            new SpliceExn(new Variable(new NameBindingImpl("x", Int.getInstance()), null)))), new IntegerConstant(9), null) );
    Type result = testAST.typecheck(Globals.getStandardEnv(), Optional.<Type>empty());
    Value out = testAST.evaluate(Globals.getStandardEnv());
    int finalRes = ((IntegerConstant)out).getValue();
    Assert.assertEquals(4, finalRes);
  }
View Full Code Here

TOP

Related Classes of wyvern.tools.typedAST.core.values.IntegerConstant

Copyright © 2018 www.massapicom. 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.