public static Stella_Object loomSentenceToKif(Stella_Object tree) {
    if (Stella_Object.safePrimaryType(tree) == Logic.SGT_STELLA_CONS) {
      { Cons tree000 = ((Cons)(tree));

        if (!Stella_Object.symbolP(tree000.value)) {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

              try {
                Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                stream000.nativeStream.println("ERROR: Illegal clause `" + tree000 + "' in Loom formula..");
                Logic.helpSignalPropositionError(stream000, Logic.KWD_ERROR);

              } finally {
                Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
              }
            }
            throw ((PropositionError)(PropositionError.newPropositionError(stream000.theStringReader()).fillInStackTrace()));
          }
        }
        { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree000.value));

          if ((testValue000 == Logic.SYM_STELLA_AND) ||
              ((testValue000 == Logic.SYM_STELLA_OR) ||
               (testValue000 == Logic.SYM_STELLA_NOT))) {
            { Cons clauses = Stella.NIL;

              { Stella_Object arg = null;
                Cons iter000 = tree000.rest;
                Cons collect000 = null;

                for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                  arg = iter000.value;
                  if (collect000 == null) {
                    {
                      collect000 = Cons.cons(Logic.loomSentenceToKif(arg), Stella.NIL);
                      if (clauses == Stella.NIL) {
                        clauses = collect000;
                      }
                      else {
                        Cons.addConsToEndOfConsList(clauses, collect000);
                      }
                    }
                  }
                  else {
                    {
                      collect000.rest = Cons.cons(Logic.loomSentenceToKif(arg), Stella.NIL);
                      collect000 = collect000.rest;
                    }
                  }
                }
              }
              clauses = clauses.reverse();
              clauses = Cons.cons(tree000.value, clauses);
              return (clauses);
            }
          }
          else if (testValue000 == Logic.SYM_LOGIC_ABOUT) {
            { Cons aboutclauses = Stella.NIL;
              Cons implicitvariables = null;

              { Stella_Object clause = null;
                Cons iter001 = tree000.rest.rest;

                for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
                  clause = iter001.value;
                  implicitvariables = Cons.consList(Cons.cons(tree000.rest.value, Stella.NIL));
                  if (!Stella_Object.consP(clause)) {
                    aboutclauses = Cons.cons(Cons.cons(clause, implicitvariables.concatenate(Stella.NIL, Stella.NIL)), aboutclauses);
                  }
                  else if (Logic.loomDescriptionOperatorP(((Cons)(clause)).value)) {
                    aboutclauses = Cons.cons(Logic.loomDescriptionToKif(clause, implicitvariables), aboutclauses);
                  }
                  else {
                    { Cons expression = ((Cons)(clause));

                      aboutclauses = Cons.cons(Cons.cons(expression.value, implicitvariables.concatenate(Cons.copyConsList(expression.rest).concatenate(Stella.NIL, Stella.NIL), Stella.NIL)), aboutclauses);
                    }
                  }
                }
              }
              return (Logic.conjoinSentences(aboutclauses.reverse()));
            }
          }
          else if (testValue000 == Logic.SYM_LOGIC_CREATE) {
            return (Logic.translateLoomCreateClause(tree000.rest));
          }
          else {
            return (tree000);
          }
        }
      }
    }
    else {
      return (tree);
    }
  }