public static IEnumerable<bool> read_term3(object Input, object Term, object Options) { Variable SaveInput = new Variable(); Variable Answer = new Variable(); Variable Variables = new Variable(); foreach (bool l1 in read_termOptions(Options, Variables)) { foreach (bool l2 in YP.current_input(SaveInput)) { try { YP.see(Input); foreach (bool l3 in portable_read3(Answer, Variables, new Variable())) { foreach (bool l4 in remove_pos(Answer, Term)) yield return false; } } finally { YP.see(SaveInput); } } } }
static IEnumerable<bool> queens(object N, object Qs) { Variable Ns = new Variable(); foreach (bool l1 in rangeList(1, N, Ns)) { foreach (bool l2 in queens3(Ns, Atom.NIL, Qs)) yield return false; } }
public static IEnumerable<bool> read_term2(object Term, object Options) { Variable Answer = new Variable(); Variable Variables = new Variable(); foreach (bool l1 in read_termOptions(Options, Variables)) { foreach (bool l2 in portable_read3(Answer, Variables, new Variable())) { foreach (bool l3 in remove_pos(Answer, Term)) yield return false; } } }
static void Main(string[] args) { long startTicks = DateTime.Now.Ticks; int nAnswers = 0; Variable Qs = new Variable(); foreach (bool l1 in queens(11, Qs)) { ++nAnswers; } long finishTicks = DateTime.Now.Ticks; Console.WriteLine("Naive queens: " + (finishTicks - startTicks) / 10000000.0 + " seconds, " + nAnswers + " answers"); Console.WriteLine("\nPress Enter to finish."); Console.ReadLine(); }
static IEnumerable<bool> rangeList(int M, int N, Variable List) { if (M >= N) { foreach (bool l1 in List.unify(new ListPair(N, Atom.NIL))) yield return false; } else { Variable Tail = new Variable(); foreach (bool l1 in rangeList(M + 1, N, Tail)) { foreach (bool l2 in List.unify(new ListPair(M, Tail))) yield return false; } } }
static IEnumerable<bool> queens3(object UnplacedQs, object SafeQs, object Qs) { Variable UnplacedQs1 = new Variable(); Variable Q = new Variable(); foreach (bool l1 in selectq(Q, UnplacedQs, UnplacedQs1)) { foreach (bool l2 in notHasAttack(Q, SafeQs)) { foreach (bool l3 in queens3(UnplacedQs1, new ListPair(Q, SafeQs), Qs)) yield return false; } } foreach (bool l1 in YP.unify(UnplacedQs, Atom.NIL)) { foreach (bool l2 in YP.unify(Qs, SafeQs)) yield return false; } }
static IEnumerable<bool> attack3(object X, object N, object Arg3) { Variable Y = new Variable(); foreach (bool l in new ListPair(Y, new Variable()).unify(Arg3)) { if ((int)YP.getValue(X) == (int)Y.getValue() + (int)YP.getValue(N)) yield return false; if ((int)YP.getValue(X) == (int)Y.getValue() - (int)YP.getValue(N)) yield return false; } Variable Ys = new Variable(); Variable N1 = new Variable(); foreach (bool l1 in new ListPair(new Variable(), Ys).unify(Arg3)) { foreach (bool l2 in N1.unify((int)YP.getValue(N) + 1)) { foreach (bool l3 in attack3(X, N1, Ys)) yield return false; } } }
static IEnumerable<bool> queens3(object UnplacedQs, object SafeQs, Variable Qs) { ListPair UnplacedQsListPair = YP.getValue(UnplacedQs) as ListPair; if (UnplacedQsListPair != null) { Variable UnplacedQs1 = new Variable(); Variable Q = new Variable(); foreach (bool l1 in selectq(Q, UnplacedQsListPair, UnplacedQs1)) { if (!(SafeQs is ListPair && hasAttack((int)Q.getValue(), (ListPair)SafeQs))) { foreach (bool l2 in queens3(UnplacedQs1, new ListPair(Q, SafeQs), Qs)) yield return false; } } } else { foreach (bool l1 in Qs.unify(SafeQs)) yield return false; } }
public static IEnumerable<bool> test_all(object arg1) { { foreach (bool l2 in YP.unify(arg1, Atom.NIL)) { yield return false; } } { Variable F = new Variable(); Variable Fs = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(F, Fs))) { foreach (bool l3 in run_tests(F)) { foreach (bool l4 in test_all(Fs)) { yield return false; } } } } }
public static IEnumerable<bool> run_all_tests() { { Variable F = new Variable(); Variable Files = new Variable(); FindallAnswers findallAnswers1 = new FindallAnswers(F); foreach (bool l2 in file(F)) { findallAnswers1.add(); } foreach (bool l2 in findallAnswers1.result(Files)) { foreach (bool l3 in test_all(Files)) { foreach (bool l4 in write_results()) { yield return true; yield break; } } } } }
public static IEnumerable<bool> write_results() { { Variable F = new Variable(); Variable ErrorBips = new Variable(); FindallAnswers findallAnswers1 = new FindallAnswers(F); foreach (bool l2 in inerror(F)) { findallAnswers1.add(); } foreach (bool l2 in findallAnswers1.result(ErrorBips)) { YP.write(Atom.a("--------------------")); YP.nl(); foreach (bool l3 in YP.unify(ErrorBips, Atom.NIL)) { YP.write(Atom.a("All bips passed -------------")); YP.nl(); yield return false; goto cutIf2; } YP.nl(); YP.write(Atom.a("The following BIPs gave unexpected answers:")); YP.nl(); YP.write(Atom.a("The results should be examined carefully.")); YP.nl(); YP.nl(); foreach (bool l3 in display_list(ErrorBips)) { yield return false; } cutIf2: { } } } }
public static void convertArgListPython(object arg1) { { foreach (bool l2 in YP.unify(arg1, Atom.NIL)) { return; } } { Variable Head = new Variable(); Variable Tail = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail))) { convertExpressionPython(Head); if (YP.termNotEqual(Tail, Atom.NIL)) { YP.write(Atom.a(", ")); convertArgListPython(Tail); return; goto cutIf1; } convertArgListPython(Tail); return; cutIf1: { } } } }
public static void convertExpressionPython(object arg1) { { Variable X = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X))) { YP.write(X); return; } } { Variable Name = new Variable(); Variable ArgList = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList))) { YP.write(Name); YP.write(Atom.a("(")); convertArgListPython(ArgList); YP.write(Atom.a(")")); return; } } { Variable Name = new Variable(); Variable _FunctorArgs = new Variable(); Variable ArgList = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList))) { convertExpressionPython(new Functor2("call", Name, ArgList)); return; } } { Variable Obj = new Variable(); Variable Name = new Variable(); Variable ArgList = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList))) { YP.write(Obj); YP.write(Atom.a(".")); YP.write(Name); YP.write(Atom.a("(")); convertArgListPython(ArgList); YP.write(Atom.a(")")); return; } } { Variable Name = new Variable(); Variable ArgList = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList))) { YP.write(Name); YP.write(Atom.a("(")); convertArgListPython(ArgList); YP.write(Atom.a(")")); return; } } { Variable Name = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name))) { YP.write(Name); return; } } { foreach (bool l2 in YP.unify(arg1, Atom.a("null"))) { YP.write(Atom.a("None")); return; } } { Variable X = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor1("not", X))) { YP.write(Atom.a("not (")); convertExpressionPython(X); YP.write(Atom.a(")")); return; } } { Variable X = new Variable(); Variable Y = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y))) { YP.write(Atom.a("(")); convertExpressionPython(X); YP.write(Atom.a(") and (")); convertExpressionPython(Y); YP.write(Atom.a(")")); return; } } { Variable ArgList = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList))) { YP.write(Atom.a("[")); convertArgListPython(ArgList); YP.write(Atom.a("]")); return; } } { Variable X = new Variable(); Variable Codes = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) { if (YP.atom(X)) { YP.write(Atom.a("\"")); foreach (bool l4 in YP.atom_codes(X, Codes)) { convertStringCodesPython(Codes); YP.write(Atom.a("\"")); return; } } } } { Variable X = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) { YP.write(X); return; } } }
public static IEnumerable<bool> makeFunctionPseudoCode(object RuleList, object FunctionCode) { { Variable State = new Variable(); foreach (bool l2 in CompilerState.make(State)) { assertYPPred(State); processCompilerDirectives(RuleList, State); foreach (bool l3 in YP.unify(FunctionCode, Atom.a("getDeclaringClass"))) { yield return false; } foreach (bool l3 in makeFunctionPseudoCode3(RuleList, State, FunctionCode)) { yield return false; } } } }
public static void convertIndentationPython(object Level) { { Variable N = new Variable(); foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) { repeatWrite(Atom.a(" "), N); return; } } }
public static void convertStringCodesPython(object arg1) { { foreach (bool l2 in YP.unify(arg1, Atom.NIL)) { return; } } { Variable Code = new Variable(); Variable RestCodes = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes))) { foreach (bool l3 in putCStringCode(Code)) { convertStringCodesPython(RestCodes); return; } } } }
public object makeCopy(Variable.CopyStore copyStore) { return new Functor3(_name, YP.makeCopy(_arg1, copyStore), YP.makeCopy(_arg2, copyStore), YP.makeCopy(_arg3, copyStore)); }
public static IEnumerable<bool> makeFunctionPseudoCode3(object RuleList, object State, object FunctionCode) { { Variable SamePredicateRuleList = new Variable(); Variable RestRules = new Variable(); foreach (bool l2 in samePredicateRuleList(RuleList, SamePredicateRuleList, RestRules)) { if (YP.termNotEqual(SamePredicateRuleList, Atom.NIL)) { foreach (bool l4 in compileSamePredicateFunction(SamePredicateRuleList, State, FunctionCode)) { yield return false; } foreach (bool l4 in makeFunctionPseudoCode3(RestRules, State, FunctionCode)) { yield return false; } } } } }
public static IEnumerable<bool> append(object arg1, object arg2, object arg3) { { Variable List = new Variable(); foreach (bool l2 in YP.unify(arg1, Atom.NIL)) { foreach (bool l3 in YP.unify(arg2, List)) { foreach (bool l4 in YP.unify(arg3, List)) { yield return false; } } } } { object List2 = arg2; Variable X = new Variable(); Variable List1 = new Variable(); Variable List12 = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(X, List1))) { foreach (bool l3 in YP.unify(arg3, new ListPair(X, List12))) { foreach (bool l4 in append(List1, List2, List12)) { yield return false; } } } } }
public static void processCompilerDirectives(object arg1, object arg2) { { object _State = arg2; foreach (bool l2 in YP.unify(arg1, Atom.NIL)) { return; } } { object State = arg2; Variable Pred = new Variable(); Variable Determinism = new Variable(); Variable x3 = new Variable(); Variable RestRules = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor1("pred", new Functor2("is", Pred, Determinism))), x3), RestRules))) { CompilerState.assertPred(State, Pred, Determinism); processCompilerDirectives(RestRules, State); return; } } { object State = arg2; Variable Module = new Variable(); Variable PredicateList = new Variable(); Variable x3 = new Variable(); Variable RestRules = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor2("import", Module, PredicateList)), x3), RestRules))) { foreach (bool l3 in importPredicateList(State, Module, PredicateList)) { processCompilerDirectives(RestRules, State); return; } } } { object State = arg2; Variable x1 = new Variable(); Variable x2 = new Variable(); Variable RestRules = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", x1), x2), RestRules))) { processCompilerDirectives(RestRules, State); return; } } { object State = arg2; Variable Head = new Variable(); Variable _Body = new Variable(); Variable x3 = new Variable(); Variable RestRules = new Variable(); Variable Name = new Variable(); Variable Arity = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor2(":-", Head, _Body), x3), RestRules))) { foreach (bool l3 in YP.functor(Head, Name, Arity)) { CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a("")); processCompilerDirectives(RestRules, State); return; } } } { object State = arg2; Variable Fact = new Variable(); Variable x2 = new Variable(); Variable RestRules = new Variable(); Variable Name = new Variable(); Variable Arity = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", Fact, x2), RestRules))) { foreach (bool l3 in YP.functor(Fact, Name, Arity)) { CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a("")); processCompilerDirectives(RestRules, State); return; } } } { object State = arg2; Variable x1 = new Variable(); Variable RestRules = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(x1, RestRules))) { processCompilerDirectives(RestRules, State); return; } } }
public static IEnumerable<bool> putCStringCode(object Code) { { Variable HexDigit = new Variable(); Variable HexChar = new Variable(); if (YP.lessThanOrEqual(Code, 31)) { if (YP.lessThanOrEqual(Code, 15)) { YP.write(Atom.a("\\x0")); foreach (bool l4 in YP.unify(HexDigit, Code)) { if (YP.lessThanOrEqual(HexDigit, 9)) { foreach (bool l6 in YP.unify(HexChar, YP.add(HexDigit, 48))) { YP.put_code(HexChar); yield return true; yield break; } goto cutIf2; } foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 55))) { YP.put_code(HexChar); yield return true; yield break; } cutIf2: { } } goto cutIf1; } YP.write(Atom.a("\\x1")); foreach (bool l3 in YP.unify(HexDigit, YP.subtract(Code, 16))) { if (YP.lessThanOrEqual(HexDigit, 9)) { foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 48))) { YP.put_code(HexChar); yield return true; yield break; } goto cutIf3; } foreach (bool l4 in YP.unify(HexChar, YP.add(HexDigit, 55))) { YP.put_code(HexChar); yield return true; yield break; } cutIf3: { } } cutIf1: { } } } { if (YP.termEqual(Code, 34)) { YP.put_code(92); YP.put_code(34); yield return true; yield break; } } { if (YP.termEqual(Code, 92)) { YP.put_code(92); YP.put_code(92); yield return true; yield break; } } { YP.put_code(Code); yield return true; yield break; } }
/// <summary> /// Return true if there is a dynamic or static predicate with name and arity. /// This returns false for built-in predicates. /// </summary> /// <param name="name"></param> /// <param name="arity"></param> /// <param name="declaringClass">used to resolve references to the default /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is /// null, return false</param> /// <returns></returns> public static bool isCurrentPredicate(Atom name, int arity, Type declaringClass) { CompilerState state = new CompilerState(); Variable FunctionName = new Variable(); foreach (bool l1 in functorCallFunctionName(state, name, arity, FunctionName)) { Atom functionNameAtom = ((Atom)FunctionName.getValue()); if (functionNameAtom == Atom.NIL) // name is for a dynamic predicate. return YP.isDynamicCurrentPredicate(name, arity); string methodName = functionNameAtom._name; if (methodName.StartsWith("YP.")) // current_predicate/1 should fail for built-ins. return false; if (methodName.Contains(".")) // We don't support calling inner classes, etc. return false; if (declaringClass == null) return false; foreach (MemberInfo member in declaringClass.GetMember(methodName)) { MethodInfo method = member as MethodInfo; if (method == null) continue; if ((method.Attributes | MethodAttributes.Static) == 0) // Not a static method. continue; if (method.GetParameters().Length == arity) return true; } } return false; }
public static IEnumerable<bool> member(object X, object arg2) { { Variable x2 = new Variable(); foreach (bool l2 in YP.unify(arg2, new ListPair(X, x2))) { yield return false; } } { Variable x2 = new Variable(); Variable Rest = new Variable(); foreach (bool l2 in YP.unify(arg2, new ListPair(x2, Rest))) { foreach (bool l3 in member(X, Rest)) { yield return false; } } } }
public static void repeatWrite(object arg1, object N) { { object _Value = arg1; if (YP.termEqual(N, 0)) { return; } } { object Value = arg1; Variable NextN = new Variable(); YP.write(Value); foreach (bool l2 in YP.unify(NextN, YP.subtract(N, 1))) { repeatWrite(Value, NextN); return; } } }
public static IEnumerable<bool> importPredicateList(object arg1, object arg2, object arg3) { { object _State = arg1; object _Module = arg2; foreach (bool l2 in YP.unify(arg3, Atom.NIL)) { yield return true; yield break; } } { object State = arg1; object Module = arg2; Variable Name = new Variable(); Variable Arity = new Variable(); Variable Rest = new Variable(); foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2("/", Name, Arity), Rest))) { CompilerState.assertModuleForNameArity(State, Name, Arity, Module); foreach (bool l3 in importPredicateList(State, Module, Rest)) { yield return true; yield break; } } } { object State = arg1; object Module = arg2; Variable x3 = new Variable(); Variable Rest = new Variable(); foreach (bool l2 in YP.unify(arg3, new ListPair(x3, Rest))) { foreach (bool l3 in importPredicateList(State, Module, Rest)) { yield return true; yield break; } } } }
public static void convertFunctionPython(object arg1) { { foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass"))) { YP.write(Atom.a("def getDeclaringClass():")); YP.nl(); YP.write(Atom.a(" return globals()")); YP.nl(); YP.nl(); return; } } { Variable x1 = new Variable(); Variable Name = new Variable(); Variable ArgList = new Variable(); Variable Body = new Variable(); Variable Level = new Variable(); Variable HasBreakableBlock = new Variable(); foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body }))) { YP.write(Atom.a("def ")); YP.write(Name); YP.write(Atom.a("(")); convertArgListPython(ArgList); YP.write(Atom.a("):")); YP.nl(); foreach (bool l3 in YP.unify(Level, 1)) { if (hasBreakableBlockPython(Body)) { foreach (bool l5 in YP.unify(HasBreakableBlock, 1)) { if (YP.termEqual(HasBreakableBlock, 1)) { convertIndentationPython(Level); YP.write(Atom.a("doBreak = False")); YP.nl(); foreach (bool l7 in convertStatementListPython(Body, Level, HasBreakableBlock)) { YP.nl(); return; } goto cutIf2; } foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock)) { YP.nl(); return; } cutIf2: { } } goto cutIf1; } foreach (bool l4 in YP.unify(HasBreakableBlock, 0)) { if (YP.termEqual(HasBreakableBlock, 1)) { convertIndentationPython(Level); YP.write(Atom.a("doBreak = False")); YP.nl(); foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock)) { YP.nl(); return; } goto cutIf3; } foreach (bool l5 in convertStatementListPython(Body, Level, HasBreakableBlock)) { YP.nl(); return; } cutIf3: { } } cutIf1: { } } } } }
public static IEnumerable<bool> compileSamePredicateFunction(object SamePredicateRuleList, object State, object FunctionCode) { { Variable FirstRule = new Variable(); Variable x5 = new Variable(); Variable x6 = new Variable(); Variable x7 = new Variable(); Variable Head = new Variable(); Variable x9 = new Variable(); Variable ArgAssignments = new Variable(); Variable Calls = new Variable(); Variable Rule = new Variable(); Variable VariableNameSuggestions = new Variable(); Variable ClauseBag = new Variable(); Variable Name = new Variable(); Variable ArgsList = new Variable(); Variable FunctionArgNames = new Variable(); Variable MergedArgName = new Variable(); Variable ArgName = new Variable(); Variable MergedArgNames = new Variable(); Variable FunctionArgs = new Variable(); Variable BodyCode = new Variable(); Variable ReturnType = new Variable(); Variable BodyWithReturn = new Variable(); foreach (bool l2 in YP.unify(new ListPair(new Functor2("f", FirstRule, x5), x6), SamePredicateRuleList)) { foreach (bool l3 in YP.unify(FirstRule, new Functor1(":-", x7))) { goto cutIf1; } foreach (bool l3 in YP.unify(new Functor2(":-", Head, x9), FirstRule)) { CompilerState.startFunction(State, Head); FindallAnswers findallAnswers3 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls)); foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList)) { foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls)) { findallAnswers3.add(); } } foreach (bool l4 in findallAnswers3.result(ClauseBag)) { foreach (bool l5 in YP.univ(Head, new ListPair(Name, ArgsList))) { foreach (bool l6 in getFunctionArgNames(ArgsList, 1, FunctionArgNames)) { FindallAnswers findallAnswers4 = new FindallAnswers(MergedArgName); foreach (bool l7 in member(ArgName, FunctionArgNames)) { foreach (bool l8 in argAssignedAll(ArgName, ClauseBag, MergedArgName)) { findallAnswers4.add(); goto cutIf5; } foreach (bool l8 in YP.unify(MergedArgName, ArgName)) { findallAnswers4.add(); } cutIf5: { } } foreach (bool l7 in findallAnswers4.result(MergedArgNames)) { foreach (bool l8 in maplist_arg(MergedArgNames, FunctionArgs)) { foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode)) { if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l11 in YP.unify(ReturnType, Atom.a("void"))) { if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf7; } if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf8; } if (CompilerState.codeUsesYield(State)) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf9; } foreach (bool l12 in append(BodyCode, new ListPair(new Functor1("blockScope", new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL)), Atom.NIL), BodyWithReturn)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } cutIf9: cutIf8: cutIf7: { } } goto cutIf6; } if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool"))) { if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf11; } if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf12; } if (CompilerState.codeUsesYield(State)) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf13; } foreach (bool l12 in append(BodyCode, new ListPair(new Functor1("blockScope", new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL)), Atom.NIL), BodyWithReturn)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } cutIf13: cutIf12: cutIf11: { } } goto cutIf10; } foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>"))) { if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf14; } if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf15; } if (CompilerState.codeUsesYield(State)) { foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf16; } foreach (bool l11 in append(BodyCode, new ListPair(new Functor1("blockScope", new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL)), Atom.NIL), BodyWithReturn)) { foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } cutIf16: cutIf15: cutIf14: { } } cutIf10: cutIf6: { } } } } } } } goto cutIf2; } foreach (bool l3 in YP.unify(Head, FirstRule)) { CompilerState.startFunction(State, Head); FindallAnswers findallAnswers17 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls)); foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList)) { foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls)) { findallAnswers17.add(); } } foreach (bool l4 in findallAnswers17.result(ClauseBag)) { foreach (bool l5 in YP.univ(Head, new ListPair(Name, ArgsList))) { foreach (bool l6 in getFunctionArgNames(ArgsList, 1, FunctionArgNames)) { FindallAnswers findallAnswers18 = new FindallAnswers(MergedArgName); foreach (bool l7 in member(ArgName, FunctionArgNames)) { foreach (bool l8 in argAssignedAll(ArgName, ClauseBag, MergedArgName)) { findallAnswers18.add(); goto cutIf19; } foreach (bool l8 in YP.unify(MergedArgName, ArgName)) { findallAnswers18.add(); } cutIf19: { } } foreach (bool l7 in findallAnswers18.result(MergedArgNames)) { foreach (bool l8 in maplist_arg(MergedArgNames, FunctionArgs)) { foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode)) { if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l11 in YP.unify(ReturnType, Atom.a("void"))) { if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf21; } if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf22; } if (CompilerState.codeUsesYield(State)) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf23; } foreach (bool l12 in append(BodyCode, new ListPair(new Functor1("blockScope", new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL)), Atom.NIL), BodyWithReturn)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } cutIf23: cutIf22: cutIf21: { } } goto cutIf20; } if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool"))) { if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf25; } if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf26; } if (CompilerState.codeUsesYield(State)) { foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf27; } foreach (bool l12 in append(BodyCode, new ListPair(new Functor1("blockScope", new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL)), Atom.NIL), BodyWithReturn)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } cutIf27: cutIf26: cutIf25: { } } goto cutIf24; } foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>"))) { if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) { foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf28; } if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) { foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf29; } if (CompilerState.codeUsesYield(State)) { foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) { foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } goto cutIf30; } foreach (bool l11 in append(BodyCode, new ListPair(new Functor1("blockScope", new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL)), Atom.NIL), BodyWithReturn)) { foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) { yield return false; } } cutIf30: cutIf29: cutIf28: { } } cutIf24: cutIf20: { } } } } } } } } cutIf2: cutIf1: { } } } }
public static bool hasBreakableBlockPython(object arg1) { { Variable _Name = new Variable(); Variable _Body = new Variable(); Variable _RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", _Name, _Body), _RestStatements))) { return true; } } { Variable Body = new Variable(); Variable _RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), _RestStatements))) { if (hasBreakableBlockPython(Body)) { return true; } } } { Variable _Expression = new Variable(); Variable Body = new Variable(); Variable _RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", _Expression, Body), _RestStatements))) { if (hasBreakableBlockPython(Body)) { return true; } } } { Variable _Expression = new Variable(); Variable Body = new Variable(); Variable _RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", _Expression, Body), _RestStatements))) { if (hasBreakableBlockPython(Body)) { return true; } } } { Variable x1 = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(x1, RestStatements))) { if (hasBreakableBlockPython(RestStatements)) { return true; } } } return false; }
public object MakeCopy(Variable.CopyStore copyStore) { return new Functor1(_name, YP.MakeCopy(_arg1, copyStore)); }
public static IEnumerable<bool> convertStatementListPython(object arg1, object arg2, object arg3) { { object x1 = arg2; object x2 = arg3; foreach (bool l2 in YP.unify(arg1, Atom.NIL)) { yield return true; yield break; } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Name = new Variable(); Variable Body = new Variable(); Variable RestStatements = new Variable(); Variable NextLevel = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements))) { convertIndentationPython(Level); YP.write(Name); YP.write(Atom.a(" = False")); YP.nl(); foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) { if (YP.termEqual(Body, Atom.NIL)) { convertIndentationPython(Level); YP.write(Atom.a("if ")); YP.write(Name); YP.write(Atom.a(":")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("doBreak = False")); YP.nl(); convertIndentationPython(Level); YP.write(Atom.a("if doBreak:")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("break")); YP.nl(); foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } goto cutIf1; } convertIndentationPython(Level); YP.write(Atom.a("for _ in [1]:")); YP.nl(); foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) { convertIndentationPython(Level); YP.write(Atom.a("if ")); YP.write(Name); YP.write(Atom.a(":")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("doBreak = False")); YP.nl(); convertIndentationPython(Level); YP.write(Atom.a("if doBreak:")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("break")); YP.nl(); foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } cutIf1: { } } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable _Type = new Variable(); Variable Name = new Variable(); Variable Expression = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements))) { convertIndentationPython(Level); YP.write(Name); YP.write(Atom.a(" = ")); convertExpressionPython(Expression); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Name = new Variable(); Variable Expression = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements))) { convertIndentationPython(Level); YP.write(Name); YP.write(Atom.a(" = ")); convertExpressionPython(Expression); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("yield True")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("yield False")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("return")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("return")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("return True")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("return False")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Name = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements))) { convertIndentationPython(Level); YP.write(Name); YP.write(Atom.a(" = True")); YP.nl(); convertIndentationPython(Level); YP.write(Atom.a("doBreak = True")); YP.nl(); convertIndentationPython(Level); YP.write(Atom.a("break")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Name = new Variable(); Variable ArgList = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements))) { convertIndentationPython(Level); YP.write(Name); YP.write(Atom.a("(")); convertArgListPython(ArgList); YP.write(Atom.a(")")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Name = new Variable(); Variable _FunctorArgs = new Variable(); Variable ArgList = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements))) { foreach (bool l3 in convertStatementListPython(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Obj = new Variable(); Variable Name = new Variable(); Variable ArgList = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements))) { convertIndentationPython(Level); YP.write(Obj); YP.write(Atom.a(".")); YP.write(Name); YP.write(Atom.a("(")); convertArgListPython(ArgList); YP.write(Atom.a(")")); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Body = new Variable(); Variable RestStatements = new Variable(); Variable NextLevel = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements))) { if (YP.termEqual(HasBreakableBlock, 1)) { if (YP.termNotEqual(Body, Atom.NIL)) { convertIndentationPython(Level); YP.write(Atom.a("for _ in [1]:")); YP.nl(); foreach (bool l5 in YP.unify(NextLevel, YP.add(Level, 1))) { foreach (bool l6 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) { if (YP.termEqual(HasBreakableBlock, 1)) { if (YP.greaterThan(Level, 1)) { convertIndentationPython(Level); YP.write(Atom.a("if doBreak:")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("break")); YP.nl(); foreach (bool l9 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } goto cutIf4; } foreach (bool l8 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } cutIf4: goto cutIf3; } foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } cutIf3: { } } } goto cutIf2; } } foreach (bool l3 in YP.unify(NextLevel, Level)) { foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) { if (YP.termEqual(HasBreakableBlock, 1)) { if (YP.greaterThan(Level, 1)) { convertIndentationPython(Level); YP.write(Atom.a("if doBreak:")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("break")); YP.nl(); foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } goto cutIf6; } foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } cutIf6: goto cutIf5; } foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } cutIf5: { } } } cutIf2: { } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Expression = new Variable(); Variable Body = new Variable(); Variable RestStatements = new Variable(); Variable NextLevel = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("if ")); convertExpressionPython(Expression); YP.write(Atom.a(":")); YP.nl(); foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) { if (YP.termEqual(Body, Atom.NIL)) { convertIndentationPython(NextLevel); YP.write(Atom.a("pass")); YP.nl(); foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } goto cutIf7; } foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) { foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } cutIf7: { } } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Expression = new Variable(); Variable Body = new Variable(); Variable RestStatements = new Variable(); Variable NextLevel = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("for l")); YP.write(Level); YP.write(Atom.a(" in ")); convertExpressionPython(Expression); YP.write(Atom.a(":")); YP.nl(); foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) { foreach (bool l4 in YP.unify(NextLevel, YP.add(Level, 1))) { if (YP.termEqual(Body, Atom.NIL)) { convertIndentationPython(NextLevel); YP.write(Atom.a("pass")); YP.nl(); if (YP.termEqual(HasBreakableBlock, 1)) { convertIndentationPython(Level); YP.write(Atom.a("if doBreak:")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("break")); YP.nl(); foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } goto cutIf9; } foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } cutIf9: goto cutIf8; } foreach (bool l5 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) { if (YP.termEqual(HasBreakableBlock, 1)) { convertIndentationPython(Level); YP.write(Atom.a("if doBreak:")); YP.nl(); convertIndentationPython(NextLevel); YP.write(Atom.a("break")); YP.nl(); foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } goto cutIf10; } foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } cutIf10: { } } cutIf8: { } } } } } { object Level = arg2; object HasBreakableBlock = arg3; Variable Expression = new Variable(); Variable RestStatements = new Variable(); foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements))) { convertIndentationPython(Level); YP.write(Atom.a("raise ")); convertExpressionPython(Expression); YP.nl(); foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) { yield return true; yield break; } } } }