Package hampi.grammars.apps

Examples of hampi.grammars.apps.GrammarStringBounder


    assertNotNull(boundedRegexp);
  }

  public void testTinySQL() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "SelectStmt", 26, false);
    //"SELECT" is one terminal and 6 characters
    assertNotNull(boundedRegexp);
    //    System.out.println(boundedRegexp);
    assertNotNull(boundedRegexp);
  }
View Full Code Here


  }

  //stack overflow because of production T = T;
  public void testUselessProductionCycle1() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "testUselessProductionCycle1.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", 1, false);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    assertNotNull(boundedRegexp);
  }

  public void testUselessProductionCycle2() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "testUselessProductionCycle2.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", 3, false);
    assertNotNull(boundedRegexp);
  }
View Full Code Here

    }
  }

  public void testGrammarBound1() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_generate_parent.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "expr", 16, false);

    Hampi h = new Hampi();
    h.setSolver(stp());
    Constraint rc = h.regexpConstraint(h.varExpr("v"), true, boundedRegexp);
    Regexp threeOpens = h.concatRegexp(h.constRegexp("((("), h.starRegexp(h.orRegexp(h.constRegexp("("), h.constRegexp(")"))));
View Full Code Here

    System.out.println(solve);
  }

  public void testGrammarBound2() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_arithm.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 24;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
    h.setSolver(stp());
    Constraint rc = h.regexpConstraint(h.varExpr("v"), true, boundedRegexp);
    Regexp sigmaStar = h.starRegexp(h.orRegexp(h.orRegexp(charRegexp(alpha, h))));
View Full Code Here

  }

  public void testGrammarBound3() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_arithm.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 11;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
    h.setSolver(stp());
    Constraint rc = h.regexpConstraint(h.varExpr("v"), true, boundedRegexp);
    Regexp sigmaStar = h.starRegexp(h.orRegexp(h.orRegexp(charRegexp(alpha, h))));
View Full Code Here

    System.out.println(solve);
  }

  public void testGrammarBound4() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "test_arithm.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 9;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
    h.setSolver(stp());
    Constraint rc = h.regexpConstraint(h.varExpr("v"), true, boundedRegexp);
    Regexp sigmaStar = h.starRegexp(h.orRegexp(h.orRegexp(charRegexp(alpha, h))));
View Full Code Here

    return result;
  }

  public void testGrammarBound5() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 21;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "UpdateStmt", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
    h.setSolver(stp());
    Regexp sigmaStar = h.starRegexp(h.orRegexp(h.orRegexp(charRegexp(alpha, h))));
View Full Code Here

    System.out.println(solve);
  }

  public void testGrammarBound6() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 21;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "UpdateStmt", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
    h.setSolver(stp());
    Regexp sigmaStar = h.starRegexp(h.orRegexp(h.orRegexp(charRegexp(alpha, h))));
    Expression query = h.concatExpr(h.constExpr("UPDATE c SET w='"), h.varExpr("v"), h.constExpr("'"));
View Full Code Here

    System.out.println(solve);
  }

  public void testGrammarBound7_comment() throws Exception{
    Grammar g = new Parser(GrammarTests.DIR + "tiny_SQL.txt").parse();
    GrammarStringBounder gsb = new GrammarStringBounder();
    int bound = 20;
    Regexp boundedRegexp = gsb.getBoundedRegexp(g, "S", bound, false);
    Set<Character> alpha = boundedRegexp.getUsedCharacters();
    Hampi h = new Hampi();
    h.setSolver(stp());
    Regexp sigmaStar = h.starRegexp(h.orRegexp(h.orRegexp(charRegexp(alpha, h))));
    Expression query = h.concatExpr(h.constExpr("UPDATE c SET w='"), h.varExpr("v"), h.constExpr("'"));
View Full Code Here

TOP

Related Classes of hampi.grammars.apps.GrammarStringBounder

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.