Package ch.snowdon.minijava.sline.model.list

Examples of ch.snowdon.minijava.sline.model.list.LastExpList


  public static void main(String[] args) {

    Stm prog = new CompoundStm(new AssignStm("a", new OpExp(new NumExp(5),
        OpExp.Op.PLUS, new NumExp(3))), new CompoundStm(new AssignStm(
        "b", new EseqExp(new PrintStm(new PairExpList(new IdExp("a"),
            new LastExpList(new OpExp(new IdExp("a"),
                OpExp.Op.MINUS, new NumExp(1))))), new OpExp(
            new NumExp(10), OpExp.Op.TIMES, new IdExp("a")))),
        new PrintStm(new LastExpList(new IdExp("b")))));
   
    System.out.println("First prog:");
    prog.interpret();
    System.out.println();
   
    prog = new PrintStm(new PairExpList(new IdExp("a"),
        new LastExpList(new EseqExp(new PrintStm(new PairExpList(
            new IdExp("c"), new PairExpList(new IdExp("d"),
                new PairExpList(new IdExp("d"),
                    new LastExpList(new NumExp(3)))))),
            new IdExp("b")))));
   
    System.out.println("Second prog:");
    prog.interpret();
View Full Code Here


  public void maxArgsSimple() throws Exception {

    Stm prog = new CompoundStm(new AssignStm("a", new OpExp(new NumExp(5),
        OpExp.Op.PLUS, new NumExp(3))), new CompoundStm(new AssignStm(
        "b", new EseqExp(new PrintStm(new PairExpList(new IdExp("a"),
            new LastExpList(new OpExp(new IdExp("a"),
                OpExp.Op.MINUS, new NumExp(1))))), new OpExp(
            new NumExp(10), OpExp.Op.TIMES, new IdExp("a")))),
        new PrintStm(new LastExpList(new IdExp("b")))));

    assertEquals(2, prog.maxArgs());

    prog = new CompoundStm(new AssignStm("a", new OpExp(new NumExp(5),
        OpExp.Op.PLUS, new NumExp(3))), new CompoundStm(new AssignStm(
        "b", new NumExp(2)), new PrintStm(new LastExpList(
        new IdExp("b")))));

    assertEquals(1, prog.maxArgs());
  }
View Full Code Here

  @Test
  public void maxArgsNested() throws Exception {

    Stm prog = new PrintStm(new PairExpList(new IdExp("a"),
        new LastExpList(new EseqExp(new PrintStm(new PairExpList(
            new IdExp("c"), new PairExpList(new IdExp("d"),
                new PairExpList(new IdExp("d"),
                    new LastExpList(new NumExp(3)))))),
            new IdExp("b")))));

    assertEquals(4, prog.maxArgs());
  }
View Full Code Here

TOP

Related Classes of ch.snowdon.minijava.sline.model.list.LastExpList

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.