Package net.sf.kpex.prolog

Examples of net.sf.kpex.prolog.Clause


    if (null == s)
    {
      return null;
    }
    s = patchEOFString(s);
    Clause t = null;
    try
    {
      Parser p;
      p = new Parser(s, builtinDb);
      t = p.readClause();
    }
    catch (Exception e)
    { // nothing expected to catch
      IO.errmes("unexpected parsing error", e);
    }
    if (t.dict == null)
    {
      t.setGround(false);
    }
    else
    {
      t.setGround(t.dict.isEmpty());
    }
    return t;
  }
View Full Code Here


    IO.errmes("*** " + C);
  }

  static protected final Clause toClause(Term T, Map dict)
  {
    Clause C = T.toClause(); // adds ...:-true if missing
    C.dict = dict;
    return C;
  }
View Full Code Here

    if (null == mes)
    {
      mes = "unknown_error";
    }
    Fun f = new Fun("error", new Const(type), new Const(mes), new Fun("line", new Int(line)));
    Clause C = new Clause(f, Const.TRUE);
    if (verbose)
    {
      IO.errmes(type + " error at line:" + line);
      IO.errmes(C.prettyPrint(), e);
    }
    return C;
  }
View Full Code Here

   * Main Parser interface: reads a clause together with variable name
   * information
   */
  public Clause readClause()
  {
    Clause t = null;
    boolean verbose = false;
    try
    {
      t = readClauseOrEOF();
      // IO.mes("GOT Clause:"+t);
View Full Code Here

    if (n instanceof IffToken)
    {
      n = next();
      Term t = getTerm(n);
      Term bs = getConjCont(t);
      Clause C = new Clause(new Const("init"), bs);
      C.dict = dict;
      return C;
    }

    Term h = getTerm(n);

    // IO.mes("readClauseOrEOF 1:"+h);

    n = next();

    // IO.mes("readClauseOrEOF 2:"+n);

    if (n instanceof EocToken || n instanceof EofToken)
    {
      return toClause(h, dict);
    }

    // IO.mes("readClauseOrEOF 3:"+b);

    Clause C = null;
    if (n instanceof IffToken)
    {
      Term t = getTerm();
      Term bs = getConjCont(t);
      C = new Clause(h, bs);
      C.dict = dict;
    }
    else if (n instanceof CommaToken)
    {
      Term b = getTerm();
View Full Code Here

TOP

Related Classes of net.sf.kpex.prolog.Clause

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.