コード例 #1
0
ファイル: prologApplet.java プロジェクト: mberionni/uni
 protected void compileGoal(boolean andRun) {
   String sgoal = gl.getText();
   if (!(sgoal.length() == 0)) {
     try {
       ProParser p = new ProParser(sgoal, intmsg);
       goal = p.getClause();
       intmsg.append("compiled goal: " + goal + "\n");
       if (andRun) run();
     } catch (Exception e) {
       outp.append("errore" + e + " \n");
     }
   } else outp.append("inserire il goal" + " \n");
 }
コード例 #2
0
ファイル: prologApplet.java プロジェクト: mberionni/uni
  protected void compile() {
    Sexp curClause;
    goal = new NilSexp();
    prog = new NilSexp();
    prog2 = new NilSexp();
    String codice = code.getText();

    try {
      ProParser p = new ProParser(codice, intmsg);
      for (; ; ) {
        curClause = p.getClause(); // seleziono una singola clausola
        intmsg.append("compiled: " + curClause + "\n");
        if (!(curClause instanceof eofToken)) {
          prog = Sexp.append(prog, Sexp.list1(curClause));
        }
        if (p.atEOF()) {
          break;
        }
      }
      String codice2 = code.getText();
      ProParser p2 = new ProParser(codice2, intmsg);
      for (; ; ) {
        curClause = p2.getClause(); // seleziono una singola clausola
        // intmsg.append( "compiled: " + curClause + "\n" );
        if (!(curClause instanceof eofToken)) {
          prog2 = Sexp.append(prog2, Sexp.list1(curClause));
        }
        if (p2.atEOF()) {
          break;
        }
      }

      showProg(prog, outp);
      // showProg( prog2, outp );
    } catch (Exception e) {
      outp.append("error" + e + " \n");
    }
  }