Package fasp.parser.tokenizer

Examples of fasp.parser.tokenizer.TokenState


    return new GroundRegularRule(head, bodyElts, bodyOp);
  }

  // Parse the result of the CSP solver
  public static GroundLiteral parseLiteral(String str) throws Exception {
    NonGroundLiteral lit = new LiteralParser().parse(new TokenState(str));
    Map<FaspVariable, FaspConstant> constMap = new HashMap<FaspVariable, FaspConstant>();
    return lit.ground(constMap);
  }
View Full Code Here


    return new GroundRegularRule(head, bodyElts, bodyOp);
  }

  // Parse the result of the CSP solver
  public static GroundLiteral parseLiteral(String str) throws Exception {
    NonGroundLiteral lit = new LiteralParser().parse(new TokenState(str));
    Map<FaspVariable, FaspConstant> constMap = new HashMap<FaspVariable, FaspConstant>();
    return lit.ground(constMap);
  }
View Full Code Here

    if(args.length >= 2) {
      if(args[0].equals("-g")) {
        readFile(args[1],new FileAction() {
          public void act(String str) {
            try {
              TokenState st = new TokenState(str);
              NonGroundProgram ngProg = new ProgramParser().parse(st);
              GroundProgram groundProg = ngProg.ground();
              System.out.println(groundProg);
              //System.out.println(groundProg.filterGrounding());
            } catch (ParseException e) {
              System.out.println(e.getParseError());
            }
          }
        });
      } else if(args[0].equals("-c") && args.length == 3) {
        Double lowerBound;
        try {
          lowerBound = Double.parseDouble(args[1]);
          if(lowerBound >= 0 && lowerBound <= 1)
            readFile(args[2],new CompletionAction(lowerBound));
          else
            System.out.println("The y-argument should be in [0,1]");
        } catch (NumberFormatException e) {
          System.out.println("ERROR: the second argument of -c was not a Double.");
          printUsage();
        }
      } else if(args[0].equals("-s")) {
        System.out.println("Not implemented yet!");
      } else if(args[0].equals("-im")) {
        readFile(args[1],new FileAction() {
          // TODO: remove duplication of code in this action and the
          // grounding action (i.e. have a separate groundingaction that
          // can be called that returns a GroundProgram).
          public void act(String str) {
            try {
              TokenState st = new TokenState(str);
              NonGroundProgram ngProg = new ProgramParser().parse(st);
              GroundProgram groundProg = ngProg.ground();
              ConsequenceOp imcons = new ConsequenceOp(groundProg);
              FaspInterpretation model = imcons.computeLFP();
              System.out.println("LFP Model:");
View Full Code Here

    public CompletionAction(Double d) {
      this.lowerBound = d;
    }
    public void act(String str) {
      try {
        TokenState st = new TokenState(str);
        NonGroundProgram ngProg = new ProgramParser().parse(st);
        GroundProgram groundProg = ngProg.ground();
        List<FuzzyLiteral> completion = groundProg.createCompletion(lowerBound);
        System.out.println(completion);
      } catch (ParseException e) {
View Full Code Here

TOP

Related Classes of fasp.parser.tokenizer.TokenState

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.