clockwerk-opensim-stable – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30  
31 using System;
32 using System.IO;
33 using System.Collections;
34 using System.Collections.Generic;
35 using System.Text;
36 using System.CodeDom.Compiler;
37 using System.Reflection;
38  
39 namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
40 {
41 public class YPCompiler
42 {
43 private class CompilerState
44 {
45 public IndexedAnswers _pred = new IndexedAnswers(4);
46 public Dictionary<YP.NameArity, Atom> _moduleForNameArity = new Dictionary<YP.NameArity, Atom>();
47 public int _gensymCounter;
48 public bool _useFinalCutCode;
49 public Variable _finalCutCode;
50 public bool _codeUsesYield;
51 public Atom _determinism;
52 // a list of '='(Name, Variable)
53 public List<object> _variableNames;
54  
55 // Make these static functions that explicitly take the State so Prolog can call it.
56  
57 /// <summary>
58 /// Make a new CompilerState and bind it to State.
59 /// </summary>
60 /// <param name="State"></param>
61 /// <returns></returns>
62 public static IEnumerable<bool> make(object State)
63 {
64 return YP.unify(State, new CompilerState());
65 }
66  
67 public static void assertPred(object State, object Pred, object Determinism)
68 {
69 State = YP.getValue(State);
70 object functorName = YP.getFunctorName(Pred);
71 object[] functorArgs = YP.getFunctorArgs(Pred);
72 // Debug: Should check if it's already asserted and is the same.
73 ((CompilerState)State)._pred.addAnswer
74 (new object[] { functorName, functorArgs.Length, Pred, YP.getValue(Determinism) });
75 }
76  
77 public static void assertModuleForNameArity(object State, object Name, object Arity, object Module)
78 {
79 State = YP.getValue(State);
80 Name = YP.getValue(Name);
81 Arity = YP.getValue(Arity);
82 Module = YP.getValue(Module);
83 // If the Module Atom comes from the parser, it always has null _declaringClass.
84 if (Module is Atom && ((Atom)Module)._module == null && Name is Atom && Arity is int)
85 // Replace a previous entry if it exists.
86 ((CompilerState)State)._moduleForNameArity[new YP.NameArity((Atom)Name, (int)Arity)] =
87 (Atom)Module;
88 }
89  
90 public static void startFunction(object State, object Head)
91 {
92 State = YP.getValue(State);
93 ((CompilerState)State)._gensymCounter = 0;
94 ((CompilerState)State)._useFinalCutCode = false;
95 ((CompilerState)State)._finalCutCode = new Variable();
96 ((CompilerState)State)._codeUsesYield = false;
97 if (CompilerState.isDetNoneOut(State, Head))
98 ((CompilerState)State)._determinism = Atom.a("detNoneOut");
99 else if (CompilerState.isSemidetNoneOut(State, Head))
100 ((CompilerState)State)._determinism = Atom.a("semidetNoneOut");
101 else
102 ((CompilerState)State)._determinism = Atom.a("nondet");
103 }
104  
105 public static void setCodeUsesYield(object State)
106 {
107 State = YP.getValue(State);
108 ((CompilerState)State)._codeUsesYield = true;
109 }
110  
111 public static bool codeUsesYield(object State)
112 {
113 State = YP.getValue(State);
114 return ((CompilerState)State)._codeUsesYield;
115 }
116  
117 public static bool determinismEquals(object State, object Term)
118 {
119 State = YP.getValue(State);
120 return YP.termEqual(((CompilerState)State)._determinism, Term);
121 }
122  
123 /// <summary>
124 /// Set _variableNames to a new list of (Name = Variable) for each unique variable in rule.
125 /// If the variable is in variableNameSuggestions, use it, otherwise use x1, x2, etc.
126 /// </summary>
127 /// <param name="State"></param>
128 /// <param name="rule"></param>
129 /// <param name="variableNameSuggestions"></param>
130 public static void newVariableNames(object State, object Rule, object VariableNameSuggestions)
131 {
132 State = YP.getValue(State);
133 List<Variable> variablesSet = new List<Variable>();
134 YP.addUniqueVariables(Rule, variablesSet);
135  
136 ((CompilerState)State)._variableNames = new List<object>();
137 int xCounter = 0;
138 foreach (Variable variable in variablesSet)
139 ((CompilerState)State)._variableNames.Add
140 (new Functor2(Atom.a("="), makeVariableName(variable, VariableNameSuggestions, ++xCounter),
141 variable));
142 }
143  
144 private static object makeVariableName(object variable, object variableNameSuggestions, int xCounter)
145 {
146 // Debug: should require named variables to start with _ or capital. Should
147 // check for duplicates and clashes with keywords.
148 for (object element = YP.getValue(variableNameSuggestions);
149 element is Functor2 && ((Functor2)element)._name == Atom.DOT;
150 element = YP.getValue(((Functor2)element)._arg2))
151 {
152 object suggestionPair = YP.getValue(((Functor2)element)._arg1);
153 if (sameVariable(variable, ((Functor2)suggestionPair)._arg2))
154 {
155 Atom suggestion = (Atom)YP.getValue(((Functor2)suggestionPair)._arg1);
156 if (suggestion.Equals(Atom.a("Atom")))
157 suggestion = Atom.a("Atom_1");
158 if (suggestion.Equals(Atom.a("Variable")))
159 suggestion = Atom.a("Variable_1");
160 if (suggestion.Equals(Atom.a("Functor")))
161 suggestion = Atom.a("Functor_1");
162 return suggestion;
163 }
164 }
165  
166 return Atom.a("x" + xCounter);
167 }
168  
169 /// <summary>
170 /// Unify Result with the name assigned by CompilerState.newVariableNames in State._variableNames
171 /// for variable.
172 /// </summary>
173 /// <param name="variable">a Variable</param>
174 /// <param name="State"></param>
175 /// <param name="Result">the assigned Name</param>
176 public static IEnumerable<bool> getVariableName(object State, object variable, object Result)
177 {
178 State = YP.getValue(State);
179 foreach (object variableInfo in ((CompilerState)State)._variableNames)
180 {
181 if (variableInfo is Functor2 && ((Functor2)variableInfo)._name.Equals(Atom.a("=")))
182 {
183 if (sameVariable(variable, ((Functor2)variableInfo)._arg2))
184 return YP.unify(Result, ((Functor2)variableInfo)._arg1);
185 }
186 }
187  
188 // We set up names for all unique variables, so this should never happen.
189 throw new PrologException(Atom.a("Can't find entry in _variableNames"));
190 }
191  
192 public static IEnumerable<bool> variableNamesList(object State, object VariableNamesList)
193 {
194 State = YP.getValue(State);
195 return YP.unify(VariableNamesList, ListPair.make(((CompilerState)State)._variableNames));
196 }
197  
198 public static IEnumerable<bool> gensym(object State, object Base, object Symbol)
199 {
200 State = YP.getValue(State);
201 return YP.unify(Symbol, Atom.a(Base.ToString() + ++((CompilerState)State)._gensymCounter));
202 }
203  
204 // disable warning on l1, don't see how we can
205 // code this differently
206 #pragma warning disable 0168, 0164, 0162, 0219
207 public static bool isDetNoneOut(object State, object Term)
208 {
209 State = YP.getValue(State);
210 object functorName = YP.getFunctorName(Term);
211 object[] functorArgs = YP.getFunctorArgs(Term);
212  
213 Variable pred = new Variable();
214 foreach (bool l1 in ((CompilerState)State)._pred.match
215 (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") }))
216 {
217 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue())))
218 {
219 return true;
220 }
221 }
222  
223 return false;
224 }
225  
226 public static bool isSemidetNoneOut(object State, object Term)
227 {
228 State = YP.getValue(State);
229 object functorName = YP.getFunctorName(Term);
230 object[] functorArgs = YP.getFunctorArgs(Term);
231  
232 Variable pred = new Variable();
233 foreach (bool l1 in ((CompilerState)State)._pred.match
234 (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") }))
235 {
236 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue())))
237 {
238 return true;
239 }
240 }
241  
242 return false;
243 }
244 #pragma warning restore 0168, 0164, 0162, 0219
245  
246 /// <summary>
247 /// Return false if any of args is out, otherwise true.
248 /// args is an array of ::(Type,Mode) where Mode is in or out.
249 /// </summary>
250 /// <param name="args"></param>
251 /// <returns></returns>
252 private static bool isNoneOut(object[] args)
253 {
254 foreach (object arg in args)
255 {
256 if (arg is Functor2 && ((Functor2)arg)._name == Atom.a("::") &&
257 ((Functor2)arg)._arg2 == Atom.a("out"))
258 return false;
259 }
260 return true;
261 }
262  
263 public static bool nameArityHasModule(object State, object Name, object Arity, object Module)
264 {
265 State = YP.getValue(State);
266 Name = YP.getValue(Name);
267 Arity = YP.getValue(Arity);
268 Module = YP.getValue(Module);
269 if (Name is Atom && Arity is int)
270 {
271 Atom FoundModule;
272 if (!((CompilerState)State)._moduleForNameArity.TryGetValue
273 (new YP.NameArity((Atom)Name, (int)Arity), out FoundModule))
274 return false;
275 return FoundModule == Module;
276 }
277 return false;
278 }
279 }
280  
281 // disable warning on l1, don't see how we can
282 // code this differently
283 #pragma warning disable 0168, 0219,0164,0162
284  
285 /// <summary>
286 /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction
287 /// to return an anonymous YP.IClause for the Head and Body of a rule clause.
288 /// </summary>
289 /// <param name="Head">a prolog term such as new Functor2("test1", X, Y).
290 /// Note that the name of the head is ignored.
291 /// </param>
292 /// <param name="Body">a prolog term such as
293 /// new Functor2(",", new Functor1(Atom.a("test2", Atom.a("")), X),
294 /// new Functor2("=", Y, X)).
295 /// This may not be null. (For a head-only clause, set the Body to Atom.a("true").
296 /// </param>
297 /// <param name="declaringClass">if not null, the code is compiled as a subclass of this class
298 /// to resolve references to the default module Atom.a("")</param>
299 /// <returns>a new YP.IClause object on which you can call match(object[] args) where
300 /// args length is the arity of the Head</returns>
301 public static YP.IClause compileAnonymousClause(object Head, object Body, Type declaringClass)
302 {
303 object[] args = YP.getFunctorArgs(Head);
304 // compileAnonymousFunction wants "function".
305 object Rule = new Functor2(Atom.RULE, Functor.make("function", args), Body);
306 object RuleList = ListPair.make(new Functor2(Atom.F, Rule, Atom.NIL));
307  
308 StringWriter functionCode = new StringWriter();
309 Variable SaveOutputStream = new Variable();
310 foreach (bool l1 in YP.current_output(SaveOutputStream))
311 {
312 try
313 {
314 YP.tell(functionCode);
315 Variable PseudoCode = new Variable();
316 foreach (bool l2 in makeFunctionPseudoCode(RuleList, PseudoCode))
317 {
318 if (YP.termEqual(PseudoCode, Atom.a("getDeclaringClass")))
319 // Ignore getDeclaringClass since we have access to the one passed in.
320 continue;
321  
322 convertFunctionCSharp(PseudoCode);
323 }
324 YP.told();
325 }
326 finally
327 {
328 // Restore after calling tell.
329 YP.tell(SaveOutputStream.getValue());
330 }
331 }
332 return YPCompiler.compileAnonymousFunction
333 (functionCode.ToString(), args.Length, declaringClass);
334 }
335  
336 /// <summary>
337 /// Use CodeDomProvider to compile the functionCode and return a YP.ClauseHeadAndBody
338 /// which implements YP.IClause.
339 /// The function name must be "function" and have nArgs arguments.
340 /// </summary>
341 /// <param name="functionCode">the code for the iterator, such as
342 /// "public static IEnumerable<bool> function() { yield return false; }"
343 /// </param>
344 /// <param name="nArgs">the number of args in the function</param>
345 /// <param name="declaringClass">if not null, then use the functionCode inside a class which
346 /// inherits from contextClass, so that references in functionCode to methods in declaringClass don't
347 /// have to be qualified</param>
348 /// <returns>a new YP.IClause object on which you can call match(object[] args) where
349 /// args length is nArgs</returns>
350 public static YP.IClause compileAnonymousFunction(string functionCode, int nArgs, Type declaringClass)
351 {
352 CompilerParameters parameters = new CompilerParameters();
353 // This gets the location of the System assembly.
354 parameters.ReferencedAssemblies.Add(typeof(System.Int32).Assembly.Location);
355 // This gets the location of this assembly which also has YieldProlog.YP, etc.
356 parameters.ReferencedAssemblies.Add(typeof(YPCompiler).Assembly.Location);
357 if (declaringClass != null)
358 parameters.ReferencedAssemblies.Add(declaringClass.Assembly.Location);
359 parameters.GenerateInMemory = true;
360  
361 StringBuilder sourceCode = new StringBuilder();
362 sourceCode.Append(@"
363 using System;
364 using System.Collections.Generic;
365 using OpenSim.Region.ScriptEngine.Shared.YieldProlog;
366  
367 namespace Temporary {
368 public class Temporary : YP.ClauseHeadAndBody, YP.IClause {");
369 if (declaringClass == null)
370 // We don't extend a class with getDeclaringClass, so define it.
371 sourceCode.Append(@"
372 public class Inner {
373 public static System.Type getDeclaringClass() { return null; }
374 ");
375 else
376 sourceCode.Append(@"
377 public class Inner : " + declaringClass.FullName + @" {
378 ");
379 sourceCode.Append(functionCode);
380 // Basically, match applies the args to function.
381 sourceCode.Append(@"
382 }
383 public IEnumerable<bool> match(object[] args) {
384 return Inner.function(");
385 if (nArgs >= 1)
386 sourceCode.Append("args[0]");
387 for (int i = 1; i < nArgs; ++i)
388 sourceCode.Append(", args[" + i + "]");
389 sourceCode.Append(@");
390 }
391 }
392 }
393 ");
394  
395 CompilerResults results = CodeDomProvider.CreateProvider
396 ("CSharp").CompileAssemblyFromSource(parameters, sourceCode.ToString());
397 if (results.Errors.Count > 0)
398 throw new Exception("Error evaluating code: " + results.Errors[0]);
399  
400 // Return a new Temporary.Temporary object.
401 return (YP.IClause)results.CompiledAssembly.GetType
402 ("Temporary.Temporary").GetConstructor(Type.EmptyTypes).Invoke(null);
403 }
404  
405 /// <summary>
406 /// If the functor with name and args can be called directly as determined by
407 /// functorCallFunctionName, then call it and return its iterator. If the predicate is
408 /// dynamic and undefined, or if static and the method cannot be found, return
409 /// the result of YP.unknownPredicate.
410 /// This returns null if the functor has a special form than needs to be compiled
411 /// (including ,/2 and ;/2).
412 /// </summary>
413 /// <param name="name"></param>
414 /// <param name="args"></param>
415 /// <param name="declaringClass">used to resolve references to the default
416 /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is
417 /// null, this throws a PrologException for existence_error</param>
418 /// <returns></returns>
419 public static IEnumerable<bool> getSimpleIterator(Atom name, object[] args, Type declaringClass)
420 {
421 CompilerState state = new CompilerState();
422 Variable FunctionName = new Variable();
423 foreach (bool l1 in functorCallFunctionName(state, name, args.Length, FunctionName))
424 {
425 Atom functionNameAtom = ((Atom)FunctionName.getValue());
426 if (functionNameAtom == Atom.NIL)
427 // name is for a dynamic predicate.
428 return YP.matchDynamic(name, args);
429  
430 string methodName = functionNameAtom._name;
431 // Set the default for the method to call.
432 Type methodClass = declaringClass;
433  
434 bool checkMode = false;
435 if (methodName.StartsWith("YP."))
436 {
437 // Assume we only check mode in calls to standard Prolog predicates in YP.
438 checkMode = true;
439  
440 // Use the method in class YP.
441 methodName = methodName.Substring(3);
442 methodClass = typeof(YP);
443 }
444 if (methodName.Contains("."))
445 // We don't support calling inner classes, etc.
446 return null;
447  
448 if (methodClass == null)
449 return YP.unknownPredicate
450 (name, args.Length,
451 "Cannot find predicate function for: " + name + "/" + args.Length +
452 " because declaringClass is null. Set declaringClass to the class containing " +
453 methodName);
454 try
455 {
456 if (checkMode)
457 {
458 assertYPPred(state);
459 object functor = Functor.make(name, args);
460 if (CompilerState.isDetNoneOut(state, functor))
461 {
462 methodClass.InvokeMember
463 (methodName, BindingFlags.InvokeMethod, null, null, args);
464 return YP.succeed();
465 }
466 if (CompilerState.isSemidetNoneOut(state, functor))
467 {
468 if ((bool)methodClass.InvokeMember
469 (methodName, BindingFlags.InvokeMethod, null, null, args))
470 return YP.succeed();
471 else
472 return YP.fail();
473 }
474  
475 }
476 return (IEnumerable<bool>)methodClass.InvokeMember
477 (methodName, BindingFlags.InvokeMethod, null, null, args);
478 }
479 catch (TargetInvocationException exception)
480 {
481 throw exception.InnerException;
482 }
483 catch (MissingMethodException)
484 {
485 return YP.unknownPredicate
486 (name, args.Length,
487 "Cannot find predicate function " + methodName + " for " + name + "/" + args.Length +
488 " in " + methodClass.FullName);
489 }
490 }
491  
492 return null;
493 }
494  
495 /// <summary>
496 /// Return true if there is a dynamic or static predicate with name and arity.
497 /// This returns false for built-in predicates.
498 /// </summary>
499 /// <param name="name"></param>
500 /// <param name="arity"></param>
501 /// <param name="declaringClass">used to resolve references to the default
502 /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is
503 /// null, return false</param>
504 /// <returns></returns>
505 public static bool isCurrentPredicate(Atom name, int arity, Type declaringClass)
506 {
507 CompilerState state = new CompilerState();
508 Variable FunctionName = new Variable();
509 foreach (bool l1 in functorCallFunctionName(state, name, arity, FunctionName))
510 {
511 Atom functionNameAtom = ((Atom)FunctionName.getValue());
512 if (functionNameAtom == Atom.NIL)
513 // name is for a dynamic predicate.
514 return YP.isDynamicCurrentPredicate(name, arity);
515  
516 string methodName = functionNameAtom._name;
517  
518 if (methodName.StartsWith("YP."))
519 // current_predicate/1 should fail for built-ins.
520 return false;
521 if (methodName.Contains("."))
522 // We don't support calling inner classes, etc.
523 return false;
524 if (declaringClass == null)
525 return false;
526  
527 foreach (MemberInfo member in declaringClass.GetMember(methodName))
528 {
529 MethodInfo method = member as MethodInfo;
530 if (method == null)
531 continue;
532 if ((method.Attributes | MethodAttributes.Static) == 0)
533 // Not a static method.
534 continue;
535 if (method.GetParameters().Length == arity)
536 return true;
537 }
538 }
539  
540 return false;
541 }
542  
543 // Compiler output follows.
544  
545 public class YPInnerClass { }
546 public static System.Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }
547  
548 public static void repeatWrite(object arg1, object N)
549 {
550 {
551 object _Value = arg1;
552 if (YP.termEqual(N, 0))
553 {
554 return;
555 }
556 }
557 {
558 object Value = arg1;
559 Variable NextN = new Variable();
560 YP.write(Value);
561 foreach (bool l2 in YP.unify(NextN, YP.subtract(N, 1)))
562 {
563 repeatWrite(Value, NextN);
564 return;
565 }
566 }
567 }
568  
569 public static bool sameVariable(object Variable1, object Variable2)
570 {
571 {
572 if (YP.var(Variable1))
573 {
574 if (YP.var(Variable2))
575 {
576 if (YP.termEqual(Variable1, Variable2))
577 {
578 return true;
579 }
580 }
581 }
582 }
583 return false;
584 }
585  
586 public static IEnumerable<bool> makeFunctionPseudoCode(object RuleList, object FunctionCode)
587 {
588 {
589 Variable State = new Variable();
590 foreach (bool l2 in CompilerState.make(State))
591 {
592 assertYPPred(State);
593 processCompilerDirectives(RuleList, State);
594 foreach (bool l3 in YP.unify(FunctionCode, Atom.a("getDeclaringClass")))
595 {
596 yield return false;
597 }
598 foreach (bool l3 in makeFunctionPseudoCode3(RuleList, State, FunctionCode))
599 {
600 yield return false;
601 }
602 }
603 }
604 }
605  
606 public static void assertYPPred(object State)
607 {
608 {
609 CompilerState.assertPred(State, Atom.a("nl"), Atom.a("det"));
610 CompilerState.assertPred(State, new Functor1("write", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
611 CompilerState.assertPred(State, new Functor1("put_code", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
612 CompilerState.assertPred(State, new Functor1("see", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
613 CompilerState.assertPred(State, Atom.a("seen"), Atom.a("det"));
614 CompilerState.assertPred(State, new Functor1("tell", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
615 CompilerState.assertPred(State, Atom.a("told"), Atom.a("det"));
616 CompilerState.assertPred(State, new Functor1("throw", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
617 CompilerState.assertPred(State, new Functor1("abolish", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
618 CompilerState.assertPred(State, new Functor1("retractall", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
619 CompilerState.assertPred(State, new Functor2("set_prolog_flag", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
620 CompilerState.assertPred(State, new Functor1("var", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
621 CompilerState.assertPred(State, new Functor1("nonvar", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
622 CompilerState.assertPred(State, new Functor1("atom", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
623 CompilerState.assertPred(State, new Functor1("integer", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
624 CompilerState.assertPred(State, new Functor1("float", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
625 CompilerState.assertPred(State, new Functor1("number", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
626 CompilerState.assertPred(State, new Functor1("atomic", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
627 CompilerState.assertPred(State, new Functor1("compound", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
628 CompilerState.assertPred(State, new Functor2("==", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
629 CompilerState.assertPred(State, new Functor2("\\==", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
630 CompilerState.assertPred(State, new Functor2("@<", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
631 CompilerState.assertPred(State, new Functor2("@=<", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
632 CompilerState.assertPred(State, new Functor2("@>", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
633 CompilerState.assertPred(State, new Functor2("@>=", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
634 return;
635 }
636 }
637  
638 public static void processCompilerDirectives(object arg1, object arg2)
639 {
640 {
641 object _State = arg2;
642 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
643 {
644 return;
645 }
646 }
647 {
648 object State = arg2;
649 Variable Pred = new Variable();
650 Variable Determinism = new Variable();
651 Variable x3 = new Variable();
652 Variable RestRules = new Variable();
653 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor1("pred", new Functor2("is", Pred, Determinism))), x3), RestRules)))
654 {
655 CompilerState.assertPred(State, Pred, Determinism);
656 processCompilerDirectives(RestRules, State);
657 return;
658 }
659 }
660 {
661 object State = arg2;
662 Variable Module = new Variable();
663 Variable PredicateList = new Variable();
664 Variable x3 = new Variable();
665 Variable RestRules = new Variable();
666 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor2("import", Module, PredicateList)), x3), RestRules)))
667 {
668 foreach (bool l3 in importPredicateList(State, Module, PredicateList))
669 {
670 processCompilerDirectives(RestRules, State);
671 return;
672 }
673 }
674 }
675 {
676 object State = arg2;
677 Variable x1 = new Variable();
678 Variable x2 = new Variable();
679 Variable RestRules = new Variable();
680 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", x1), x2), RestRules)))
681 {
682 processCompilerDirectives(RestRules, State);
683 return;
684 }
685 }
686 {
687 object State = arg2;
688 Variable Head = new Variable();
689 Variable _Body = new Variable();
690 Variable x3 = new Variable();
691 Variable RestRules = new Variable();
692 Variable Name = new Variable();
693 Variable Arity = new Variable();
694 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor2(":-", Head, _Body), x3), RestRules)))
695 {
696 foreach (bool l3 in YP.functor(Head, Name, Arity))
697 {
698 CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a(""));
699 processCompilerDirectives(RestRules, State);
700 return;
701 }
702 }
703 }
704 {
705 object State = arg2;
706 Variable Fact = new Variable();
707 Variable x2 = new Variable();
708 Variable RestRules = new Variable();
709 Variable Name = new Variable();
710 Variable Arity = new Variable();
711 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", Fact, x2), RestRules)))
712 {
713 foreach (bool l3 in YP.functor(Fact, Name, Arity))
714 {
715 CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a(""));
716 processCompilerDirectives(RestRules, State);
717 return;
718 }
719 }
720 }
721 {
722 object State = arg2;
723 Variable x1 = new Variable();
724 Variable RestRules = new Variable();
725 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, RestRules)))
726 {
727 processCompilerDirectives(RestRules, State);
728 return;
729 }
730 }
731 }
732  
733 public static IEnumerable<bool> importPredicateList(object arg1, object arg2, object arg3)
734 {
735 {
736 object _State = arg1;
737 object _Module = arg2;
738 foreach (bool l2 in YP.unify(arg3, Atom.NIL))
739 {
740 yield return true;
741 yield break;
742 }
743 }
744 {
745 object State = arg1;
746 object Module = arg2;
747 Variable Name = new Variable();
748 Variable Arity = new Variable();
749 Variable Rest = new Variable();
750 foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2("/", Name, Arity), Rest)))
751 {
752 CompilerState.assertModuleForNameArity(State, Name, Arity, Module);
753 foreach (bool l3 in importPredicateList(State, Module, Rest))
754 {
755 yield return true;
756 yield break;
757 }
758 }
759 }
760 {
761 object State = arg1;
762 object Module = arg2;
763 Variable x3 = new Variable();
764 Variable Rest = new Variable();
765 foreach (bool l2 in YP.unify(arg3, new ListPair(x3, Rest)))
766 {
767 foreach (bool l3 in importPredicateList(State, Module, Rest))
768 {
769 yield return true;
770 yield break;
771 }
772 }
773 }
774 }
775  
776 public static IEnumerable<bool> makeFunctionPseudoCode3(object RuleList, object State, object FunctionCode)
777 {
778 {
779 Variable SamePredicateRuleList = new Variable();
780 Variable RestRules = new Variable();
781 foreach (bool l2 in samePredicateRuleList(RuleList, SamePredicateRuleList, RestRules))
782 {
783 if (YP.termNotEqual(SamePredicateRuleList, Atom.NIL))
784 {
785 foreach (bool l4 in compileSamePredicateFunction(SamePredicateRuleList, State, FunctionCode))
786 {
787 yield return false;
788 }
789 foreach (bool l4 in makeFunctionPseudoCode3(RestRules, State, FunctionCode))
790 {
791 yield return false;
792 }
793 }
794 }
795 }
796 }
797  
798 public static IEnumerable<bool> compileSamePredicateFunction(object SamePredicateRuleList, object State, object FunctionCode)
799 {
800 {
801 Variable FirstRule = new Variable();
802 Variable x5 = new Variable();
803 Variable x6 = new Variable();
804 Variable x7 = new Variable();
805 Variable Head = new Variable();
806 Variable x9 = new Variable();
807 Variable ArgAssignments = new Variable();
808 Variable Calls = new Variable();
809 Variable Rule = new Variable();
810 Variable VariableNameSuggestions = new Variable();
811 Variable ClauseBag = new Variable();
812 Variable Name = new Variable();
813 Variable ArgsList = new Variable();
814 Variable FunctionArgNames = new Variable();
815 Variable MergedArgName = new Variable();
816 Variable ArgName = new Variable();
817 Variable MergedArgNames = new Variable();
818 Variable FunctionArgs = new Variable();
819 Variable BodyCode = new Variable();
820 Variable ReturnType = new Variable();
821 Variable BodyWithReturn = new Variable();
822 foreach (bool l2 in YP.unify(new ListPair(new Functor2("f", FirstRule, x5), x6), SamePredicateRuleList))
823 {
824 foreach (bool l3 in YP.unify(FirstRule, new Functor1(":-", x7)))
825 {
826 goto cutIf1;
827 }
828 foreach (bool l3 in YP.unify(new Functor2(":-", Head, x9), FirstRule))
829 {
830 CompilerState.startFunction(State, Head);
831 FindallAnswers findallAnswers3 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls));
832 foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList))
833 {
834 foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls))
835 {
836 findallAnswers3.add();
837 }
838 }
839 foreach (bool l4 in findallAnswers3.result(ClauseBag))
840 {
841 foreach (bool l5 in YP.univ(Head, new ListPair(Name, ArgsList)))
842 {
843 foreach (bool l6 in getFunctionArgNames(ArgsList, 1, FunctionArgNames))
844 {
845 FindallAnswers findallAnswers4 = new FindallAnswers(MergedArgName);
846 foreach (bool l7 in member(ArgName, FunctionArgNames))
847 {
848 foreach (bool l8 in argAssignedAll(ArgName, ClauseBag, MergedArgName))
849 {
850 findallAnswers4.add();
851 goto cutIf5;
852 }
853 foreach (bool l8 in YP.unify(MergedArgName, ArgName))
854 {
855 findallAnswers4.add();
856 }
857 cutIf5:
858 { }
859 }
860 foreach (bool l7 in findallAnswers4.result(MergedArgNames))
861 {
862 foreach (bool l8 in maplist_arg(MergedArgNames, FunctionArgs))
863 {
864 foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode))
865 {
866 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
867 {
868 foreach (bool l11 in YP.unify(ReturnType, Atom.a("void")))
869 {
870 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
871 {
872 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
873 {
874 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
875 {
876 yield return false;
877 }
878 }
879 goto cutIf7;
880 }
881 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
882 {
883 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
884 {
885 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
886 {
887 yield return false;
888 }
889 }
890 goto cutIf8;
891 }
892 if (CompilerState.codeUsesYield(State))
893 {
894 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
895 {
896 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
897 {
898 yield return false;
899 }
900 }
901 goto cutIf9;
902 }
903 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
904 {
905 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
906 {
907 yield return false;
908 }
909 }
910 cutIf9:
911 cutIf8:
912 cutIf7:
913 { }
914 }
915 goto cutIf6;
916 }
917 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
918 {
919 foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool")))
920 {
921 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
922 {
923 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
924 {
925 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
926 {
927 yield return false;
928 }
929 }
930 goto cutIf11;
931 }
932 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
933 {
934 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
935 {
936 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
937 {
938 yield return false;
939 }
940 }
941 goto cutIf12;
942 }
943 if (CompilerState.codeUsesYield(State))
944 {
945 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
946 {
947 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
948 {
949 yield return false;
950 }
951 }
952 goto cutIf13;
953 }
954 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
955 {
956 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
957 {
958 yield return false;
959 }
960 }
961 cutIf13:
962 cutIf12:
963 cutIf11:
964 { }
965 }
966 goto cutIf10;
967 }
968 foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>")))
969 {
970 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
971 {
972 foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
973 {
974 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
975 {
976 yield return false;
977 }
978 }
979 goto cutIf14;
980 }
981 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
982 {
983 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
984 {
985 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
986 {
987 yield return false;
988 }
989 }
990 goto cutIf15;
991 }
992 if (CompilerState.codeUsesYield(State))
993 {
994 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
995 {
996 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
997 {
998 yield return false;
999 }
1000 }
1001 goto cutIf16;
1002 }
1003 foreach (bool l11 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1004 {
1005 foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1006 {
1007 yield return false;
1008 }
1009 }
1010 cutIf16:
1011 cutIf15:
1012 cutIf14:
1013 { }
1014 }
1015 cutIf10:
1016 cutIf6:
1017 { }
1018 }
1019 }
1020 }
1021 }
1022 }
1023 }
1024 goto cutIf2;
1025 }
1026 foreach (bool l3 in YP.unify(Head, FirstRule))
1027 {
1028 CompilerState.startFunction(State, Head);
1029 FindallAnswers findallAnswers17 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls));
1030 foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList))
1031 {
1032 foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls))
1033 {
1034 findallAnswers17.add();
1035 }
1036 }
1037 foreach (bool l4 in findallAnswers17.result(ClauseBag))
1038 {
1039 foreach (bool l5 in YP.univ(Head, new ListPair(Name, ArgsList)))
1040 {
1041 foreach (bool l6 in getFunctionArgNames(ArgsList, 1, FunctionArgNames))
1042 {
1043 FindallAnswers findallAnswers18 = new FindallAnswers(MergedArgName);
1044 foreach (bool l7 in member(ArgName, FunctionArgNames))
1045 {
1046 foreach (bool l8 in argAssignedAll(ArgName, ClauseBag, MergedArgName))
1047 {
1048 findallAnswers18.add();
1049 goto cutIf19;
1050 }
1051 foreach (bool l8 in YP.unify(MergedArgName, ArgName))
1052 {
1053 findallAnswers18.add();
1054 }
1055 cutIf19:
1056 { }
1057 }
1058 foreach (bool l7 in findallAnswers18.result(MergedArgNames))
1059 {
1060 foreach (bool l8 in maplist_arg(MergedArgNames, FunctionArgs))
1061 {
1062 foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode))
1063 {
1064 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1065 {
1066 foreach (bool l11 in YP.unify(ReturnType, Atom.a("void")))
1067 {
1068 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1069 {
1070 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
1071 {
1072 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1073 {
1074 yield return false;
1075 }
1076 }
1077 goto cutIf21;
1078 }
1079 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1080 {
1081 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1082 {
1083 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1084 {
1085 yield return false;
1086 }
1087 }
1088 goto cutIf22;
1089 }
1090 if (CompilerState.codeUsesYield(State))
1091 {
1092 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1093 {
1094 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1095 {
1096 yield return false;
1097 }
1098 }
1099 goto cutIf23;
1100 }
1101 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1102 {
1103 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1104 {
1105 yield return false;
1106 }
1107 }
1108 cutIf23:
1109 cutIf22:
1110 cutIf21:
1111 { }
1112 }
1113 goto cutIf20;
1114 }
1115 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1116 {
1117 foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool")))
1118 {
1119 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1120 {
1121 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
1122 {
1123 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1124 {
1125 yield return false;
1126 }
1127 }
1128 goto cutIf25;
1129 }
1130 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1131 {
1132 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1133 {
1134 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1135 {
1136 yield return false;
1137 }
1138 }
1139 goto cutIf26;
1140 }
1141 if (CompilerState.codeUsesYield(State))
1142 {
1143 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1144 {
1145 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1146 {
1147 yield return false;
1148 }
1149 }
1150 goto cutIf27;
1151 }
1152 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1153 {
1154 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1155 {
1156 yield return false;
1157 }
1158 }
1159 cutIf27:
1160 cutIf26:
1161 cutIf25:
1162 { }
1163 }
1164 goto cutIf24;
1165 }
1166 foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>")))
1167 {
1168 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1169 {
1170 foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
1171 {
1172 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1173 {
1174 yield return false;
1175 }
1176 }
1177 goto cutIf28;
1178 }
1179 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1180 {
1181 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
1182 {
1183 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1184 {
1185 yield return false;
1186 }
1187 }
1188 goto cutIf29;
1189 }
1190 if (CompilerState.codeUsesYield(State))
1191 {
1192 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
1193 {
1194 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1195 {
1196 yield return false;
1197 }
1198 }
1199 goto cutIf30;
1200 }
1201 foreach (bool l11 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1202 {
1203 foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1204 {
1205 yield return false;
1206 }
1207 }
1208 cutIf30:
1209 cutIf29:
1210 cutIf28:
1211 { }
1212 }
1213 cutIf24:
1214 cutIf20:
1215 { }
1216 }
1217 }
1218 }
1219 }
1220 }
1221 }
1222 }
1223 cutIf2:
1224 cutIf1:
1225 { }
1226 }
1227 }
1228 }
1229  
1230 public static IEnumerable<bool> samePredicateRuleList(object arg1, object arg2, object arg3)
1231 {
1232 {
1233 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1234 {
1235 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
1236 {
1237 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
1238 {
1239 yield return true;
1240 yield break;
1241 }
1242 }
1243 }
1244 }
1245 {
1246 Variable First = new Variable();
1247 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Atom.NIL)))
1248 {
1249 foreach (bool l3 in YP.unify(arg2, new ListPair(First, Atom.NIL)))
1250 {
1251 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
1252 {
1253 yield return true;
1254 yield break;
1255 }
1256 }
1257 }
1258 }
1259 {
1260 object SamePredicateRuleList = arg2;
1261 object RestRules = arg3;
1262 Variable First = new Variable();
1263 Variable Rest = new Variable();
1264 Variable FirstRule = new Variable();
1265 Variable x6 = new Variable();
1266 Variable SecondRule = new Variable();
1267 Variable x8 = new Variable();
1268 Variable x9 = new Variable();
1269 Variable FirstHead = new Variable();
1270 Variable x11 = new Variable();
1271 Variable SecondHead = new Variable();
1272 Variable x13 = new Variable();
1273 Variable Name = new Variable();
1274 Variable Arity = new Variable();
1275 Variable RestSamePredicates = new Variable();
1276 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
1277 {
1278 foreach (bool l3 in YP.unify(new Functor2("f", FirstRule, x6), First))
1279 {
1280 foreach (bool l4 in YP.unify(new ListPair(new Functor2("f", SecondRule, x8), x9), Rest))
1281 {
1282 foreach (bool l5 in YP.unify(new Functor2(":-", FirstHead, x11), FirstRule))
1283 {
1284 foreach (bool l6 in YP.unify(new Functor2(":-", SecondHead, x13), SecondRule))
1285 {
1286 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1287 {
1288 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1289 {
1290 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1291 {
1292 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1293 {
1294 yield return true;
1295 yield break;
1296 }
1297 }
1298 goto cutIf3;
1299 }
1300 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1301 {
1302 foreach (bool l9 in YP.unify(RestRules, Rest))
1303 {
1304 yield return true;
1305 yield break;
1306 }
1307 }
1308 cutIf3:
1309 { }
1310 }
1311 goto cutIf2;
1312 }
1313 foreach (bool l6 in YP.unify(SecondHead, SecondRule))
1314 {
1315 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1316 {
1317 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1318 {
1319 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1320 {
1321 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1322 {
1323 yield return true;
1324 yield break;
1325 }
1326 }
1327 goto cutIf4;
1328 }
1329 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1330 {
1331 foreach (bool l9 in YP.unify(RestRules, Rest))
1332 {
1333 yield return true;
1334 yield break;
1335 }
1336 }
1337 cutIf4:
1338 { }
1339 }
1340 }
1341 cutIf2:
1342 goto cutIf1;
1343 }
1344 foreach (bool l5 in YP.unify(FirstHead, FirstRule))
1345 {
1346 foreach (bool l6 in YP.unify(new Functor2(":-", SecondHead, x13), SecondRule))
1347 {
1348 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1349 {
1350 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1351 {
1352 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1353 {
1354 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1355 {
1356 yield return true;
1357 yield break;
1358 }
1359 }
1360 goto cutIf6;
1361 }
1362 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1363 {
1364 foreach (bool l9 in YP.unify(RestRules, Rest))
1365 {
1366 yield return true;
1367 yield break;
1368 }
1369 }
1370 cutIf6:
1371 { }
1372 }
1373 goto cutIf5;
1374 }
1375 foreach (bool l6 in YP.unify(SecondHead, SecondRule))
1376 {
1377 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1378 {
1379 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1380 {
1381 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1382 {
1383 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1384 {
1385 yield return true;
1386 yield break;
1387 }
1388 }
1389 goto cutIf7;
1390 }
1391 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1392 {
1393 foreach (bool l9 in YP.unify(RestRules, Rest))
1394 {
1395 yield return true;
1396 yield break;
1397 }
1398 }
1399 cutIf7:
1400 { }
1401 }
1402 }
1403 cutIf5:
1404 { }
1405 }
1406 cutIf1:
1407 { }
1408 }
1409 }
1410 }
1411 }
1412 }
1413  
1414 public static IEnumerable<bool> maplist_compileClause(object arg1, object arg2, object arg3)
1415 {
1416 {
1417 object _MergedArgNames = arg2;
1418 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1419 {
1420 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
1421 {
1422 yield return true;
1423 yield break;
1424 }
1425 }
1426 }
1427 {
1428 object MergedArgNames = arg2;
1429 Variable ArgAssignments = new Variable();
1430 Variable Calls = new Variable();
1431 Variable Rest = new Variable();
1432 Variable ClauseCode = new Variable();
1433 Variable RestResults = new Variable();
1434 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", ArgAssignments, Calls), Rest)))
1435 {
1436 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("blockScope", ClauseCode), RestResults)))
1437 {
1438 foreach (bool l4 in prependArgAssignments(ArgAssignments, Calls, MergedArgNames, ClauseCode))
1439 {
1440 foreach (bool l5 in maplist_compileClause(Rest, MergedArgNames, RestResults))
1441 {
1442 yield return true;
1443 yield break;
1444 }
1445 }
1446 }
1447 }
1448 }
1449 }
1450  
1451 public static IEnumerable<bool> prependArgAssignments(object arg1, object arg2, object arg3, object arg4)
1452 {
1453 {
1454 object _MergedArgNames = arg3;
1455 Variable In = new Variable();
1456 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1457 {
1458 foreach (bool l3 in YP.unify(arg2, In))
1459 {
1460 foreach (bool l4 in YP.unify(arg4, In))
1461 {
1462 yield return true;
1463 yield break;
1464 }
1465 }
1466 }
1467 }
1468 {
1469 object In = arg2;
1470 object MergedArgNames = arg3;
1471 object ClauseCode = arg4;
1472 Variable VariableName = new Variable();
1473 Variable ArgName = new Variable();
1474 Variable RestArgAssignments = new Variable();
1475 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", VariableName, ArgName), RestArgAssignments)))
1476 {
1477 foreach (bool l3 in member(VariableName, MergedArgNames))
1478 {
1479 foreach (bool l4 in prependArgAssignments(RestArgAssignments, In, MergedArgNames, ClauseCode))
1480 {
1481 yield return true;
1482 yield break;
1483 }
1484 goto cutIf1;
1485 }
1486 foreach (bool l3 in prependArgAssignments(RestArgAssignments, new ListPair(new Functor3("declare", Atom.a("object"), VariableName, new Functor1("var", ArgName)), In), MergedArgNames, ClauseCode))
1487 {
1488 yield return true;
1489 yield break;
1490 }
1491 cutIf1:
1492 { }
1493 }
1494 }
1495 }
1496  
1497 public static IEnumerable<bool> argAssignedAll(object arg1, object arg2, object VariableName)
1498 {
1499 {
1500 object _ArgName = arg1;
1501 foreach (bool l2 in YP.unify(arg2, Atom.NIL))
1502 {
1503 if (YP.nonvar(VariableName))
1504 {
1505 yield return true;
1506 yield break;
1507 }
1508 }
1509 }
1510 {
1511 object ArgName = arg1;
1512 Variable ArgAssignments = new Variable();
1513 Variable _Calls = new Variable();
1514 Variable RestClauseBag = new Variable();
1515 foreach (bool l2 in YP.unify(arg2, new ListPair(new Functor2("f", ArgAssignments, _Calls), RestClauseBag)))
1516 {
1517 foreach (bool l3 in member(new Functor2("f", VariableName, ArgName), ArgAssignments))
1518 {
1519 foreach (bool l4 in argAssignedAll(ArgName, RestClauseBag, VariableName))
1520 {
1521 yield return false;
1522 }
1523 }
1524 }
1525 }
1526 }
1527  
1528 public static IEnumerable<bool> maplist_arg(object arg1, object arg2)
1529 {
1530 {
1531 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1532 {
1533 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
1534 {
1535 yield return true;
1536 yield break;
1537 }
1538 }
1539 }
1540 {
1541 Variable First = new Variable();
1542 Variable Rest = new Variable();
1543 Variable RestResults = new Variable();
1544 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
1545 {
1546 foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor1("arg", First), RestResults)))
1547 {
1548 foreach (bool l4 in maplist_arg(Rest, RestResults))
1549 {
1550 yield return true;
1551 yield break;
1552 }
1553 }
1554 }
1555 }
1556 }
1557  
1558 public static IEnumerable<bool> getFunctionArgNames(object arg1, object arg2, object arg3)
1559 {
1560 {
1561 object _StartArgNumber = arg2;
1562 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1563 {
1564 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
1565 {
1566 yield return true;
1567 yield break;
1568 }
1569 }
1570 }
1571 {
1572 object StartArgNumber = arg2;
1573 Variable x1 = new Variable();
1574 Variable Rest = new Variable();
1575 Variable ArgName = new Variable();
1576 Variable RestFunctionArgs = new Variable();
1577 Variable NumberCodes = new Variable();
1578 Variable NumberAtom = new Variable();
1579 Variable NextArgNumber = new Variable();
1580 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, Rest)))
1581 {
1582 foreach (bool l3 in YP.unify(arg3, new ListPair(ArgName, RestFunctionArgs)))
1583 {
1584 foreach (bool l4 in YP.number_codes(StartArgNumber, NumberCodes))
1585 {
1586 foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes))
1587 {
1588 foreach (bool l6 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName))
1589 {
1590 foreach (bool l7 in YP.unify(NextArgNumber, YP.add(StartArgNumber, 1)))
1591 {
1592 foreach (bool l8 in getFunctionArgNames(Rest, NextArgNumber, RestFunctionArgs))
1593 {
1594 yield return true;
1595 yield break;
1596 }
1597 }
1598 }
1599 }
1600 }
1601 }
1602 }
1603 }
1604 }
1605  
1606 public static IEnumerable<bool> compileBodyWithHeadBindings(object Rule, object VariableNameSuggestions, object State, object ArgAssignments, object Calls)
1607 {
1608 {
1609 Variable Head = new Variable();
1610 Variable Body = new Variable();
1611 Variable x8 = new Variable();
1612 Variable HeadArgs = new Variable();
1613 Variable CompiledHeadArgs = new Variable();
1614 Variable BodyCode = new Variable();
1615 Variable VariableNamesList = new Variable();
1616 Variable ArgUnifications = new Variable();
1617 foreach (bool l2 in YP.unify(new Functor2(":-", Head, Body), Rule))
1618 {
1619 CompilerState.newVariableNames(State, Rule, VariableNameSuggestions);
1620 foreach (bool l3 in YP.univ(Head, new ListPair(x8, HeadArgs)))
1621 {
1622 foreach (bool l4 in maplist_compileTerm(HeadArgs, State, CompiledHeadArgs))
1623 {
1624 foreach (bool l5 in compileRuleBody(Body, State, BodyCode))
1625 {
1626 foreach (bool l6 in CompilerState.variableNamesList(State, VariableNamesList))
1627 {
1628 foreach (bool l7 in compileArgUnifications(HeadArgs, CompiledHeadArgs, 1, HeadArgs, BodyCode, ArgUnifications))
1629 {
1630 foreach (bool l8 in compileDeclarations(VariableNamesList, HeadArgs, Atom.NIL, ArgAssignments, ArgUnifications, Calls))
1631 {
1632 yield return true;
1633 yield break;
1634 }
1635 }
1636 }
1637 }
1638 }
1639 }
1640 }
1641 }
1642 {
1643 foreach (bool l2 in compileBodyWithHeadBindings(new Functor2(":-", Rule, Atom.a("true")), VariableNameSuggestions, State, ArgAssignments, Calls))
1644 {
1645 yield return true;
1646 yield break;
1647 }
1648 }
1649 }
1650  
1651 public static IEnumerable<bool> compileArgUnifications(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
1652 {
1653 {
1654 object x1 = arg2;
1655 object x2 = arg3;
1656 object x3 = arg4;
1657 Variable BodyCode = new Variable();
1658 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1659 {
1660 foreach (bool l3 in YP.unify(arg5, BodyCode))
1661 {
1662 foreach (bool l4 in YP.unify(arg6, BodyCode))
1663 {
1664 yield return true;
1665 yield break;
1666 }
1667 }
1668 }
1669 }
1670 {
1671 object Index = arg3;
1672 object AllHeadArgs = arg4;
1673 object BodyCode = arg5;
1674 object ArgUnifications = arg6;
1675 Variable HeadArg = new Variable();
1676 Variable RestHeadArgs = new Variable();
1677 Variable x3 = new Variable();
1678 Variable RestCompiledHeadArgs = new Variable();
1679 Variable _ArgIndex1 = new Variable();
1680 Variable NextIndex = new Variable();
1681 foreach (bool l2 in YP.unify(arg1, new ListPair(HeadArg, RestHeadArgs)))
1682 {
1683 foreach (bool l3 in YP.unify(arg2, new ListPair(x3, RestCompiledHeadArgs)))
1684 {
1685 foreach (bool l4 in getVariableArgIndex1(HeadArg, AllHeadArgs, _ArgIndex1))
1686 {
1687 foreach (bool l5 in YP.unify(NextIndex, YP.add(Index, 1)))
1688 {
1689 foreach (bool l6 in compileArgUnifications(RestHeadArgs, RestCompiledHeadArgs, NextIndex, AllHeadArgs, BodyCode, ArgUnifications))
1690 {
1691 yield return true;
1692 yield break;
1693 }
1694 }
1695 }
1696 }
1697 }
1698 }
1699 {
1700 object Index = arg3;
1701 object AllHeadArgs = arg4;
1702 object BodyCode = arg5;
1703 Variable _HeadArg = new Variable();
1704 Variable RestHeadArgs = new Variable();
1705 Variable CompiledHeadArg = new Variable();
1706 Variable RestCompiledHeadArgs = new Variable();
1707 Variable ArgName = new Variable();
1708 Variable RestArgUnifications = new Variable();
1709 Variable NumberCodes = new Variable();
1710 Variable NumberAtom = new Variable();
1711 Variable NextIndex = new Variable();
1712 foreach (bool l2 in YP.unify(arg1, new ListPair(_HeadArg, RestHeadArgs)))
1713 {
1714 foreach (bool l3 in YP.unify(arg2, new ListPair(CompiledHeadArg, RestCompiledHeadArgs)))
1715 {
1716 foreach (bool l4 in YP.unify(arg6, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.unify"), new ListPair(new Functor1("var", ArgName), new ListPair(CompiledHeadArg, Atom.NIL))), RestArgUnifications), Atom.NIL)))
1717 {
1718 foreach (bool l5 in YP.number_codes(Index, NumberCodes))
1719 {
1720 foreach (bool l6 in YP.atom_codes(NumberAtom, NumberCodes))
1721 {
1722 foreach (bool l7 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName))
1723 {
1724 foreach (bool l8 in YP.unify(NextIndex, YP.add(Index, 1)))
1725 {
1726 foreach (bool l9 in compileArgUnifications(RestHeadArgs, RestCompiledHeadArgs, NextIndex, AllHeadArgs, BodyCode, RestArgUnifications))
1727 {
1728 yield return true;
1729 yield break;
1730 }
1731 }
1732 }
1733 }
1734 }
1735 }
1736 }
1737 }
1738 }
1739 }
1740  
1741 public static IEnumerable<bool> compileDeclarations(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
1742 {
1743 {
1744 object _HeadArgs = arg2;
1745 Variable ArgAssignmentsIn = new Variable();
1746 Variable DeclarationsIn = new Variable();
1747 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1748 {
1749 foreach (bool l3 in YP.unify(arg3, ArgAssignmentsIn))
1750 {
1751 foreach (bool l4 in YP.unify(arg4, ArgAssignmentsIn))
1752 {
1753 foreach (bool l5 in YP.unify(arg5, DeclarationsIn))
1754 {
1755 foreach (bool l6 in YP.unify(arg6, DeclarationsIn))
1756 {
1757 yield return true;
1758 yield break;
1759 }
1760 }
1761 }
1762 }
1763 }
1764 }
1765 {
1766 object HeadArgs = arg2;
1767 object ArgAssignmentsIn = arg3;
1768 object ArgAssignmentsOut = arg4;
1769 object DeclarationsIn = arg5;
1770 object DeclarationsOut = arg6;
1771 Variable VariableName = new Variable();
1772 Variable Var = new Variable();
1773 Variable RestVariableNames = new Variable();
1774 Variable ArgIndex1 = new Variable();
1775 Variable NumberCodes = new Variable();
1776 Variable NumberAtom = new Variable();
1777 Variable ArgName = new Variable();
1778 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", VariableName, Var), RestVariableNames)))
1779 {
1780 foreach (bool l3 in getVariableArgIndex1(Var, HeadArgs, ArgIndex1))
1781 {
1782 foreach (bool l4 in YP.number_codes(ArgIndex1, NumberCodes))
1783 {
1784 foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes))
1785 {
1786 foreach (bool l6 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName))
1787 {
1788 foreach (bool l7 in compileDeclarations(RestVariableNames, HeadArgs, new ListPair(new Functor2("f", VariableName, ArgName), ArgAssignmentsIn), ArgAssignmentsOut, DeclarationsIn, DeclarationsOut))
1789 {
1790 yield return true;
1791 yield break;
1792 }
1793 }
1794 }
1795 }
1796 }
1797 }
1798 }
1799 {
1800 object HeadArgs = arg2;
1801 object ArgAssignmentsIn = arg3;
1802 object ArgAssignmentsOut = arg4;
1803 object DeclarationsIn = arg5;
1804 Variable VariableName = new Variable();
1805 Variable _Var = new Variable();
1806 Variable RestVariableNames = new Variable();
1807 Variable DeclarationsOut = new Variable();
1808 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", VariableName, _Var), RestVariableNames)))
1809 {
1810 foreach (bool l3 in YP.unify(arg6, new ListPair(new Functor3("declare", Atom.a("Variable"), VariableName, new Functor2("new", Atom.a("Variable"), Atom.NIL)), DeclarationsOut)))
1811 {
1812 foreach (bool l4 in compileDeclarations(RestVariableNames, HeadArgs, ArgAssignmentsIn, ArgAssignmentsOut, DeclarationsIn, DeclarationsOut))
1813 {
1814 yield return true;
1815 yield break;
1816 }
1817 }
1818 }
1819 }
1820 }
1821  
1822 public static IEnumerable<bool> getVariableArgIndex1(object Var, object arg2, object arg3)
1823 {
1824 {
1825 Variable FirstHeadArgs = new Variable();
1826 Variable RestHeadArgs = new Variable();
1827 Variable x4 = new Variable();
1828 foreach (bool l2 in YP.unify(arg2, new ListPair(FirstHeadArgs, RestHeadArgs)))
1829 {
1830 foreach (bool l3 in YP.unify(arg3, 1))
1831 {
1832 if (sameVariable(Var, FirstHeadArgs))
1833 {
1834 foreach (bool l5 in getVariableArgIndex1(Var, RestHeadArgs, x4))
1835 {
1836 goto cutIf1;
1837 }
1838 yield return false;
1839 cutIf1:
1840 yield break;
1841 }
1842 }
1843 }
1844 }
1845 {
1846 object Index = arg3;
1847 Variable x2 = new Variable();
1848 Variable RestHeadArgs = new Variable();
1849 Variable RestIndex = new Variable();
1850 foreach (bool l2 in YP.unify(arg2, new ListPair(x2, RestHeadArgs)))
1851 {
1852 foreach (bool l3 in getVariableArgIndex1(Var, RestHeadArgs, RestIndex))
1853 {
1854 foreach (bool l4 in YP.unify(Index, YP.add(1, RestIndex)))
1855 {
1856 yield return true;
1857 yield break;
1858 }
1859 }
1860 }
1861 }
1862 }
1863  
1864 public static IEnumerable<bool> compileRuleBody(object arg1, object arg2, object arg3)
1865 {
1866 {
1867 object A = arg1;
1868 object State = arg2;
1869 object PseudoCode = arg3;
1870 if (YP.var(A))
1871 {
1872 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("call", A), Atom.a("true")), State, PseudoCode))
1873 {
1874 yield return true;
1875 yield break;
1876 }
1877 }
1878 }
1879 {
1880 object State = arg2;
1881 object PseudoCode = arg3;
1882 Variable A = new Variable();
1883 Variable B = new Variable();
1884 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
1885 {
1886 if (YP.var(A))
1887 {
1888 foreach (bool l4 in compileRuleBody(new Functor2(",", new Functor1("call", A), B), State, PseudoCode))
1889 {
1890 yield return true;
1891 yield break;
1892 }
1893 }
1894 }
1895 }
1896 {
1897 object State = arg2;
1898 object PseudoCode = arg3;
1899 Variable A = new Variable();
1900 Variable B = new Variable();
1901 Variable ACode = new Variable();
1902 Variable BCode = new Variable();
1903 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
1904 {
1905 foreach (bool l3 in compileFunctorCall(A, State, ACode))
1906 {
1907 if (CompilerState.isDetNoneOut(State, A))
1908 {
1909 foreach (bool l5 in compileRuleBody(B, State, BCode))
1910 {
1911 foreach (bool l6 in YP.unify(PseudoCode, new ListPair(ACode, BCode)))
1912 {
1913 yield return true;
1914 yield break;
1915 }
1916 }
1917 }
1918 if (CompilerState.isSemidetNoneOut(State, A))
1919 {
1920 foreach (bool l5 in compileRuleBody(B, State, BCode))
1921 {
1922 foreach (bool l6 in YP.unify(PseudoCode, new ListPair(new Functor2("if", ACode, BCode), Atom.NIL)))
1923 {
1924 yield return true;
1925 yield break;
1926 }
1927 }
1928 }
1929 foreach (bool l4 in compileRuleBody(B, State, BCode))
1930 {
1931 foreach (bool l5 in YP.unify(PseudoCode, new ListPair(new Functor2("foreach", ACode, BCode), Atom.NIL)))
1932 {
1933 yield return true;
1934 yield break;
1935 }
1936 }
1937 }
1938 }
1939 }
1940 {
1941 object State = arg2;
1942 object PseudoCode = arg3;
1943 Variable A = new Variable();
1944 Variable T = new Variable();
1945 Variable B = new Variable();
1946 Variable C = new Variable();
1947 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(";", new Functor2("->", A, T), B), C)))
1948 {
1949 foreach (bool l3 in compileRuleBody(new Functor2(";", new Functor2("->", A, new Functor2(",", T, C)), new Functor2(",", B, C)), State, PseudoCode))
1950 {
1951 yield return true;
1952 yield break;
1953 }
1954 }
1955 }
1956 {
1957 object State = arg2;
1958 object PseudoCode = arg3;
1959 Variable A = new Variable();
1960 Variable B = new Variable();
1961 Variable C = new Variable();
1962 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(";", A, B), C)))
1963 {
1964 foreach (bool l3 in compileRuleBody(new Functor2(";", new Functor2(",", A, C), new Functor2(",", B, C)), State, PseudoCode))
1965 {
1966 yield return true;
1967 yield break;
1968 }
1969 }
1970 }
1971 {
1972 object State = arg2;
1973 Variable A = new Variable();
1974 Variable B = new Variable();
1975 Variable ACode = new Variable();
1976 Variable BCode = new Variable();
1977 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("\\+", A), B)))
1978 {
1979 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("if", new Functor1("not", ACode), BCode), Atom.NIL)))
1980 {
1981 if (CompilerState.isSemidetNoneOut(State, A))
1982 {
1983 foreach (bool l5 in compileFunctorCall(A, State, ACode))
1984 {
1985 foreach (bool l6 in compileRuleBody(B, State, BCode))
1986 {
1987 yield return true;
1988 yield break;
1989 }
1990 }
1991 }
1992 }
1993 }
1994 }
1995 {
1996 object State = arg2;
1997 object PseudoCode = arg3;
1998 Variable A = new Variable();
1999 Variable B = new Variable();
2000 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("\\+", A), B)))
2001 {
2002 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, Atom.a("fail")), Atom.a("true")), B), State, PseudoCode))
2003 {
2004 yield return true;
2005 yield break;
2006 }
2007 }
2008 }
2009 {
2010 object State = arg2;
2011 object PseudoCode = arg3;
2012 Variable A = new Variable();
2013 Variable B = new Variable();
2014 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("once", A), B)))
2015 {
2016 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, Atom.a("true")), Atom.a("fail")), B), State, PseudoCode))
2017 {
2018 yield return true;
2019 yield break;
2020 }
2021 }
2022 }
2023 {
2024 object State = arg2;
2025 object PseudoCode = arg3;
2026 Variable A = new Variable();
2027 Variable T = new Variable();
2028 Variable B = new Variable();
2029 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("->", A, T), B)))
2030 {
2031 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, T), Atom.a("fail")), B), State, PseudoCode))
2032 {
2033 yield return true;
2034 yield break;
2035 }
2036 }
2037 }
2038 {
2039 object State = arg2;
2040 object PseudoCode = arg3;
2041 Variable A = new Variable();
2042 Variable B = new Variable();
2043 Variable C = new Variable();
2044 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("\\=", A, B), C)))
2045 {
2046 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("\\+", new Functor2("=", A, B)), C), State, PseudoCode))
2047 {
2048 yield return true;
2049 yield break;
2050 }
2051 }
2052 }
2053 {
2054 object State = arg2;
2055 object PseudoCode = arg3;
2056 Variable A = new Variable();
2057 Variable ACode = new Variable();
2058 foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("!"), A)))
2059 {
2060 foreach (bool l3 in compileRuleBody(A, State, ACode))
2061 {
2062 foreach (bool l4 in append(ACode, new ListPair(Atom.a("yieldbreak"), Atom.NIL), PseudoCode))
2063 {
2064 yield return true;
2065 yield break;
2066 }
2067 }
2068 }
2069 }
2070 {
2071 object State = arg2;
2072 object PseudoCode = arg3;
2073 Variable Name = new Variable();
2074 Variable A = new Variable();
2075 Variable ACode = new Variable();
2076 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("$CUTIF", Name), A)))
2077 {
2078 foreach (bool l3 in compileRuleBody(A, State, ACode))
2079 {
2080 foreach (bool l4 in append(ACode, new ListPair(new Functor1("breakBlock", Name), Atom.NIL), PseudoCode))
2081 {
2082 yield return true;
2083 yield break;
2084 }
2085 }
2086 }
2087 }
2088 {
2089 object _State = arg2;
2090 Variable x1 = new Variable();
2091 foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("fail"), x1)))
2092 {
2093 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
2094 {
2095 yield return true;
2096 yield break;
2097 }
2098 }
2099 }
2100 {
2101 object State = arg2;
2102 object PseudoCode = arg3;
2103 Variable A = new Variable();
2104 foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("true"), A)))
2105 {
2106 foreach (bool l3 in compileRuleBody(A, State, PseudoCode))
2107 {
2108 yield return true;
2109 yield break;
2110 }
2111 }
2112 }
2113 {
2114 object State = arg2;
2115 Variable A = new Variable();
2116 Variable Term = new Variable();
2117 Variable B = new Variable();
2118 Variable ACode = new Variable();
2119 Variable TermCode = new Variable();
2120 Variable BCode = new Variable();
2121 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("is", A, Term), B)))
2122 {
2123 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.unify"), new ListPair(ACode, new ListPair(TermCode, Atom.NIL))), BCode), Atom.NIL)))
2124 {
2125 foreach (bool l4 in compileTerm(A, State, ACode))
2126 {
2127 foreach (bool l5 in compileExpression(Term, State, TermCode))
2128 {
2129 foreach (bool l6 in compileRuleBody(B, State, BCode))
2130 {
2131 yield return true;
2132 yield break;
2133 }
2134 }
2135 }
2136 }
2137 }
2138 }
2139 {
2140 object State = arg2;
2141 Variable ACode = new Variable();
2142 Variable B = new Variable();
2143 Variable BCode = new Variable();
2144 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("$DET_NONE_OUT", ACode), B)))
2145 {
2146 foreach (bool l3 in YP.unify(arg3, new ListPair(ACode, BCode)))
2147 {
2148 foreach (bool l4 in compileRuleBody(B, State, BCode))
2149 {
2150 yield return true;
2151 yield break;
2152 }
2153 }
2154 }
2155 }
2156 {
2157 object State = arg2;
2158 Variable A = new Variable();
2159 Variable B = new Variable();
2160 Variable FunctionName = new Variable();
2161 Variable X1Code = new Variable();
2162 Variable X2Code = new Variable();
2163 Variable BCode = new Variable();
2164 Variable Name = new Variable();
2165 Variable X1 = new Variable();
2166 Variable X2 = new Variable();
2167 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
2168 {
2169 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("if", new Functor2("call", FunctionName, new ListPair(X1Code, new ListPair(X2Code, Atom.NIL))), BCode), Atom.NIL)))
2170 {
2171 foreach (bool l4 in YP.univ(A, ListPair.make(new object[] { Name, X1, X2 })))
2172 {
2173 foreach (bool l5 in binaryExpressionConditional(Name, FunctionName))
2174 {
2175 foreach (bool l6 in compileExpression(X1, State, X1Code))
2176 {
2177 foreach (bool l7 in compileExpression(X2, State, X2Code))
2178 {
2179 foreach (bool l8 in compileRuleBody(B, State, BCode))
2180 {
2181 yield return true;
2182 yield break;
2183 }
2184 }
2185 }
2186 }
2187 }
2188 }
2189 }
2190 }
2191 {
2192 object State = arg2;
2193 object PseudoCode = arg3;
2194 Variable Template = new Variable();
2195 Variable Goal = new Variable();
2196 Variable Bag = new Variable();
2197 Variable B = new Variable();
2198 Variable TemplateCode = new Variable();
2199 Variable FindallAnswers = new Variable();
2200 Variable GoalAndAddCode = new Variable();
2201 Variable BagCode = new Variable();
2202 Variable BCode = new Variable();
2203 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("findall", Template, Goal, Bag), B)))
2204 {
2205 foreach (bool l3 in compileTerm(Template, State, TemplateCode))
2206 {
2207 foreach (bool l4 in CompilerState.gensym(State, Atom.a("findallAnswers"), FindallAnswers))
2208 {
2209 foreach (bool l5 in compileRuleBody(new Functor2(",", Goal, new Functor2(",", new Functor1("$DET_NONE_OUT", new Functor3("callMember", new Functor1("var", FindallAnswers), Atom.a("add"), Atom.NIL)), Atom.a("fail"))), State, GoalAndAddCode))
2210 {
2211 foreach (bool l6 in compileTerm(Bag, State, BagCode))
2212 {
2213 foreach (bool l7 in compileRuleBody(B, State, BCode))
2214 {
2215 foreach (bool l8 in append(new ListPair(new Functor3("declare", Atom.a("FindallAnswers"), FindallAnswers, new Functor2("new", Atom.a("FindallAnswers"), new ListPair(TemplateCode, Atom.NIL))), GoalAndAddCode), new ListPair(new Functor2("foreach", new Functor3("callMember", new Functor1("var", FindallAnswers), Atom.a("result"), new ListPair(BagCode, Atom.NIL)), BCode), Atom.NIL), PseudoCode))
2216 {
2217 yield return true;
2218 yield break;
2219 }
2220 }
2221 }
2222 }
2223 }
2224 }
2225 }
2226 }
2227 {
2228 object State = arg2;
2229 object PseudoCode = arg3;
2230 Variable Template = new Variable();
2231 Variable Goal = new Variable();
2232 Variable Bag = new Variable();
2233 Variable B = new Variable();
2234 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("bagof", Template, Goal, Bag), B)))
2235 {
2236 foreach (bool l3 in compileBagof(Atom.a("result"), Template, Goal, Bag, B, State, PseudoCode))
2237 {
2238 yield return true;
2239 yield break;
2240 }
2241 }
2242 }
2243 {
2244 object State = arg2;
2245 object PseudoCode = arg3;
2246 Variable Template = new Variable();
2247 Variable Goal = new Variable();
2248 Variable Bag = new Variable();
2249 Variable B = new Variable();
2250 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("setof", Template, Goal, Bag), B)))
2251 {
2252 foreach (bool l3 in compileBagof(Atom.a("resultSet"), Template, Goal, Bag, B, State, PseudoCode))
2253 {
2254 yield return true;
2255 yield break;
2256 }
2257 }
2258 }
2259 {
2260 object State = arg2;
2261 Variable A = new Variable();
2262 Variable B = new Variable();
2263 Variable ATermCode = new Variable();
2264 Variable BCode = new Variable();
2265 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("call", A), B)))
2266 {
2267 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.getIterator"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode), Atom.NIL)))
2268 {
2269 foreach (bool l4 in compileTerm(A, State, ATermCode))
2270 {
2271 foreach (bool l5 in compileRuleBody(B, State, BCode))
2272 {
2273 yield return true;
2274 yield break;
2275 }
2276 }
2277 }
2278 }
2279 }
2280 {
2281 object State = arg2;
2282 Variable A = new Variable();
2283 Variable B = new Variable();
2284 Variable ATermCode = new Variable();
2285 Variable BCode = new Variable();
2286 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("current_predicate", A), B)))
2287 {
2288 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.current_predicate"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode), Atom.NIL)))
2289 {
2290 foreach (bool l4 in compileTerm(A, State, ATermCode))
2291 {
2292 foreach (bool l5 in compileRuleBody(B, State, BCode))
2293 {
2294 yield return true;
2295 yield break;
2296 }
2297 }
2298 }
2299 }
2300 }
2301 {
2302 object State = arg2;
2303 Variable A = new Variable();
2304 Variable B = new Variable();
2305 Variable ATermCode = new Variable();
2306 Variable BCode = new Variable();
2307 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("asserta", A), B)))
2308 {
2309 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.asserta"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode)))
2310 {
2311 foreach (bool l4 in compileTerm(A, State, ATermCode))
2312 {
2313 foreach (bool l5 in compileRuleBody(B, State, BCode))
2314 {
2315 yield return true;
2316 yield break;
2317 }
2318 }
2319 }
2320 }
2321 }
2322 {
2323 object State = arg2;
2324 Variable A = new Variable();
2325 Variable B = new Variable();
2326 Variable ATermCode = new Variable();
2327 Variable BCode = new Variable();
2328 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("assertz", A), B)))
2329 {
2330 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.assertz"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode)))
2331 {
2332 foreach (bool l4 in compileTerm(A, State, ATermCode))
2333 {
2334 foreach (bool l5 in compileRuleBody(B, State, BCode))
2335 {
2336 yield return true;
2337 yield break;
2338 }
2339 }
2340 }
2341 }
2342 }
2343 {
2344 object State = arg2;
2345 object PseudoCode = arg3;
2346 Variable A = new Variable();
2347 Variable B = new Variable();
2348 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("assert", A), B)))
2349 {
2350 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("assertz", A), B), State, PseudoCode))
2351 {
2352 yield return true;
2353 yield break;
2354 }
2355 }
2356 }
2357 {
2358 object State = arg2;
2359 Variable Goal = new Variable();
2360 Variable Catcher = new Variable();
2361 Variable Handler = new Variable();
2362 Variable B = new Variable();
2363 Variable CatchGoal = new Variable();
2364 Variable GoalTermCode = new Variable();
2365 Variable BCode = new Variable();
2366 Variable CatcherTermCode = new Variable();
2367 Variable HandlerAndBCode = new Variable();
2368 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("catch", Goal, Catcher, Handler), B)))
2369 {
2370 foreach (bool l3 in YP.unify(arg3, ListPair.make(new object[] { new Functor3("declare", Atom.a("YP.Catch"), CatchGoal, new Functor2("new", Atom.a("YP.Catch"), new ListPair(GoalTermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL)))), new Functor2("foreach", new Functor1("var", CatchGoal), BCode), new Functor2("foreach", new Functor3("callMember", new Functor1("var", CatchGoal), Atom.a("unifyExceptionOrThrow"), new ListPair(CatcherTermCode, Atom.NIL)), HandlerAndBCode) })))
2371 {
2372 foreach (bool l4 in CompilerState.gensym(State, Atom.a("catchGoal"), CatchGoal))
2373 {
2374 foreach (bool l5 in compileTerm(Goal, State, GoalTermCode))
2375 {
2376 foreach (bool l6 in compileTerm(Catcher, State, CatcherTermCode))
2377 {
2378 foreach (bool l7 in compileRuleBody(B, State, BCode))
2379 {
2380 foreach (bool l8 in compileRuleBody(new Functor2(",", Handler, B), State, HandlerAndBCode))
2381 {
2382 yield return true;
2383 yield break;
2384 }
2385 }
2386 }
2387 }
2388 }
2389 }
2390 }
2391 }
2392 {
2393 object State = arg2;
2394 object PseudoCode = arg3;
2395 Variable A = new Variable();
2396 Variable B = new Variable();
2397 Variable C = new Variable();
2398 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(",", A, B), C)))
2399 {
2400 foreach (bool l3 in compileRuleBody(new Functor2(",", A, new Functor2(",", B, C)), State, PseudoCode))
2401 {
2402 yield return true;
2403 yield break;
2404 }
2405 }
2406 }
2407 {
2408 object State = arg2;
2409 object PseudoCode = arg3;
2410 Variable A = new Variable();
2411 Variable B = new Variable();
2412 foreach (bool l2 in YP.unify(arg1, new Functor2(";", A, B)))
2413 {
2414 if (YP.var(A))
2415 {
2416 foreach (bool l4 in compileRuleBody(new Functor2(";", new Functor1("call", A), B), State, PseudoCode))
2417 {
2418 yield return true;
2419 yield break;
2420 }
2421 }
2422 }
2423 }
2424 {
2425 object State = arg2;
2426 Variable A = new Variable();
2427 Variable T = new Variable();
2428 Variable B = new Variable();
2429 Variable CutIfLabel = new Variable();
2430 Variable Code = new Variable();
2431 foreach (bool l2 in YP.unify(arg1, new Functor2(";", new Functor2("->", A, T), B)))
2432 {
2433 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("breakableBlock", CutIfLabel, Code), Atom.NIL)))
2434 {
2435 foreach (bool l4 in CompilerState.gensym(State, Atom.a("cutIf"), CutIfLabel))
2436 {
2437 foreach (bool l5 in compileRuleBody(new Functor2(";", new Functor2(",", A, new Functor2(",", new Functor1("$CUTIF", CutIfLabel), T)), B), State, Code))
2438 {
2439 yield return true;
2440 yield break;
2441 }
2442 }
2443 }
2444 }
2445 }
2446 {
2447 object State = arg2;
2448 object PseudoCode = arg3;
2449 Variable _B = new Variable();
2450 foreach (bool l2 in YP.unify(arg1, new Functor2(";", Atom.a("!"), _B)))
2451 {
2452 foreach (bool l3 in compileRuleBody(Atom.a("!"), State, PseudoCode))
2453 {
2454 yield return true;
2455 yield break;
2456 }
2457 }
2458 }
2459 {
2460 object State = arg2;
2461 object PseudoCode = arg3;
2462 Variable A = new Variable();
2463 Variable B = new Variable();
2464 Variable ACode = new Variable();
2465 Variable BCode = new Variable();
2466 foreach (bool l2 in YP.unify(arg1, new Functor2(";", A, B)))
2467 {
2468 foreach (bool l3 in compileRuleBody(A, State, ACode))
2469 {
2470 foreach (bool l4 in compileRuleBody(B, State, BCode))
2471 {
2472 foreach (bool l5 in append(ACode, BCode, PseudoCode))
2473 {
2474 yield return true;
2475 yield break;
2476 }
2477 }
2478 }
2479 }
2480 }
2481 {
2482 object State = arg2;
2483 foreach (bool l2 in YP.unify(arg1, Atom.a("!")))
2484 {
2485 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("return"), Atom.NIL)))
2486 {
2487 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
2488 {
2489 yield return true;
2490 yield break;
2491 }
2492 }
2493 }
2494 }
2495 {
2496 object State = arg2;
2497 foreach (bool l2 in YP.unify(arg1, Atom.a("!")))
2498 {
2499 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("returntrue"), Atom.NIL)))
2500 {
2501 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
2502 {
2503 yield return true;
2504 yield break;
2505 }
2506 }
2507 }
2508 }
2509 {
2510 object State = arg2;
2511 foreach (bool l2 in YP.unify(arg1, Atom.a("!")))
2512 {
2513 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("yieldtrue"), new ListPair(Atom.a("yieldbreak"), Atom.NIL))))
2514 {
2515 CompilerState.setCodeUsesYield(State);
2516 yield return true;
2517 yield break;
2518 }
2519 }
2520 }
2521 {
2522 object _State = arg2;
2523 Variable Name = new Variable();
2524 foreach (bool l2 in YP.unify(arg1, new Functor1("$CUTIF", Name)))
2525 {
2526 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("breakBlock", Name), Atom.NIL)))
2527 {
2528 yield return true;
2529 yield break;
2530 }
2531 }
2532 }
2533 {
2534 object State = arg2;
2535 foreach (bool l2 in YP.unify(arg1, Atom.a("true")))
2536 {
2537 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("return"), Atom.NIL)))
2538 {
2539 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
2540 {
2541 yield return true;
2542 yield break;
2543 }
2544 }
2545 }
2546 }
2547 {
2548 object State = arg2;
2549 foreach (bool l2 in YP.unify(arg1, Atom.a("true")))
2550 {
2551 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("returntrue"), Atom.NIL)))
2552 {
2553 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
2554 {
2555 yield return true;
2556 yield break;
2557 }
2558 }
2559 }
2560 }
2561 {
2562 object State = arg2;
2563 foreach (bool l2 in YP.unify(arg1, Atom.a("true")))
2564 {
2565 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("yieldfalse"), Atom.NIL)))
2566 {
2567 CompilerState.setCodeUsesYield(State);
2568 yield return true;
2569 yield break;
2570 }
2571 }
2572 }
2573 {
2574 object A = arg1;
2575 object State = arg2;
2576 object PseudoCode = arg3;
2577 foreach (bool l2 in compileRuleBody(new Functor2(",", A, Atom.a("true")), State, PseudoCode))
2578 {
2579 yield return true;
2580 yield break;
2581 }
2582 }
2583 }
2584  
2585 public static IEnumerable<bool> compileBagof(object ResultMethod, object Template, object Goal, object Bag, object B, object State, object PseudoCode)
2586 {
2587 {
2588 Variable TemplateCode = new Variable();
2589 Variable GoalTermCode = new Variable();
2590 Variable UnqualifiedGoal = new Variable();
2591 Variable BagofAnswers = new Variable();
2592 Variable GoalAndAddCode = new Variable();
2593 Variable BagCode = new Variable();
2594 Variable BCode = new Variable();
2595 foreach (bool l2 in compileTerm(Template, State, TemplateCode))
2596 {
2597 foreach (bool l3 in compileTerm(Goal, State, GoalTermCode))
2598 {
2599 foreach (bool l4 in unqualifiedGoal(Goal, UnqualifiedGoal))
2600 {
2601 foreach (bool l5 in CompilerState.gensym(State, Atom.a("bagofAnswers"), BagofAnswers))
2602 {
2603 foreach (bool l6 in compileRuleBody(new Functor2(",", UnqualifiedGoal, new Functor2(",", new Functor1("$DET_NONE_OUT", new Functor3("callMember", new Functor1("var", BagofAnswers), Atom.a("add"), Atom.NIL)), Atom.a("fail"))), State, GoalAndAddCode))
2604 {
2605 foreach (bool l7 in compileTerm(Bag, State, BagCode))
2606 {
2607 foreach (bool l8 in compileRuleBody(B, State, BCode))
2608 {
2609 foreach (bool l9 in append(new ListPair(new Functor3("declare", Atom.a("BagofAnswers"), BagofAnswers, new Functor2("new", Atom.a("BagofAnswers"), new ListPair(TemplateCode, new ListPair(GoalTermCode, Atom.NIL)))), GoalAndAddCode), new ListPair(new Functor2("foreach", new Functor3("callMember", new Functor1("var", BagofAnswers), ResultMethod, new ListPair(BagCode, Atom.NIL)), BCode), Atom.NIL), PseudoCode))
2610 {
2611 yield return true;
2612 yield break;
2613 }
2614 }
2615 }
2616 }
2617 }
2618 }
2619 }
2620 }
2621 }
2622 }
2623  
2624 public static IEnumerable<bool> unqualifiedGoal(object arg1, object arg2)
2625 {
2626 {
2627 object Goal = arg1;
2628 foreach (bool l2 in YP.unify(arg2, new Functor1("call", Goal)))
2629 {
2630 if (YP.var(Goal))
2631 {
2632 yield return true;
2633 yield break;
2634 }
2635 }
2636 }
2637 {
2638 object UnqualifiedGoal = arg2;
2639 Variable x1 = new Variable();
2640 Variable Goal = new Variable();
2641 foreach (bool l2 in YP.unify(arg1, new Functor2("^", x1, Goal)))
2642 {
2643 foreach (bool l3 in unqualifiedGoal(Goal, UnqualifiedGoal))
2644 {
2645 yield return true;
2646 yield break;
2647 }
2648 }
2649 }
2650 {
2651 Variable UnqualifiedGoal = new Variable();
2652 foreach (bool l2 in YP.unify(arg1, UnqualifiedGoal))
2653 {
2654 foreach (bool l3 in YP.unify(arg2, UnqualifiedGoal))
2655 {
2656 yield return true;
2657 yield break;
2658 }
2659 }
2660 }
2661 }
2662  
2663 public static IEnumerable<bool> binaryExpressionConditional(object arg1, object arg2)
2664 {
2665 {
2666 foreach (bool l2 in YP.unify(arg1, Atom.a("=:=")))
2667 {
2668 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.equal")))
2669 {
2670 yield return true;
2671 yield break;
2672 }
2673 }
2674 }
2675 {
2676 foreach (bool l2 in YP.unify(arg1, Atom.a("=\\=")))
2677 {
2678 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.notEqual")))
2679 {
2680 yield return true;
2681 yield break;
2682 }
2683 }
2684 }
2685 {
2686 foreach (bool l2 in YP.unify(arg1, Atom.a(">")))
2687 {
2688 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.greaterThan")))
2689 {
2690 yield return true;
2691 yield break;
2692 }
2693 }
2694 }
2695 {
2696 foreach (bool l2 in YP.unify(arg1, Atom.a("<")))
2697 {
2698 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.lessThan")))
2699 {
2700 yield return true;
2701 yield break;
2702 }
2703 }
2704 }
2705 {
2706 foreach (bool l2 in YP.unify(arg1, Atom.a(">=")))
2707 {
2708 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.greaterThanOrEqual")))
2709 {
2710 yield return true;
2711 yield break;
2712 }
2713 }
2714 }
2715 {
2716 foreach (bool l2 in YP.unify(arg1, Atom.a("=<")))
2717 {
2718 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.lessThanOrEqual")))
2719 {
2720 yield return true;
2721 yield break;
2722 }
2723 }
2724 }
2725 }
2726  
2727 public static IEnumerable<bool> compileFunctorCall(object Functor_1, object State, object PseudoCode)
2728 {
2729 {
2730 Variable FunctorName = new Variable();
2731 Variable FunctorArgs = new Variable();
2732 Variable x6 = new Variable();
2733 Variable Arity = new Variable();
2734 Variable FunctionName = new Variable();
2735 Variable CompiledArgs = new Variable();
2736 foreach (bool l2 in YP.univ(Functor_1, new ListPair(FunctorName, FunctorArgs)))
2737 {
2738 foreach (bool l3 in YP.functor(Functor_1, x6, Arity))
2739 {
2740 foreach (bool l4 in functorCallFunctionName(State, FunctorName, Arity, FunctionName))
2741 {
2742 foreach (bool l5 in maplist_compileTerm(FunctorArgs, State, CompiledArgs))
2743 {
2744 if (YP.termEqual(FunctionName, Atom.NIL))
2745 {
2746 foreach (bool l7 in YP.unify(PseudoCode, new Functor2("call", Atom.a("YP.matchDynamic"), new ListPair(new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", FunctorName), Atom.NIL)), new ListPair(new Functor1("objectArray", CompiledArgs), Atom.NIL)))))
2747 {
2748 yield return true;
2749 yield break;
2750 }
2751 goto cutIf1;
2752 }
2753 foreach (bool l6 in YP.unify(PseudoCode, new Functor3("functorCall", FunctionName, FunctorArgs, CompiledArgs)))
2754 {
2755 yield return true;
2756 yield break;
2757 }
2758 cutIf1:
2759 { }
2760 }
2761 }
2762 }
2763 }
2764 }
2765 }
2766  
2767 public static IEnumerable<bool> functorCallFunctionName(object arg1, object arg2, object arg3, object arg4)
2768 {
2769 {
2770 object _State = arg1;
2771 object Name = arg2;
2772 object Arity = arg3;
2773 object x4 = arg4;
2774 if (functorCallIsSpecialForm(Name, Arity))
2775 {
2776 yield break;
2777 }
2778 }
2779 {
2780 object x1 = arg1;
2781 object Name = arg2;
2782 object Arity = arg3;
2783 object FunctionName = arg4;
2784 foreach (bool l2 in functorCallYPFunctionName(Name, Arity, FunctionName))
2785 {
2786 yield return true;
2787 yield break;
2788 }
2789 }
2790 {
2791 object State = arg1;
2792 object Arity = arg3;
2793 Variable Name = new Variable();
2794 foreach (bool l2 in YP.unify(arg2, Name))
2795 {
2796 foreach (bool l3 in YP.unify(arg4, Name))
2797 {
2798 if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a("")))
2799 {
2800 yield return true;
2801 yield break;
2802 }
2803 }
2804 }
2805 }
2806 {
2807 object _State = arg1;
2808 object _Arity = arg3;
2809 Variable Name = new Variable();
2810 foreach (bool l2 in YP.unify(arg2, Name))
2811 {
2812 foreach (bool l3 in YP.unify(arg4, Name))
2813 {
2814 foreach (bool l4 in Atom.module(Name, Atom.a("")))
2815 {
2816 yield return true;
2817 yield break;
2818 }
2819 }
2820 }
2821 }
2822 {
2823 object _State = arg1;
2824 object Name = arg2;
2825 object _Arity = arg3;
2826 foreach (bool l2 in YP.unify(arg4, Atom.NIL))
2827 {
2828 foreach (bool l3 in Atom.module(Name, Atom.NIL))
2829 {
2830 yield return true;
2831 yield break;
2832 }
2833 }
2834 }
2835 {
2836 object _State = arg1;
2837 object Name = arg2;
2838 object Arity = arg3;
2839 object x4 = arg4;
2840 Variable Module = new Variable();
2841 Variable Message = new Variable();
2842 foreach (bool l2 in Atom.module(Name, Module))
2843 {
2844 foreach (bool l3 in YP.atom_concat(Atom.a("Not supporting calls to external module: "), Module, Message))
2845 {
2846 YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("callable"), new Functor2("/", Name, Arity)), Message));
2847 yield return true;
2848 yield break;
2849 }
2850 }
2851 }
2852 {
2853 object _State = arg1;
2854 object Name = arg2;
2855 object _Arity = arg3;
2856 object x4 = arg4;
2857 YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("callable"), Name), Atom.a("Term is not callable")));
2858 yield return true;
2859 yield break;
2860 }
2861 }
2862  
2863 public static bool functorCallIsSpecialForm(object Name, object Arity)
2864 {
2865 {
2866 Variable x3 = new Variable();
2867 if (YP.termEqual(Arity, 0))
2868 {
2869 if (YP.termEqual(Name, Atom.a("!")))
2870 {
2871 return true;
2872 }
2873 if (YP.termEqual(Name, Atom.a("fail")))
2874 {
2875 return true;
2876 }
2877 if (YP.termEqual(Name, Atom.a("true")))
2878 {
2879 return true;
2880 }
2881 }
2882 if (YP.termEqual(Arity, 1))
2883 {
2884 if (YP.termEqual(Name, Atom.a("\\+")))
2885 {
2886 return true;
2887 }
2888 if (YP.termEqual(Name, Atom.a("once")))
2889 {
2890 return true;
2891 }
2892 if (YP.termEqual(Name, Atom.a("$CUTIF")))
2893 {
2894 return true;
2895 }
2896 if (YP.termEqual(Name, Atom.a("$DET_NONE_OUT")))
2897 {
2898 return true;
2899 }
2900 if (YP.termEqual(Name, Atom.a("call")))
2901 {
2902 return true;
2903 }
2904 if (YP.termEqual(Name, Atom.a("current_predicate")))
2905 {
2906 return true;
2907 }
2908 if (YP.termEqual(Name, Atom.a("asserta")))
2909 {
2910 return true;
2911 }
2912 if (YP.termEqual(Name, Atom.a("assertz")))
2913 {
2914 return true;
2915 }
2916 if (YP.termEqual(Name, Atom.a("assert")))
2917 {
2918 return true;
2919 }
2920 }
2921 if (YP.termEqual(Arity, 2))
2922 {
2923 if (YP.termEqual(Name, Atom.a(";")))
2924 {
2925 return true;
2926 }
2927 if (YP.termEqual(Name, Atom.a(",")))
2928 {
2929 return true;
2930 }
2931 if (YP.termEqual(Name, Atom.a("->")))
2932 {
2933 return true;
2934 }
2935 if (YP.termEqual(Name, Atom.a("\\=")))
2936 {
2937 return true;
2938 }
2939 if (YP.termEqual(Name, Atom.a("is")))
2940 {
2941 return true;
2942 }
2943 foreach (bool l3 in binaryExpressionConditional(Name, x3))
2944 {
2945 return true;
2946 }
2947 }
2948 if (YP.termEqual(Arity, 3))
2949 {
2950 if (YP.termEqual(Name, Atom.a("findall")))
2951 {
2952 return true;
2953 }
2954 if (YP.termEqual(Name, Atom.a("bagof")))
2955 {
2956 return true;
2957 }
2958 if (YP.termEqual(Name, Atom.a("setof")))
2959 {
2960 return true;
2961 }
2962 if (YP.termEqual(Name, Atom.a("catch")))
2963 {
2964 return true;
2965 }
2966 }
2967 }
2968 return false;
2969 }
2970  
2971 public static IEnumerable<bool> functorCallYPFunctionName(object arg1, object arg2, object arg3)
2972 {
2973 {
2974 foreach (bool l2 in YP.unify(arg1, Atom.a("=")))
2975 {
2976 foreach (bool l3 in YP.unify(arg2, 2))
2977 {
2978 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.unify")))
2979 {
2980 yield return true;
2981 yield break;
2982 }
2983 }
2984 }
2985 }
2986 {
2987 foreach (bool l2 in YP.unify(arg1, Atom.a("=..")))
2988 {
2989 foreach (bool l3 in YP.unify(arg2, 2))
2990 {
2991 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.univ")))
2992 {
2993 yield return true;
2994 yield break;
2995 }
2996 }
2997 }
2998 }
2999 {
3000 foreach (bool l2 in YP.unify(arg1, Atom.a("var")))
3001 {
3002 foreach (bool l3 in YP.unify(arg2, 1))
3003 {
3004 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.var")))
3005 {
3006 yield return true;
3007 yield break;
3008 }
3009 }
3010 }
3011 }
3012 {
3013 foreach (bool l2 in YP.unify(arg1, Atom.a("nonvar")))
3014 {
3015 foreach (bool l3 in YP.unify(arg2, 1))
3016 {
3017 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.nonvar")))
3018 {
3019 yield return true;
3020 yield break;
3021 }
3022 }
3023 }
3024 }
3025 {
3026 foreach (bool l2 in YP.unify(arg1, Atom.a("arg")))
3027 {
3028 foreach (bool l3 in YP.unify(arg2, 3))
3029 {
3030 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.arg")))
3031 {
3032 yield return true;
3033 yield break;
3034 }
3035 }
3036 }
3037 }
3038 {
3039 foreach (bool l2 in YP.unify(arg1, Atom.a("functor")))
3040 {
3041 foreach (bool l3 in YP.unify(arg2, 3))
3042 {
3043 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.functor")))
3044 {
3045 yield return true;
3046 yield break;
3047 }
3048 }
3049 }
3050 }
3051 {
3052 foreach (bool l2 in YP.unify(arg1, Atom.a("repeat")))
3053 {
3054 foreach (bool l3 in YP.unify(arg2, 0))
3055 {
3056 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.repeat")))
3057 {
3058 yield return true;
3059 yield break;
3060 }
3061 }
3062 }
3063 }
3064 {
3065 foreach (bool l2 in YP.unify(arg1, Atom.a("get_code")))
3066 {
3067 foreach (bool l3 in YP.unify(arg2, 1))
3068 {
3069 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.get_code")))
3070 {
3071 yield return true;
3072 yield break;
3073 }
3074 }
3075 }
3076 }
3077 {
3078 foreach (bool l2 in YP.unify(arg1, Atom.a("current_op")))
3079 {
3080 foreach (bool l3 in YP.unify(arg2, 3))
3081 {
3082 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_op")))
3083 {
3084 yield return true;
3085 yield break;
3086 }
3087 }
3088 }
3089 }
3090 {
3091 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_length")))
3092 {
3093 foreach (bool l3 in YP.unify(arg2, 2))
3094 {
3095 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_length")))
3096 {
3097 yield return true;
3098 yield break;
3099 }
3100 }
3101 }
3102 }
3103 {
3104 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_concat")))
3105 {
3106 foreach (bool l3 in YP.unify(arg2, 3))
3107 {
3108 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_concat")))
3109 {
3110 yield return true;
3111 yield break;
3112 }
3113 }
3114 }
3115 }
3116 {
3117 foreach (bool l2 in YP.unify(arg1, Atom.a("sub_atom")))
3118 {
3119 foreach (bool l3 in YP.unify(arg2, 5))
3120 {
3121 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.sub_atom")))
3122 {
3123 yield return true;
3124 yield break;
3125 }
3126 }
3127 }
3128 }
3129 {
3130 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_chars")))
3131 {
3132 foreach (bool l3 in YP.unify(arg2, 2))
3133 {
3134 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_chars")))
3135 {
3136 yield return true;
3137 yield break;
3138 }
3139 }
3140 }
3141 }
3142 {
3143 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_codes")))
3144 {
3145 foreach (bool l3 in YP.unify(arg2, 2))
3146 {
3147 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_codes")))
3148 {
3149 yield return true;
3150 yield break;
3151 }
3152 }
3153 }
3154 }
3155 {
3156 foreach (bool l2 in YP.unify(arg1, Atom.a("char_code")))
3157 {
3158 foreach (bool l3 in YP.unify(arg2, 2))
3159 {
3160 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.char_code")))
3161 {
3162 yield return true;
3163 yield break;
3164 }
3165 }
3166 }
3167 }
3168 {
3169 foreach (bool l2 in YP.unify(arg1, Atom.a("number_chars")))
3170 {
3171 foreach (bool l3 in YP.unify(arg2, 2))
3172 {
3173 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number_chars")))
3174 {
3175 yield return true;
3176 yield break;
3177 }
3178 }
3179 }
3180 }
3181 {
3182 foreach (bool l2 in YP.unify(arg1, Atom.a("number_codes")))
3183 {
3184 foreach (bool l3 in YP.unify(arg2, 2))
3185 {
3186 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number_codes")))
3187 {
3188 yield return true;
3189 yield break;
3190 }
3191 }
3192 }
3193 }
3194 {
3195 foreach (bool l2 in YP.unify(arg1, Atom.a("copy_term")))
3196 {
3197 foreach (bool l3 in YP.unify(arg2, 2))
3198 {
3199 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.copy_term")))
3200 {
3201 yield return true;
3202 yield break;
3203 }
3204 }
3205 }
3206 }
3207 {
3208 foreach (bool l2 in YP.unify(arg1, Atom.a("sort")))
3209 {
3210 foreach (bool l3 in YP.unify(arg2, 2))
3211 {
3212 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.sort")))
3213 {
3214 yield return true;
3215 yield break;
3216 }
3217 }
3218 }
3219 }
3220 {
3221 // Manually included : script_event for callback to LSL/C#
3222  
3223 //object x1 = arg1;
3224 foreach (bool l2 in YP.unify(arg1, Atom.a(@"script_event")))
3225 {
3226 foreach (bool l3 in YP.unify(arg2, 2))
3227 {
3228 foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.script_event")))
3229 {
3230 yield return true;
3231 yield break;
3232 }
3233 }
3234 }
3235 }
3236 {
3237 foreach (bool l2 in YP.unify(arg1, Atom.a("nl")))
3238 {
3239 foreach (bool l3 in YP.unify(arg2, 0))
3240 {
3241 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.nl")))
3242 {
3243 yield return true;
3244 yield break;
3245 }
3246 }
3247 }
3248 }
3249 {
3250 foreach (bool l2 in YP.unify(arg1, Atom.a("write")))
3251 {
3252 foreach (bool l3 in YP.unify(arg2, 1))
3253 {
3254 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.write")))
3255 {
3256 yield return true;
3257 yield break;
3258 }
3259 }
3260 }
3261 }
3262 {
3263 foreach (bool l2 in YP.unify(arg1, Atom.a("put_code")))
3264 {
3265 foreach (bool l3 in YP.unify(arg2, 1))
3266 {
3267 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.put_code")))
3268 {
3269 yield return true;
3270 yield break;
3271 }
3272 }
3273 }
3274 }
3275 {
3276 foreach (bool l2 in YP.unify(arg1, Atom.a("see")))
3277 {
3278 foreach (bool l3 in YP.unify(arg2, 1))
3279 {
3280 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.see")))
3281 {
3282 yield return true;
3283 yield break;
3284 }
3285 }
3286 }
3287 }
3288 {
3289 foreach (bool l2 in YP.unify(arg1, Atom.a("seen")))
3290 {
3291 foreach (bool l3 in YP.unify(arg2, 0))
3292 {
3293 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.seen")))
3294 {
3295 yield return true;
3296 yield break;
3297 }
3298 }
3299 }
3300 }
3301 {
3302 foreach (bool l2 in YP.unify(arg1, Atom.a("tell")))
3303 {
3304 foreach (bool l3 in YP.unify(arg2, 1))
3305 {
3306 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.tell")))
3307 {
3308 yield return true;
3309 yield break;
3310 }
3311 }
3312 }
3313 }
3314 {
3315 foreach (bool l2 in YP.unify(arg1, Atom.a("told")))
3316 {
3317 foreach (bool l3 in YP.unify(arg2, 0))
3318 {
3319 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.told")))
3320 {
3321 yield return true;
3322 yield break;
3323 }
3324 }
3325 }
3326 }
3327 {
3328 foreach (bool l2 in YP.unify(arg1, Atom.a("clause")))
3329 {
3330 foreach (bool l3 in YP.unify(arg2, 2))
3331 {
3332 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.clause")))
3333 {
3334 yield return true;
3335 yield break;
3336 }
3337 }
3338 }
3339 }
3340 {
3341 foreach (bool l2 in YP.unify(arg1, Atom.a("retract")))
3342 {
3343 foreach (bool l3 in YP.unify(arg2, 1))
3344 {
3345 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.retract")))
3346 {
3347 yield return true;
3348 yield break;
3349 }
3350 }
3351 }
3352 }
3353 {
3354 foreach (bool l2 in YP.unify(arg1, Atom.a("abolish")))
3355 {
3356 foreach (bool l3 in YP.unify(arg2, 1))
3357 {
3358 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.abolish")))
3359 {
3360 yield return true;
3361 yield break;
3362 }
3363 }
3364 }
3365 }
3366 {
3367 foreach (bool l2 in YP.unify(arg1, Atom.a("retractall")))
3368 {
3369 foreach (bool l3 in YP.unify(arg2, 1))
3370 {
3371 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.retractall")))
3372 {
3373 yield return true;
3374 yield break;
3375 }
3376 }
3377 }
3378 }
3379 {
3380 foreach (bool l2 in YP.unify(arg1, Atom.a("atom")))
3381 {
3382 foreach (bool l3 in YP.unify(arg2, 1))
3383 {
3384 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom")))
3385 {
3386 yield return true;
3387 yield break;
3388 }
3389 }
3390 }
3391 }
3392 {
3393 foreach (bool l2 in YP.unify(arg1, Atom.a("integer")))
3394 {
3395 foreach (bool l3 in YP.unify(arg2, 1))
3396 {
3397 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.integer")))
3398 {
3399 yield return true;
3400 yield break;
3401 }
3402 }
3403 }
3404 }
3405 {
3406 foreach (bool l2 in YP.unify(arg1, Atom.a("float")))
3407 {
3408 foreach (bool l3 in YP.unify(arg2, 1))
3409 {
3410 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.isFloat")))
3411 {
3412 yield return true;
3413 yield break;
3414 }
3415 }
3416 }
3417 }
3418 {
3419 foreach (bool l2 in YP.unify(arg1, Atom.a("number")))
3420 {
3421 foreach (bool l3 in YP.unify(arg2, 1))
3422 {
3423 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number")))
3424 {
3425 yield return true;
3426 yield break;
3427 }
3428 }
3429 }
3430 }
3431 {
3432 foreach (bool l2 in YP.unify(arg1, Atom.a("atomic")))
3433 {
3434 foreach (bool l3 in YP.unify(arg2, 1))
3435 {
3436 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atomic")))
3437 {
3438 yield return true;
3439 yield break;
3440 }
3441 }
3442 }
3443 }
3444 {
3445 foreach (bool l2 in YP.unify(arg1, Atom.a("compound")))
3446 {
3447 foreach (bool l3 in YP.unify(arg2, 1))
3448 {
3449 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.compound")))
3450 {
3451 yield return true;
3452 yield break;
3453 }
3454 }
3455 }
3456 }
3457 {
3458 foreach (bool l2 in YP.unify(arg1, Atom.a("==")))
3459 {
3460 foreach (bool l3 in YP.unify(arg2, 2))
3461 {
3462 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termEqual")))
3463 {
3464 yield return true;
3465 yield break;
3466 }
3467 }
3468 }
3469 }
3470 {
3471 foreach (bool l2 in YP.unify(arg1, Atom.a("\\==")))
3472 {
3473 foreach (bool l3 in YP.unify(arg2, 2))
3474 {
3475 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termNotEqual")))
3476 {
3477 yield return true;
3478 yield break;
3479 }
3480 }
3481 }
3482 }
3483 {
3484 foreach (bool l2 in YP.unify(arg1, Atom.a("@<")))
3485 {
3486 foreach (bool l3 in YP.unify(arg2, 2))
3487 {
3488 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termLessThan")))
3489 {
3490 yield return true;
3491 yield break;
3492 }
3493 }
3494 }
3495 }
3496 {
3497 foreach (bool l2 in YP.unify(arg1, Atom.a("@=<")))
3498 {
3499 foreach (bool l3 in YP.unify(arg2, 2))
3500 {
3501 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termLessThanOrEqual")))
3502 {
3503 yield return true;
3504 yield break;
3505 }
3506 }
3507 }
3508 }
3509 {
3510 foreach (bool l2 in YP.unify(arg1, Atom.a("@>")))
3511 {
3512 foreach (bool l3 in YP.unify(arg2, 2))
3513 {
3514 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termGreaterThan")))
3515 {
3516 yield return true;
3517 yield break;
3518 }
3519 }
3520 }
3521 }
3522 {
3523 foreach (bool l2 in YP.unify(arg1, Atom.a("@>=")))
3524 {
3525 foreach (bool l3 in YP.unify(arg2, 2))
3526 {
3527 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termGreaterThanOrEqual")))
3528 {
3529 yield return true;
3530 yield break;
3531 }
3532 }
3533 }
3534 }
3535 {
3536 foreach (bool l2 in YP.unify(arg1, Atom.a("throw")))
3537 {
3538 foreach (bool l3 in YP.unify(arg2, 1))
3539 {
3540 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.throwException")))
3541 {
3542 yield return true;
3543 yield break;
3544 }
3545 }
3546 }
3547 }
3548 {
3549 foreach (bool l2 in YP.unify(arg1, Atom.a("current_prolog_flag")))
3550 {
3551 foreach (bool l3 in YP.unify(arg2, 2))
3552 {
3553 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_prolog_flag")))
3554 {
3555 yield return true;
3556 yield break;
3557 }
3558 }
3559 }
3560 }
3561 {
3562 foreach (bool l2 in YP.unify(arg1, Atom.a("set_prolog_flag")))
3563 {
3564 foreach (bool l3 in YP.unify(arg2, 2))
3565 {
3566 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.set_prolog_flag")))
3567 {
3568 yield return true;
3569 yield break;
3570 }
3571 }
3572 }
3573 }
3574 {
3575 foreach (bool l2 in YP.unify(arg1, Atom.a("current_input")))
3576 {
3577 foreach (bool l3 in YP.unify(arg2, 1))
3578 {
3579 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_input")))
3580 {
3581 yield return true;
3582 yield break;
3583 }
3584 }
3585 }
3586 }
3587 {
3588 foreach (bool l2 in YP.unify(arg1, Atom.a("current_output")))
3589 {
3590 foreach (bool l3 in YP.unify(arg2, 1))
3591 {
3592 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_output")))
3593 {
3594 yield return true;
3595 yield break;
3596 }
3597 }
3598 }
3599 }
3600 {
3601 foreach (bool l2 in YP.unify(arg1, Atom.a("read_term")))
3602 {
3603 foreach (bool l3 in YP.unify(arg2, 2))
3604 {
3605 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read_term2")))
3606 {
3607 yield return true;
3608 yield break;
3609 }
3610 }
3611 }
3612 }
3613 {
3614 foreach (bool l2 in YP.unify(arg1, Atom.a("read_term")))
3615 {
3616 foreach (bool l3 in YP.unify(arg2, 3))
3617 {
3618 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read_term3")))
3619 {
3620 yield return true;
3621 yield break;
3622 }
3623 }
3624 }
3625 }
3626 {
3627 foreach (bool l2 in YP.unify(arg1, Atom.a("read")))
3628 {
3629 foreach (bool l3 in YP.unify(arg2, 1))
3630 {
3631 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read1")))
3632 {
3633 yield return true;
3634 yield break;
3635 }
3636 }
3637 }
3638 }
3639 {
3640 foreach (bool l2 in YP.unify(arg1, Atom.a("read")))
3641 {
3642 foreach (bool l3 in YP.unify(arg2, 2))
3643 {
3644 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read2")))
3645 {
3646 yield return true;
3647 yield break;
3648 }
3649 }
3650 }
3651 }
3652 }
3653  
3654 public static IEnumerable<bool> compileTerm(object arg1, object arg2, object arg3)
3655 {
3656 {
3657 object Term = arg1;
3658 object State = arg2;
3659 Variable VariableName = new Variable();
3660 foreach (bool l2 in YP.unify(arg3, new Functor1("var", VariableName)))
3661 {
3662 if (YP.var(Term))
3663 {
3664 foreach (bool l4 in CompilerState.getVariableName(State, Term, VariableName))
3665 {
3666 yield return true;
3667 yield break;
3668 }
3669 }
3670 }
3671 }
3672 {
3673 object _State = arg2;
3674 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
3675 {
3676 foreach (bool l3 in YP.unify(arg3, new Functor1("var", Atom.a("Atom.NIL"))))
3677 {
3678 yield return true;
3679 yield break;
3680 }
3681 }
3682 }
3683 {
3684 object Term = arg1;
3685 object State = arg2;
3686 object Code = arg3;
3687 Variable ModuleCode = new Variable();
3688 if (YP.atom(Term))
3689 {
3690 foreach (bool l3 in compileAtomModule(Term, 0, State, ModuleCode))
3691 {
3692 foreach (bool l4 in YP.unify(Code, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Term), new ListPair(ModuleCode, Atom.NIL)))))
3693 {
3694 yield return true;
3695 yield break;
3696 }
3697 goto cutIf1;
3698 }
3699 foreach (bool l3 in YP.unify(Code, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Term), Atom.NIL))))
3700 {
3701 yield return true;
3702 yield break;
3703 }
3704 cutIf1:
3705 { }
3706 }
3707 }
3708 {
3709 object State = arg2;
3710 Variable First = new Variable();
3711 Variable Rest = new Variable();
3712 Variable CompiledList = new Variable();
3713 Variable x5 = new Variable();
3714 Variable Rest2 = new Variable();
3715 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
3716 {
3717 foreach (bool l3 in YP.unify(arg3, new Functor2("call", Atom.a("ListPair.make"), new ListPair(new Functor1("objectArray", CompiledList), Atom.NIL))))
3718 {
3719 if (YP.nonvar(Rest))
3720 {
3721 foreach (bool l5 in YP.unify(Rest, new ListPair(x5, Rest2)))
3722 {
3723 if (YP.termNotEqual(Rest2, Atom.NIL))
3724 {
3725 foreach (bool l7 in maplist_compileTerm(new ListPair(First, Rest), State, CompiledList))
3726 {
3727 yield return true;
3728 yield break;
3729 }
3730 }
3731 }
3732 }
3733 }
3734 }
3735 }
3736 {
3737 object State = arg2;
3738 Variable First = new Variable();
3739 Variable Rest = new Variable();
3740 Variable Arg1 = new Variable();
3741 Variable Arg2 = new Variable();
3742 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
3743 {
3744 foreach (bool l3 in YP.unify(arg3, new Functor2("new", Atom.a("ListPair"), new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))
3745 {
3746 foreach (bool l4 in compileTerm(First, State, Arg1))
3747 {
3748 foreach (bool l5 in compileTerm(Rest, State, Arg2))
3749 {
3750 yield return true;
3751 yield break;
3752 }
3753 }
3754 }
3755 }
3756 }
3757 {
3758 object Term = arg1;
3759 object State = arg2;
3760 object Result = arg3;
3761 Variable Name = new Variable();
3762 Variable TermArgs = new Variable();
3763 Variable x6 = new Variable();
3764 Variable Arity = new Variable();
3765 Variable ModuleCode = new Variable();
3766 Variable NameCode = new Variable();
3767 Variable X1 = new Variable();
3768 Variable Arg1 = new Variable();
3769 Variable X2 = new Variable();
3770 Variable Arg2 = new Variable();
3771 Variable X3 = new Variable();
3772 Variable Arg3 = new Variable();
3773 Variable Args = new Variable();
3774 foreach (bool l2 in YP.univ(Term, new ListPair(Name, TermArgs)))
3775 {
3776 if (YP.termEqual(TermArgs, Atom.NIL))
3777 {
3778 foreach (bool l4 in YP.unify(Result, new Functor1("object", Name)))
3779 {
3780 yield return true;
3781 yield break;
3782 }
3783 goto cutIf2;
3784 }
3785 foreach (bool l3 in YP.functor(Term, x6, Arity))
3786 {
3787 foreach (bool l4 in compileAtomModule(Name, Arity, State, ModuleCode))
3788 {
3789 foreach (bool l5 in YP.unify(NameCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Name), new ListPair(ModuleCode, Atom.NIL)))))
3790 {
3791 foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL)))
3792 {
3793 foreach (bool l7 in compileTerm(X1, State, Arg1))
3794 {
3795 foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL)))))
3796 {
3797 yield return true;
3798 yield break;
3799 }
3800 }
3801 goto cutIf4;
3802 }
3803 foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL))))
3804 {
3805 foreach (bool l7 in compileTerm(X1, State, Arg1))
3806 {
3807 foreach (bool l8 in compileTerm(X2, State, Arg2))
3808 {
3809 foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), ListPair.make(new object[] { NameCode, Arg1, Arg2 }))))
3810 {
3811 yield return true;
3812 yield break;
3813 }
3814 }
3815 }
3816 goto cutIf5;
3817 }
3818 foreach (bool l6 in YP.unify(TermArgs, ListPair.make(new object[] { X1, X2, X3 })))
3819 {
3820 foreach (bool l7 in compileTerm(X1, State, Arg1))
3821 {
3822 foreach (bool l8 in compileTerm(X2, State, Arg2))
3823 {
3824 foreach (bool l9 in compileTerm(X3, State, Arg3))
3825 {
3826 foreach (bool l10 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), ListPair.make(new object[] { NameCode, Arg1, Arg2, Arg3 }))))
3827 {
3828 yield return true;
3829 yield break;
3830 }
3831 }
3832 }
3833 }
3834 }
3835 foreach (bool l6 in maplist_compileTerm(TermArgs, State, Args))
3836 {
3837 foreach (bool l7 in YP.unify(Result, new Functor2("new", Atom.a("Functor"), new ListPair(NameCode, new ListPair(new Functor1("objectArray", Args), Atom.NIL)))))
3838 {
3839 yield return true;
3840 yield break;
3841 }
3842 }
3843 cutIf5:
3844 cutIf4:
3845 { }
3846 }
3847 goto cutIf3;
3848 }
3849 foreach (bool l4 in YP.unify(NameCode, new Functor1("object", Name)))
3850 {
3851 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL)))
3852 {
3853 foreach (bool l6 in compileTerm(X1, State, Arg1))
3854 {
3855 foreach (bool l7 in YP.unify(Result, new Functor2("new", Atom.a("Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL)))))
3856 {
3857 yield return true;
3858 yield break;
3859 }
3860 }
3861 goto cutIf6;
3862 }
3863 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL))))
3864 {
3865 foreach (bool l6 in compileTerm(X1, State, Arg1))
3866 {
3867 foreach (bool l7 in compileTerm(X2, State, Arg2))
3868 {
3869 foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), ListPair.make(new object[] { NameCode, Arg1, Arg2 }))))
3870 {
3871 yield return true;
3872 yield break;
3873 }
3874 }
3875 }
3876 goto cutIf7;
3877 }
3878 foreach (bool l5 in YP.unify(TermArgs, ListPair.make(new object[] { X1, X2, X3 })))
3879 {
3880 foreach (bool l6 in compileTerm(X1, State, Arg1))
3881 {
3882 foreach (bool l7 in compileTerm(X2, State, Arg2))
3883 {
3884 foreach (bool l8 in compileTerm(X3, State, Arg3))
3885 {
3886 foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), ListPair.make(new object[] { NameCode, Arg1, Arg2, Arg3 }))))
3887 {
3888 yield return true;
3889 yield break;
3890 }
3891 }
3892 }
3893 }
3894 }
3895 foreach (bool l5 in maplist_compileTerm(TermArgs, State, Args))
3896 {
3897 foreach (bool l6 in YP.unify(Result, new Functor2("new", Atom.a("Functor"), new ListPair(NameCode, new ListPair(new Functor1("objectArray", Args), Atom.NIL)))))
3898 {
3899 yield return true;
3900 yield break;
3901 }
3902 }
3903 cutIf7:
3904 cutIf6:
3905 { }
3906 }
3907 cutIf3:
3908 { }
3909 }
3910 cutIf2:
3911 { }
3912 }
3913 }
3914 }
3915  
3916 public static IEnumerable<bool> compileAtomModule(object Name, object arg2, object arg3, object ModuleCode)
3917 {
3918 {
3919 object Arity = arg2;
3920 object State = arg3;
3921 if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a("")))
3922 {
3923 foreach (bool l3 in YP.unify(ModuleCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Atom.a("")), Atom.NIL))))
3924 {
3925 yield return true;
3926 yield break;
3927 }
3928 }
3929 }
3930 {
3931 object _Arity = arg2;
3932 object _State = arg3;
3933 Variable Module = new Variable();
3934 foreach (bool l2 in Atom.module(Name, Module))
3935 {
3936 if (YP.termNotEqual(Module, Atom.NIL))
3937 {
3938 foreach (bool l4 in YP.unify(ModuleCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Module), Atom.NIL))))
3939 {
3940 yield return true;
3941 yield break;
3942 }
3943 }
3944 }
3945 }
3946 }
3947  
3948 public static IEnumerable<bool> maplist_compileTerm(object arg1, object arg2, object arg3)
3949 {
3950 {
3951 object _State = arg2;
3952 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
3953 {
3954 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
3955 {
3956 yield return true;
3957 yield break;
3958 }
3959 }
3960 }
3961 {
3962 object State = arg2;
3963 Variable First = new Variable();
3964 Variable Rest = new Variable();
3965 Variable FirstResult = new Variable();
3966 Variable RestResults = new Variable();
3967 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
3968 {
3969 foreach (bool l3 in YP.unify(arg3, new ListPair(FirstResult, RestResults)))
3970 {
3971 if (YP.nonvar(Rest))
3972 {
3973 foreach (bool l5 in compileTerm(First, State, FirstResult))
3974 {
3975 foreach (bool l6 in maplist_compileTerm(Rest, State, RestResults))
3976 {
3977 yield return true;
3978 yield break;
3979 }
3980 }
3981 }
3982 }
3983 }
3984 }
3985 }
3986  
3987 public static IEnumerable<bool> compileExpression(object Term, object State, object Result)
3988 {
3989 {
3990 Variable Name = new Variable();
3991 Variable TermArgs = new Variable();
3992 Variable X1 = new Variable();
3993 Variable FunctionName = new Variable();
3994 Variable Arg1 = new Variable();
3995 Variable x9 = new Variable();
3996 Variable X2 = new Variable();
3997 Variable Arg2 = new Variable();
3998 Variable x12 = new Variable();
3999 Variable Arity = new Variable();
4000 if (YP.nonvar(Term))
4001 {
4002 foreach (bool l3 in YP.univ(Term, new ListPair(Name, TermArgs)))
4003 {
4004 if (YP.atom(Name))
4005 {
4006 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL)))
4007 {
4008 foreach (bool l6 in unaryFunction(Name, FunctionName))
4009 {
4010 foreach (bool l7 in compileExpression(X1, State, Arg1))
4011 {
4012 foreach (bool l8 in YP.unify(Result, new Functor2("call", FunctionName, new ListPair(Arg1, Atom.NIL))))
4013 {
4014 yield return true;
4015 yield break;
4016 }
4017 }
4018 goto cutIf1;
4019 }
4020 }
4021 foreach (bool l5 in YP.unify(Term, new ListPair(x9, Atom.NIL)))
4022 {
4023 foreach (bool l6 in compileTerm(Term, State, Result))
4024 {
4025 yield return true;
4026 yield break;
4027 }
4028 goto cutIf2;
4029 }
4030 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL))))
4031 {
4032 foreach (bool l6 in binaryFunction(Name, FunctionName))
4033 {
4034 foreach (bool l7 in compileExpression(X1, State, Arg1))
4035 {
4036 foreach (bool l8 in compileExpression(X2, State, Arg2))
4037 {
4038 foreach (bool l9 in YP.unify(Result, new Functor2("call", FunctionName, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))
4039 {
4040 yield return true;
4041 yield break;
4042 }
4043 }
4044 }
4045 goto cutIf3;
4046 }
4047 }
4048 foreach (bool l5 in YP.functor(Term, x12, Arity))
4049 {
4050 YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("evaluable"), new Functor2("/", Name, Arity)), Atom.a("Not an expression function")));
4051 yield return false;
4052 }
4053 cutIf3:
4054 cutIf2:
4055 cutIf1:
4056 { }
4057 }
4058 }
4059 }
4060 }
4061 {
4062 foreach (bool l2 in compileTerm(Term, State, Result))
4063 {
4064 yield return true;
4065 yield break;
4066 }
4067 }
4068 }
4069  
4070 public static IEnumerable<bool> unaryFunction(object arg1, object arg2)
4071 {
4072 {
4073 foreach (bool l2 in YP.unify(arg1, Atom.a("-")))
4074 {
4075 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.negate")))
4076 {
4077 yield return true;
4078 yield break;
4079 }
4080 }
4081 }
4082 {
4083 foreach (bool l2 in YP.unify(arg1, Atom.a("abs")))
4084 {
4085 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.abs")))
4086 {
4087 yield return true;
4088 yield break;
4089 }
4090 }
4091 }
4092 {
4093 foreach (bool l2 in YP.unify(arg1, Atom.a("sign")))
4094 {
4095 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sign")))
4096 {
4097 yield return true;
4098 yield break;
4099 }
4100 }
4101 }
4102 {
4103 foreach (bool l2 in YP.unify(arg1, Atom.a("float")))
4104 {
4105 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.toFloat")))
4106 {
4107 yield return true;
4108 yield break;
4109 }
4110 }
4111 }
4112 {
4113 foreach (bool l2 in YP.unify(arg1, Atom.a("floor")))
4114 {
4115 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.floor")))
4116 {
4117 yield return true;
4118 yield break;
4119 }
4120 }
4121 }
4122 {
4123 foreach (bool l2 in YP.unify(arg1, Atom.a("truncate")))
4124 {
4125 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.truncate")))
4126 {
4127 yield return true;
4128 yield break;
4129 }
4130 }
4131 }
4132 {
4133 foreach (bool l2 in YP.unify(arg1, Atom.a("round")))
4134 {
4135 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.round")))
4136 {
4137 yield return true;
4138 yield break;
4139 }
4140 }
4141 }
4142 {
4143 foreach (bool l2 in YP.unify(arg1, Atom.a("ceiling")))
4144 {
4145 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.ceiling")))
4146 {
4147 yield return true;
4148 yield break;
4149 }
4150 }
4151 }
4152 {
4153 foreach (bool l2 in YP.unify(arg1, Atom.a("sin")))
4154 {
4155 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sin")))
4156 {
4157 yield return true;
4158 yield break;
4159 }
4160 }
4161 }
4162 {
4163 foreach (bool l2 in YP.unify(arg1, Atom.a("cos")))
4164 {
4165 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.cos")))
4166 {
4167 yield return true;
4168 yield break;
4169 }
4170 }
4171 }
4172 {
4173 foreach (bool l2 in YP.unify(arg1, Atom.a("atan")))
4174 {
4175 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.atan")))
4176 {
4177 yield return true;
4178 yield break;
4179 }
4180 }
4181 }
4182 {
4183 foreach (bool l2 in YP.unify(arg1, Atom.a("exp")))
4184 {
4185 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.exp")))
4186 {
4187 yield return true;
4188 yield break;
4189 }
4190 }
4191 }
4192 {
4193 foreach (bool l2 in YP.unify(arg1, Atom.a("log")))
4194 {
4195 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.log")))
4196 {
4197 yield return true;
4198 yield break;
4199 }
4200 }
4201 }
4202 {
4203 foreach (bool l2 in YP.unify(arg1, Atom.a("sqrt")))
4204 {
4205 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sqrt")))
4206 {
4207 yield return true;
4208 yield break;
4209 }
4210 }
4211 }
4212 {
4213 foreach (bool l2 in YP.unify(arg1, Atom.a("\\")))
4214 {
4215 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseComplement")))
4216 {
4217 yield return true;
4218 yield break;
4219 }
4220 }
4221 }
4222 }
4223  
4224 public static IEnumerable<bool> binaryFunction(object arg1, object arg2)
4225 {
4226 {
4227 foreach (bool l2 in YP.unify(arg1, Atom.a("+")))
4228 {
4229 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.add")))
4230 {
4231 yield return true;
4232 yield break;
4233 }
4234 }
4235 }
4236 {
4237 foreach (bool l2 in YP.unify(arg1, Atom.a("-")))
4238 {
4239 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.subtract")))
4240 {
4241 yield return true;
4242 yield break;
4243 }
4244 }
4245 }
4246 {
4247 foreach (bool l2 in YP.unify(arg1, Atom.a("*")))
4248 {
4249 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.multiply")))
4250 {
4251 yield return true;
4252 yield break;
4253 }
4254 }
4255 }
4256 {
4257 foreach (bool l2 in YP.unify(arg1, Atom.a("/")))
4258 {
4259 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.divide")))
4260 {
4261 yield return true;
4262 yield break;
4263 }
4264 }
4265 }
4266 {
4267 foreach (bool l2 in YP.unify(arg1, Atom.a("//")))
4268 {
4269 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.intDivide")))
4270 {
4271 yield return true;
4272 yield break;
4273 }
4274 }
4275 }
4276 {
4277 foreach (bool l2 in YP.unify(arg1, Atom.a("mod")))
4278 {
4279 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.mod")))
4280 {
4281 yield return true;
4282 yield break;
4283 }
4284 }
4285 }
4286 {
4287 foreach (bool l2 in YP.unify(arg1, Atom.a("**")))
4288 {
4289 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.pow")))
4290 {
4291 yield return true;
4292 yield break;
4293 }
4294 }
4295 }
4296 {
4297 foreach (bool l2 in YP.unify(arg1, Atom.a(">>")))
4298 {
4299 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseShiftRight")))
4300 {
4301 yield return true;
4302 yield break;
4303 }
4304 }
4305 }
4306 {
4307 foreach (bool l2 in YP.unify(arg1, Atom.a("<<")))
4308 {
4309 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseShiftLeft")))
4310 {
4311 yield return true;
4312 yield break;
4313 }
4314 }
4315 }
4316 {
4317 foreach (bool l2 in YP.unify(arg1, Atom.a("/\\")))
4318 {
4319 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseAnd")))
4320 {
4321 yield return true;
4322 yield break;
4323 }
4324 }
4325 }
4326 {
4327 foreach (bool l2 in YP.unify(arg1, Atom.a("\\/")))
4328 {
4329 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseOr")))
4330 {
4331 yield return true;
4332 yield break;
4333 }
4334 }
4335 }
4336 {
4337 foreach (bool l2 in YP.unify(arg1, Atom.a("min")))
4338 {
4339 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.min")))
4340 {
4341 yield return true;
4342 yield break;
4343 }
4344 }
4345 }
4346 {
4347 foreach (bool l2 in YP.unify(arg1, Atom.a("max")))
4348 {
4349 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.max")))
4350 {
4351 yield return true;
4352 yield break;
4353 }
4354 }
4355 }
4356 }
4357  
4358 public static void convertFunctionCSharp(object arg1)
4359 {
4360 {
4361 foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass")))
4362 {
4363 YP.write(Atom.a("public class YPInnerClass {}"));
4364 YP.nl();
4365 YP.write(Atom.a("public static System.Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }"));
4366 YP.nl();
4367 YP.nl();
4368 return;
4369 }
4370 }
4371 {
4372 Variable ReturnType = new Variable();
4373 Variable Name = new Variable();
4374 Variable ArgList = new Variable();
4375 Variable Body = new Variable();
4376 Variable Level = new Variable();
4377 foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { ReturnType, Name, ArgList, Body })))
4378 {
4379 YP.write(Atom.a("public static "));
4380 YP.write(ReturnType);
4381 YP.write(Atom.a(" "));
4382 YP.write(Name);
4383 YP.write(Atom.a("("));
4384 convertArgListCSharp(ArgList);
4385 YP.write(Atom.a(") {"));
4386 YP.nl();
4387 foreach (bool l3 in YP.unify(Level, 1))
4388 {
4389 convertStatementListCSharp(Body, Level);
4390 YP.write(Atom.a("}"));
4391 YP.nl();
4392 YP.nl();
4393 return;
4394 }
4395 }
4396 }
4397 }
4398  
4399 public static IEnumerable<bool> convertStatementListCSharp(object arg1, object x1, object x2)
4400 {
4401 {
4402 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4403 {
4404 yield return true;
4405 yield break;
4406 }
4407 }
4408 }
4409  
4410 public static void convertStatementListCSharp(object arg1, object Level)
4411 {
4412 {
4413 Variable Name = new Variable();
4414 Variable Body = new Variable();
4415 Variable RestStatements = new Variable();
4416 Variable NewStatements = new Variable();
4417 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements)))
4418 {
4419 foreach (bool l3 in append(Body, new ListPair(new Functor1("label", Name), RestStatements), NewStatements))
4420 {
4421 convertStatementListCSharp(NewStatements, Level);
4422 return;
4423 }
4424 }
4425 }
4426 {
4427 Variable Type = new Variable();
4428 Variable Name = new Variable();
4429 Variable Expression = new Variable();
4430 Variable RestStatements = new Variable();
4431 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", Type, Name, Expression), RestStatements)))
4432 {
4433 convertIndentationCSharp(Level);
4434 YP.write(Type);
4435 YP.write(Atom.a(" "));
4436 YP.write(Name);
4437 YP.write(Atom.a(" = "));
4438 convertExpressionCSharp(Expression);
4439 YP.write(Atom.a(";"));
4440 YP.nl();
4441 convertStatementListCSharp(RestStatements, Level);
4442 return;
4443 }
4444 }
4445 {
4446 Variable Name = new Variable();
4447 Variable Expression = new Variable();
4448 Variable RestStatements = new Variable();
4449 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements)))
4450 {
4451 convertIndentationCSharp(Level);
4452 YP.write(Name);
4453 YP.write(Atom.a(" = "));
4454 convertExpressionCSharp(Expression);
4455 YP.write(Atom.a(";"));
4456 YP.nl();
4457 convertStatementListCSharp(RestStatements, Level);
4458 return;
4459 }
4460 }
4461 {
4462 Variable RestStatements = new Variable();
4463 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements)))
4464 {
4465 convertIndentationCSharp(Level);
4466 YP.write(Atom.a("yield return true;"));
4467 YP.nl();
4468 convertStatementListCSharp(RestStatements, Level);
4469 return;
4470 }
4471 }
4472 {
4473 Variable RestStatements = new Variable();
4474 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements)))
4475 {
4476 convertIndentationCSharp(Level);
4477 YP.write(Atom.a("yield return false;"));
4478 YP.nl();
4479 convertStatementListCSharp(RestStatements, Level);
4480 return;
4481 }
4482 }
4483 {
4484 Variable RestStatements = new Variable();
4485 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements)))
4486 {
4487 convertIndentationCSharp(Level);
4488 YP.write(Atom.a("yield break;"));
4489 YP.nl();
4490 convertStatementListCSharp(RestStatements, Level);
4491 return;
4492 }
4493 }
4494 {
4495 Variable RestStatements = new Variable();
4496 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements)))
4497 {
4498 convertIndentationCSharp(Level);
4499 YP.write(Atom.a("return;"));
4500 YP.nl();
4501 convertStatementListCSharp(RestStatements, Level);
4502 return;
4503 }
4504 }
4505 {
4506 Variable RestStatements = new Variable();
4507 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements)))
4508 {
4509 convertIndentationCSharp(Level);
4510 YP.write(Atom.a("return true;"));
4511 YP.nl();
4512 convertStatementListCSharp(RestStatements, Level);
4513 return;
4514 }
4515 }
4516 {
4517 Variable RestStatements = new Variable();
4518 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements)))
4519 {
4520 convertIndentationCSharp(Level);
4521 YP.write(Atom.a("return false;"));
4522 YP.nl();
4523 convertStatementListCSharp(RestStatements, Level);
4524 return;
4525 }
4526 }
4527 {
4528 Variable Name = new Variable();
4529 Variable RestStatements = new Variable();
4530 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("label", Name), RestStatements)))
4531 {
4532 convertIndentationCSharp(Level);
4533 YP.write(Name);
4534 YP.write(Atom.a(":"));
4535 YP.nl();
4536 if (YP.termEqual(RestStatements, Atom.NIL))
4537 {
4538 convertIndentationCSharp(Level);
4539 YP.write(Atom.a("{}"));
4540 YP.nl();
4541 convertStatementListCSharp(RestStatements, Level);
4542 return;
4543 goto cutIf1;
4544 }
4545 convertStatementListCSharp(RestStatements, Level);
4546 return;
4547 cutIf1:
4548 { }
4549 }
4550 }
4551 {
4552 Variable Name = new Variable();
4553 Variable RestStatements = new Variable();
4554 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements)))
4555 {
4556 convertIndentationCSharp(Level);
4557 YP.write(Atom.a("goto "));
4558 YP.write(Name);
4559 YP.write(Atom.a(";"));
4560 YP.nl();
4561 convertStatementListCSharp(RestStatements, Level);
4562 return;
4563 }
4564 }
4565 {
4566 Variable Name = new Variable();
4567 Variable ArgList = new Variable();
4568 Variable RestStatements = new Variable();
4569 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements)))
4570 {
4571 convertIndentationCSharp(Level);
4572 YP.write(Name);
4573 YP.write(Atom.a("("));
4574 convertArgListCSharp(ArgList);
4575 YP.write(Atom.a(");"));
4576 YP.nl();
4577 convertStatementListCSharp(RestStatements, Level);
4578 return;
4579 }
4580 }
4581 {
4582 Variable Name = new Variable();
4583 Variable _FunctorArgs = new Variable();
4584 Variable ArgList = new Variable();
4585 Variable RestStatements = new Variable();
4586 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements)))
4587 {
4588 convertStatementListCSharp(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level);
4589 return;
4590 }
4591 }
4592 {
4593 Variable Obj = new Variable();
4594 Variable Name = new Variable();
4595 Variable ArgList = new Variable();
4596 Variable RestStatements = new Variable();
4597 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements)))
4598 {
4599 convertIndentationCSharp(Level);
4600 YP.write(Obj);
4601 YP.write(Atom.a("."));
4602 YP.write(Name);
4603 YP.write(Atom.a("("));
4604 convertArgListCSharp(ArgList);
4605 YP.write(Atom.a(");"));
4606 YP.nl();
4607 convertStatementListCSharp(RestStatements, Level);
4608 return;
4609 }
4610 }
4611 {
4612 Variable Body = new Variable();
4613 Variable RestStatements = new Variable();
4614 Variable NextLevel = new Variable();
4615 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements)))
4616 {
4617 convertIndentationCSharp(Level);
4618 YP.write(Atom.a("{"));
4619 YP.nl();
4620 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4621 {
4622 convertStatementListCSharp(Body, NextLevel);
4623 convertIndentationCSharp(Level);
4624 YP.write(Atom.a("}"));
4625 YP.nl();
4626 convertStatementListCSharp(RestStatements, Level);
4627 return;
4628 }
4629 }
4630 }
4631 {
4632 Variable Expression = new Variable();
4633 Variable Body = new Variable();
4634 Variable RestStatements = new Variable();
4635 Variable NextLevel = new Variable();
4636 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements)))
4637 {
4638 convertIndentationCSharp(Level);
4639 YP.write(Atom.a("if ("));
4640 convertExpressionCSharp(Expression);
4641 YP.write(Atom.a(") {"));
4642 YP.nl();
4643 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4644 {
4645 convertStatementListCSharp(Body, NextLevel);
4646 convertIndentationCSharp(Level);
4647 YP.write(Atom.a("}"));
4648 YP.nl();
4649 convertStatementListCSharp(RestStatements, Level);
4650 return;
4651 }
4652 }
4653 }
4654 {
4655 Variable Expression = new Variable();
4656 Variable Body = new Variable();
4657 Variable RestStatements = new Variable();
4658 Variable NextLevel = new Variable();
4659 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements)))
4660 {
4661 convertIndentationCSharp(Level);
4662 YP.write(Atom.a("foreach (bool l"));
4663 YP.write(Level);
4664 YP.write(Atom.a(" in "));
4665 convertExpressionCSharp(Expression);
4666 YP.write(Atom.a(") {"));
4667 YP.nl();
4668 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4669 {
4670 convertStatementListCSharp(Body, NextLevel);
4671 convertIndentationCSharp(Level);
4672 YP.write(Atom.a("}"));
4673 YP.nl();
4674 convertStatementListCSharp(RestStatements, Level);
4675 return;
4676 }
4677 }
4678 }
4679 {
4680 Variable Expression = new Variable();
4681 Variable RestStatements = new Variable();
4682 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements)))
4683 {
4684 convertIndentationCSharp(Level);
4685 YP.write(Atom.a("throw "));
4686 convertExpressionCSharp(Expression);
4687 YP.write(Atom.a(";"));
4688 YP.nl();
4689 convertStatementListCSharp(RestStatements, Level);
4690 return;
4691 }
4692 }
4693 }
4694  
4695 public static void convertIndentationCSharp(object Level)
4696 {
4697 {
4698 Variable N = new Variable();
4699 foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2)))
4700 {
4701 repeatWrite(Atom.a(" "), N);
4702 return;
4703 }
4704 }
4705 }
4706  
4707 public static void convertArgListCSharp(object arg1)
4708 {
4709 {
4710 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4711 {
4712 return;
4713 }
4714 }
4715 {
4716 Variable Head = new Variable();
4717 Variable Tail = new Variable();
4718 foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail)))
4719 {
4720 convertExpressionCSharp(Head);
4721 if (YP.termNotEqual(Tail, Atom.NIL))
4722 {
4723 YP.write(Atom.a(", "));
4724 convertArgListCSharp(Tail);
4725 return;
4726 goto cutIf1;
4727 }
4728 convertArgListCSharp(Tail);
4729 return;
4730 cutIf1:
4731 { }
4732 }
4733 }
4734 }
4735  
4736 public static void convertExpressionCSharp(object arg1)
4737 {
4738 {
4739 Variable X = new Variable();
4740 foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X)))
4741 {
4742 YP.write(Atom.a("object "));
4743 YP.write(X);
4744 return;
4745 }
4746 }
4747 {
4748 Variable Name = new Variable();
4749 Variable ArgList = new Variable();
4750 foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList)))
4751 {
4752 YP.write(Name);
4753 YP.write(Atom.a("("));
4754 convertArgListCSharp(ArgList);
4755 YP.write(Atom.a(")"));
4756 return;
4757 }
4758 }
4759 {
4760 Variable Name = new Variable();
4761 Variable _FunctorArgs = new Variable();
4762 Variable ArgList = new Variable();
4763 foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList)))
4764 {
4765 convertExpressionCSharp(new Functor2("call", Name, ArgList));
4766 return;
4767 }
4768 }
4769 {
4770 Variable Obj = new Variable();
4771 Variable Name = new Variable();
4772 Variable ArgList = new Variable();
4773 foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList)))
4774 {
4775 YP.write(Obj);
4776 YP.write(Atom.a("."));
4777 YP.write(Name);
4778 YP.write(Atom.a("("));
4779 convertArgListCSharp(ArgList);
4780 YP.write(Atom.a(")"));
4781 return;
4782 }
4783 }
4784 {
4785 Variable Name = new Variable();
4786 Variable ArgList = new Variable();
4787 foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList)))
4788 {
4789 YP.write(Atom.a("new "));
4790 YP.write(Name);
4791 YP.write(Atom.a("("));
4792 convertArgListCSharp(ArgList);
4793 YP.write(Atom.a(")"));
4794 return;
4795 }
4796 }
4797 {
4798 Variable Name = new Variable();
4799 foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name)))
4800 {
4801 YP.write(Name);
4802 return;
4803 }
4804 }
4805 {
4806 foreach (bool l2 in YP.unify(arg1, Atom.a("null")))
4807 {
4808 YP.write(Atom.a("null"));
4809 return;
4810 }
4811 }
4812 {
4813 Variable X = new Variable();
4814 foreach (bool l2 in YP.unify(arg1, new Functor1("not", X)))
4815 {
4816 YP.write(Atom.a("!("));
4817 convertExpressionCSharp(X);
4818 YP.write(Atom.a(")"));
4819 return;
4820 }
4821 }
4822 {
4823 Variable X = new Variable();
4824 Variable Y = new Variable();
4825 foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y)))
4826 {
4827 YP.write(Atom.a("("));
4828 convertExpressionCSharp(X);
4829 YP.write(Atom.a(") && ("));
4830 convertExpressionCSharp(Y);
4831 YP.write(Atom.a(")"));
4832 return;
4833 }
4834 }
4835 {
4836 Variable ArgList = new Variable();
4837 foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList)))
4838 {
4839 YP.write(Atom.a("new object[] {"));
4840 convertArgListCSharp(ArgList);
4841 YP.write(Atom.a("}"));
4842 return;
4843 }
4844 }
4845 {
4846 Variable X = new Variable();
4847 Variable Codes = new Variable();
4848 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
4849 {
4850 if (YP.atom(X))
4851 {
4852 YP.write(Atom.a("\""));
4853 foreach (bool l4 in YP.atom_codes(X, Codes))
4854 {
4855 convertStringCodesCSharp(Codes);
4856 YP.write(Atom.a("\""));
4857 return;
4858 }
4859 }
4860 }
4861 }
4862 {
4863 Variable X = new Variable();
4864 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
4865 {
4866 YP.write(X);
4867 return;
4868 }
4869 }
4870 }
4871  
4872 public static void convertStringCodesCSharp(object arg1)
4873 {
4874 {
4875 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4876 {
4877 return;
4878 }
4879 }
4880 {
4881 Variable Code = new Variable();
4882 Variable RestCodes = new Variable();
4883 foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes)))
4884 {
4885 foreach (bool l3 in putCStringCode(Code))
4886 {
4887 convertStringCodesCSharp(RestCodes);
4888 return;
4889 }
4890 }
4891 }
4892 }
4893  
4894 public static void convertFunctionJavascript(object arg1)
4895 {
4896 {
4897 foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass")))
4898 {
4899 YP.write(Atom.a("function getDeclaringClass() { return null; }"));
4900 YP.nl();
4901 YP.nl();
4902 return;
4903 }
4904 }
4905 {
4906 Variable x1 = new Variable();
4907 Variable Name = new Variable();
4908 Variable ArgList = new Variable();
4909 Variable Body = new Variable();
4910 foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body })))
4911 {
4912 YP.write(Atom.a("function "));
4913 YP.write(Name);
4914 YP.write(Atom.a("("));
4915 convertArgListJavascript(ArgList);
4916 YP.write(Atom.a(") {"));
4917 YP.nl();
4918 convertStatementListJavascript(Body, 1);
4919 YP.write(Atom.a("}"));
4920 YP.nl();
4921 YP.nl();
4922 return;
4923 }
4924 }
4925 }
4926  
4927 public static void convertStatementListJavascript(object arg1, object arg2)
4928 {
4929 {
4930 object x1 = arg2;
4931 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4932 {
4933 return;
4934 }
4935 }
4936 {
4937 object Level = arg2;
4938 Variable Name = new Variable();
4939 Variable Body = new Variable();
4940 Variable RestStatements = new Variable();
4941 Variable NextLevel = new Variable();
4942 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements)))
4943 {
4944 convertIndentationJavascript(Level);
4945 YP.write(Name);
4946 YP.write(Atom.a(":"));
4947 YP.nl();
4948 convertIndentationJavascript(Level);
4949 YP.write(Atom.a("{"));
4950 YP.nl();
4951 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4952 {
4953 convertStatementListJavascript(Body, NextLevel);
4954 convertIndentationJavascript(Level);
4955 YP.write(Atom.a("}"));
4956 YP.nl();
4957 convertStatementListJavascript(RestStatements, Level);
4958 return;
4959 }
4960 }
4961 }
4962 {
4963 object Level = arg2;
4964 Variable _Type = new Variable();
4965 Variable Name = new Variable();
4966 Variable Expression = new Variable();
4967 Variable RestStatements = new Variable();
4968 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements)))
4969 {
4970 convertIndentationJavascript(Level);
4971 YP.write(Atom.a("var "));
4972 YP.write(Name);
4973 YP.write(Atom.a(" = "));
4974 convertExpressionJavascript(Expression);
4975 YP.write(Atom.a(";"));
4976 YP.nl();
4977 convertStatementListJavascript(RestStatements, Level);
4978 return;
4979 }
4980 }
4981 {
4982 object Level = arg2;
4983 Variable Name = new Variable();
4984 Variable Expression = new Variable();
4985 Variable RestStatements = new Variable();
4986 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements)))
4987 {
4988 convertIndentationJavascript(Level);
4989 YP.write(Name);
4990 YP.write(Atom.a(" = "));
4991 convertExpressionJavascript(Expression);
4992 YP.write(Atom.a(";"));
4993 YP.nl();
4994 convertStatementListJavascript(RestStatements, Level);
4995 return;
4996 }
4997 }
4998 {
4999 object Level = arg2;
5000 Variable RestStatements = new Variable();
5001 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements)))
5002 {
5003 convertIndentationJavascript(Level);
5004 YP.write(Atom.a("yield true;"));
5005 YP.nl();
5006 convertStatementListJavascript(RestStatements, Level);
5007 return;
5008 }
5009 }
5010 {
5011 object Level = arg2;
5012 Variable RestStatements = new Variable();
5013 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements)))
5014 {
5015 convertIndentationJavascript(Level);
5016 YP.write(Atom.a("yield false;"));
5017 YP.nl();
5018 convertStatementListJavascript(RestStatements, Level);
5019 return;
5020 }
5021 }
5022 {
5023 object Level = arg2;
5024 Variable RestStatements = new Variable();
5025 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements)))
5026 {
5027 convertIndentationJavascript(Level);
5028 YP.write(Atom.a("return;"));
5029 YP.nl();
5030 convertStatementListJavascript(RestStatements, Level);
5031 return;
5032 }
5033 }
5034 {
5035 object Level = arg2;
5036 Variable RestStatements = new Variable();
5037 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements)))
5038 {
5039 convertIndentationJavascript(Level);
5040 YP.write(Atom.a("return;"));
5041 YP.nl();
5042 convertStatementListJavascript(RestStatements, Level);
5043 return;
5044 }
5045 }
5046 {
5047 object Level = arg2;
5048 Variable RestStatements = new Variable();
5049 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements)))
5050 {
5051 convertIndentationJavascript(Level);
5052 YP.write(Atom.a("return true;"));
5053 YP.nl();
5054 convertStatementListJavascript(RestStatements, Level);
5055 return;
5056 }
5057 }
5058 {
5059 object Level = arg2;
5060 Variable RestStatements = new Variable();
5061 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements)))
5062 {
5063 convertIndentationJavascript(Level);
5064 YP.write(Atom.a("return false;"));
5065 YP.nl();
5066 convertStatementListJavascript(RestStatements, Level);
5067 return;
5068 }
5069 }
5070 {
5071 object Level = arg2;
5072 Variable Name = new Variable();
5073 Variable RestStatements = new Variable();
5074 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements)))
5075 {
5076 convertIndentationJavascript(Level);
5077 YP.write(Atom.a("break "));
5078 YP.write(Name);
5079 YP.write(Atom.a(";"));
5080 YP.nl();
5081 convertStatementListJavascript(RestStatements, Level);
5082 return;
5083 }
5084 }
5085 {
5086 object Level = arg2;
5087 Variable Name = new Variable();
5088 Variable ArgList = new Variable();
5089 Variable RestStatements = new Variable();
5090 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements)))
5091 {
5092 convertIndentationJavascript(Level);
5093 YP.write(Name);
5094 YP.write(Atom.a("("));
5095 convertArgListJavascript(ArgList);
5096 YP.write(Atom.a(");"));
5097 YP.nl();
5098 convertStatementListJavascript(RestStatements, Level);
5099 return;
5100 }
5101 }
5102 {
5103 object Level = arg2;
5104 Variable Name = new Variable();
5105 Variable _FunctorArgs = new Variable();
5106 Variable ArgList = new Variable();
5107 Variable RestStatements = new Variable();
5108 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements)))
5109 {
5110 convertStatementListJavascript(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level);
5111 return;
5112 }
5113 }
5114 {
5115 object Level = arg2;
5116 Variable Obj = new Variable();
5117 Variable Name = new Variable();
5118 Variable ArgList = new Variable();
5119 Variable RestStatements = new Variable();
5120 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements)))
5121 {
5122 convertIndentationJavascript(Level);
5123 YP.write(Obj);
5124 YP.write(Atom.a("."));
5125 YP.write(Name);
5126 YP.write(Atom.a("("));
5127 convertArgListJavascript(ArgList);
5128 YP.write(Atom.a(");"));
5129 YP.nl();
5130 convertStatementListJavascript(RestStatements, Level);
5131 return;
5132 }
5133 }
5134 {
5135 object Level = arg2;
5136 Variable Body = new Variable();
5137 Variable RestStatements = new Variable();
5138 Variable NextLevel = new Variable();
5139 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements)))
5140 {
5141 convertIndentationJavascript(Level);
5142 YP.write(Atom.a("{"));
5143 YP.nl();
5144 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5145 {
5146 convertStatementListJavascript(Body, NextLevel);
5147 convertIndentationJavascript(Level);
5148 YP.write(Atom.a("}"));
5149 YP.nl();
5150 convertStatementListJavascript(RestStatements, Level);
5151 return;
5152 }
5153 }
5154 }
5155 {
5156 object Level = arg2;
5157 Variable Expression = new Variable();
5158 Variable Body = new Variable();
5159 Variable RestStatements = new Variable();
5160 Variable NextLevel = new Variable();
5161 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements)))
5162 {
5163 convertIndentationJavascript(Level);
5164 YP.write(Atom.a("if ("));
5165 convertExpressionJavascript(Expression);
5166 YP.write(Atom.a(") {"));
5167 YP.nl();
5168 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5169 {
5170 convertStatementListJavascript(Body, NextLevel);
5171 convertIndentationJavascript(Level);
5172 YP.write(Atom.a("}"));
5173 YP.nl();
5174 convertStatementListJavascript(RestStatements, Level);
5175 return;
5176 }
5177 }
5178 }
5179 {
5180 object Level = arg2;
5181 Variable Expression = new Variable();
5182 Variable Body = new Variable();
5183 Variable RestStatements = new Variable();
5184 Variable NextLevel = new Variable();
5185 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements)))
5186 {
5187 convertIndentationJavascript(Level);
5188 YP.write(Atom.a("for each (var l"));
5189 YP.write(Level);
5190 YP.write(Atom.a(" in "));
5191 convertExpressionJavascript(Expression);
5192 YP.write(Atom.a(") {"));
5193 YP.nl();
5194 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5195 {
5196 convertStatementListJavascript(Body, NextLevel);
5197 convertIndentationJavascript(Level);
5198 YP.write(Atom.a("}"));
5199 YP.nl();
5200 convertStatementListJavascript(RestStatements, Level);
5201 return;
5202 }
5203 }
5204 }
5205 {
5206 object Level = arg2;
5207 Variable Expression = new Variable();
5208 Variable RestStatements = new Variable();
5209 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements)))
5210 {
5211 convertIndentationJavascript(Level);
5212 YP.write(Atom.a("throw "));
5213 convertExpressionJavascript(Expression);
5214 YP.write(Atom.a(";"));
5215 YP.nl();
5216 convertStatementListJavascript(RestStatements, Level);
5217 return;
5218 }
5219 }
5220 }
5221  
5222 public static void convertIndentationJavascript(object Level)
5223 {
5224 {
5225 Variable N = new Variable();
5226 foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2)))
5227 {
5228 repeatWrite(Atom.a(" "), N);
5229 return;
5230 }
5231 }
5232 }
5233  
5234 public static void convertArgListJavascript(object arg1)
5235 {
5236 {
5237 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
5238 {
5239 return;
5240 }
5241 }
5242 {
5243 Variable Head = new Variable();
5244 Variable Tail = new Variable();
5245 foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail)))
5246 {
5247 convertExpressionJavascript(Head);
5248 if (YP.termNotEqual(Tail, Atom.NIL))
5249 {
5250 YP.write(Atom.a(", "));
5251 convertArgListJavascript(Tail);
5252 return;
5253 goto cutIf1;
5254 }
5255 convertArgListJavascript(Tail);
5256 return;
5257 cutIf1:
5258 { }
5259 }
5260 }
5261 }
5262  
5263 public static void convertExpressionJavascript(object arg1)
5264 {
5265 {
5266 Variable X = new Variable();
5267 foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X)))
5268 {
5269 YP.write(X);
5270 return;
5271 }
5272 }
5273 {
5274 Variable Name = new Variable();
5275 Variable ArgList = new Variable();
5276 foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList)))
5277 {
5278 YP.write(Name);
5279 YP.write(Atom.a("("));
5280 convertArgListJavascript(ArgList);
5281 YP.write(Atom.a(")"));
5282 return;
5283 }
5284 }
5285 {
5286 Variable Name = new Variable();
5287 Variable _FunctorArgs = new Variable();
5288 Variable ArgList = new Variable();
5289 foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList)))
5290 {
5291 convertExpressionJavascript(new Functor2("call", Name, ArgList));
5292 return;
5293 }
5294 }
5295 {
5296 Variable Obj = new Variable();
5297 Variable Name = new Variable();
5298 Variable ArgList = new Variable();
5299 foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList)))
5300 {
5301 YP.write(Obj);
5302 YP.write(Atom.a("."));
5303 YP.write(Name);
5304 YP.write(Atom.a("("));
5305 convertArgListJavascript(ArgList);
5306 YP.write(Atom.a(")"));
5307 return;
5308 }
5309 }
5310 {
5311 Variable Name = new Variable();
5312 Variable ArgList = new Variable();
5313 foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList)))
5314 {
5315 YP.write(Atom.a("new "));
5316 YP.write(Name);
5317 YP.write(Atom.a("("));
5318 convertArgListJavascript(ArgList);
5319 YP.write(Atom.a(")"));
5320 return;
5321 }
5322 }
5323 {
5324 Variable Name = new Variable();
5325 foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name)))
5326 {
5327 YP.write(Name);
5328 return;
5329 }
5330 }
5331 {
5332 foreach (bool l2 in YP.unify(arg1, Atom.a("null")))
5333 {
5334 YP.write(Atom.a("null"));
5335 return;
5336 }
5337 }
5338 {
5339 Variable X = new Variable();
5340 foreach (bool l2 in YP.unify(arg1, new Functor1("not", X)))
5341 {
5342 YP.write(Atom.a("!("));
5343 convertExpressionJavascript(X);
5344 YP.write(Atom.a(")"));
5345 return;
5346 }
5347 }
5348 {
5349 Variable X = new Variable();
5350 Variable Y = new Variable();
5351 foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y)))
5352 {
5353 YP.write(Atom.a("("));
5354 convertExpressionJavascript(X);
5355 YP.write(Atom.a(") && ("));
5356 convertExpressionJavascript(Y);
5357 YP.write(Atom.a(")"));
5358 return;
5359 }
5360 }
5361 {
5362 Variable ArgList = new Variable();
5363 foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList)))
5364 {
5365 YP.write(Atom.a("["));
5366 convertArgListJavascript(ArgList);
5367 YP.write(Atom.a("]"));
5368 return;
5369 }
5370 }
5371 {
5372 Variable X = new Variable();
5373 Variable Codes = new Variable();
5374 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
5375 {
5376 if (YP.atom(X))
5377 {
5378 YP.write(Atom.a("\""));
5379 foreach (bool l4 in YP.atom_codes(X, Codes))
5380 {
5381 convertStringCodesJavascript(Codes);
5382 YP.write(Atom.a("\""));
5383 return;
5384 }
5385 }
5386 }
5387 }
5388 {
5389 Variable X = new Variable();
5390 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
5391 {
5392 YP.write(X);
5393 return;
5394 }
5395 }
5396 }
5397  
5398 public static void convertStringCodesJavascript(object arg1)
5399 {
5400 {
5401 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
5402 {
5403 return;
5404 }
5405 }
5406 {
5407 Variable Code = new Variable();
5408 Variable RestCodes = new Variable();
5409 foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes)))
5410 {
5411 foreach (bool l3 in putCStringCode(Code))
5412 {
5413 convertStringCodesJavascript(RestCodes);
5414 return;
5415 }
5416 }
5417 }
5418 }
5419  
5420 public static void convertFunctionPython(object arg1)
5421 {
5422 {
5423 foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass")))
5424 {
5425 YP.write(Atom.a("def getDeclaringClass():"));
5426 YP.nl();
5427 YP.write(Atom.a(" return None"));
5428 YP.nl();
5429 YP.nl();
5430 return;
5431 }
5432 }
5433 {
5434 Variable x1 = new Variable();
5435 Variable Name = new Variable();
5436 Variable ArgList = new Variable();
5437 Variable Body = new Variable();
5438 Variable Level = new Variable();
5439 Variable HasBreakableBlock = new Variable();
5440 foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body })))
5441 {
5442 YP.write(Atom.a("def "));
5443 YP.write(Name);
5444 YP.write(Atom.a("("));
5445 convertArgListPython(ArgList);
5446 YP.write(Atom.a("):"));
5447 YP.nl();
5448 foreach (bool l3 in YP.unify(Level, 1))
5449 {
5450 if (hasBreakableBlockPython(Body))
5451 {
5452 foreach (bool l5 in YP.unify(HasBreakableBlock, 1))
5453 {
5454 if (YP.termEqual(HasBreakableBlock, 1))
5455 {
5456 convertIndentationPython(Level);
5457 YP.write(Atom.a("doBreak = False"));
5458 YP.nl();
5459 foreach (bool l7 in convertStatementListPython(Body, Level, HasBreakableBlock))
5460 {
5461 YP.nl();
5462 return;
5463 }
5464 goto cutIf2;
5465 }
5466 foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock))
5467 {
5468 YP.nl();
5469 return;
5470 }
5471 cutIf2:
5472 { }
5473 }
5474 goto cutIf1;
5475 }
5476 foreach (bool l4 in YP.unify(HasBreakableBlock, 0))
5477 {
5478 if (YP.termEqual(HasBreakableBlock, 1))
5479 {
5480 convertIndentationPython(Level);
5481 YP.write(Atom.a("doBreak = False"));
5482 YP.nl();
5483 foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock))
5484 {
5485 YP.nl();
5486 return;
5487 }
5488 goto cutIf3;
5489 }
5490 foreach (bool l5 in convertStatementListPython(Body, Level, HasBreakableBlock))
5491 {
5492 YP.nl();
5493 return;
5494 }
5495 cutIf3:
5496 { }
5497 }
5498 cutIf1:
5499 { }
5500 }
5501 }
5502 }
5503 }
5504  
5505 public static bool hasBreakableBlockPython(object arg1)
5506 {
5507 {
5508 Variable _Name = new Variable();
5509 Variable _Body = new Variable();
5510 Variable _RestStatements = new Variable();
5511 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", _Name, _Body), _RestStatements)))
5512 {
5513 return true;
5514 }
5515 }
5516 {
5517 Variable Body = new Variable();
5518 Variable _RestStatements = new Variable();
5519 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), _RestStatements)))
5520 {
5521 if (hasBreakableBlockPython(Body))
5522 {
5523 return true;
5524 }
5525 }
5526 }
5527 {
5528 Variable _Expression = new Variable();
5529 Variable Body = new Variable();
5530 Variable _RestStatements = new Variable();
5531 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", _Expression, Body), _RestStatements)))
5532 {
5533 if (hasBreakableBlockPython(Body))
5534 {
5535 return true;
5536 }
5537 }
5538 }
5539 {
5540 Variable _Expression = new Variable();
5541 Variable Body = new Variable();
5542 Variable _RestStatements = new Variable();
5543 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", _Expression, Body), _RestStatements)))
5544 {
5545 if (hasBreakableBlockPython(Body))
5546 {
5547 return true;
5548 }
5549 }
5550 }
5551 {
5552 Variable x1 = new Variable();
5553 Variable RestStatements = new Variable();
5554 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, RestStatements)))
5555 {
5556 if (hasBreakableBlockPython(RestStatements))
5557 {
5558 return true;
5559 }
5560 }
5561 }
5562 return false;
5563 }
5564  
5565 public static IEnumerable<bool> convertStatementListPython(object arg1, object arg2, object arg3)
5566 {
5567 {
5568 object x1 = arg2;
5569 object x2 = arg3;
5570 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
5571 {
5572 yield return true;
5573 yield break;
5574 }
5575 }
5576 {
5577 object Level = arg2;
5578 object HasBreakableBlock = arg3;
5579 Variable Name = new Variable();
5580 Variable Body = new Variable();
5581 Variable RestStatements = new Variable();
5582 Variable NextLevel = new Variable();
5583 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements)))
5584 {
5585 convertIndentationPython(Level);
5586 YP.write(Name);
5587 YP.write(Atom.a(" = False"));
5588 YP.nl();
5589 convertIndentationPython(Level);
5590 YP.write(Atom.a("for _ in [1]:"));
5591 YP.nl();
5592 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5593 {
5594 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5595 {
5596 convertIndentationPython(Level);
5597 YP.write(Atom.a("if "));
5598 YP.write(Name);
5599 YP.write(Atom.a(":"));
5600 YP.nl();
5601 convertIndentationPython(NextLevel);
5602 YP.write(Atom.a("doBreak = False"));
5603 YP.nl();
5604 convertIndentationPython(Level);
5605 YP.write(Atom.a("if doBreak:"));
5606 YP.nl();
5607 convertIndentationPython(NextLevel);
5608 YP.write(Atom.a("break"));
5609 YP.nl();
5610 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5611 {
5612 yield return true;
5613 yield break;
5614 }
5615 }
5616 }
5617 }
5618 }
5619 {
5620 object Level = arg2;
5621 object HasBreakableBlock = arg3;
5622 Variable _Type = new Variable();
5623 Variable Name = new Variable();
5624 Variable Expression = new Variable();
5625 Variable RestStatements = new Variable();
5626 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements)))
5627 {
5628 convertIndentationPython(Level);
5629 YP.write(Name);
5630 YP.write(Atom.a(" = "));
5631 convertExpressionPython(Expression);
5632 YP.nl();
5633 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5634 {
5635 yield return true;
5636 yield break;
5637 }
5638 }
5639 }
5640 {
5641 object Level = arg2;
5642 object HasBreakableBlock = arg3;
5643 Variable Name = new Variable();
5644 Variable Expression = new Variable();
5645 Variable RestStatements = new Variable();
5646 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements)))
5647 {
5648 convertIndentationPython(Level);
5649 YP.write(Name);
5650 YP.write(Atom.a(" = "));
5651 convertExpressionPython(Expression);
5652 YP.nl();
5653 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5654 {
5655 yield return true;
5656 yield break;
5657 }
5658 }
5659 }
5660 {
5661 object Level = arg2;
5662 object HasBreakableBlock = arg3;
5663 Variable RestStatements = new Variable();
5664 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements)))
5665 {
5666 convertIndentationPython(Level);
5667 YP.write(Atom.a("yield True"));
5668 YP.nl();
5669 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5670 {
5671 yield return true;
5672 yield break;
5673 }
5674 }
5675 }
5676 {
5677 object Level = arg2;
5678 object HasBreakableBlock = arg3;
5679 Variable RestStatements = new Variable();
5680 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements)))
5681 {
5682 convertIndentationPython(Level);
5683 YP.write(Atom.a("yield False"));
5684 YP.nl();
5685 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5686 {
5687 yield return true;
5688 yield break;
5689 }
5690 }
5691 }
5692 {
5693 object Level = arg2;
5694 object HasBreakableBlock = arg3;
5695 Variable RestStatements = new Variable();
5696 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements)))
5697 {
5698 convertIndentationPython(Level);
5699 YP.write(Atom.a("return"));
5700 YP.nl();
5701 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5702 {
5703 yield return true;
5704 yield break;
5705 }
5706 }
5707 }
5708 {
5709 object Level = arg2;
5710 object HasBreakableBlock = arg3;
5711 Variable RestStatements = new Variable();
5712 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements)))
5713 {
5714 convertIndentationPython(Level);
5715 YP.write(Atom.a("return"));
5716 YP.nl();
5717 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5718 {
5719 yield return true;
5720 yield break;
5721 }
5722 }
5723 }
5724 {
5725 object Level = arg2;
5726 object HasBreakableBlock = arg3;
5727 Variable RestStatements = new Variable();
5728 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements)))
5729 {
5730 convertIndentationPython(Level);
5731 YP.write(Atom.a("return True"));
5732 YP.nl();
5733 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5734 {
5735 yield return true;
5736 yield break;
5737 }
5738 }
5739 }
5740 {
5741 object Level = arg2;
5742 object HasBreakableBlock = arg3;
5743 Variable RestStatements = new Variable();
5744 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements)))
5745 {
5746 convertIndentationPython(Level);
5747 YP.write(Atom.a("return False"));
5748 YP.nl();
5749 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5750 {
5751 yield return true;
5752 yield break;
5753 }
5754 }
5755 }
5756 {
5757 object Level = arg2;
5758 object HasBreakableBlock = arg3;
5759 Variable Name = new Variable();
5760 Variable RestStatements = new Variable();
5761 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements)))
5762 {
5763 convertIndentationPython(Level);
5764 YP.write(Name);
5765 YP.write(Atom.a(" = True"));
5766 YP.nl();
5767 convertIndentationPython(Level);
5768 YP.write(Atom.a("doBreak = True"));
5769 YP.nl();
5770 convertIndentationPython(Level);
5771 YP.write(Atom.a("break"));
5772 YP.nl();
5773 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5774 {
5775 yield return true;
5776 yield break;
5777 }
5778 }
5779 }
5780 {
5781 object Level = arg2;
5782 object HasBreakableBlock = arg3;
5783 Variable Name = new Variable();
5784 Variable ArgList = new Variable();
5785 Variable RestStatements = new Variable();
5786 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements)))
5787 {
5788 convertIndentationPython(Level);
5789 YP.write(Name);
5790 YP.write(Atom.a("("));
5791 convertArgListPython(ArgList);
5792 YP.write(Atom.a(")"));
5793 YP.nl();
5794 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5795 {
5796 yield return true;
5797 yield break;
5798 }
5799 }
5800 }
5801 {
5802 object Level = arg2;
5803 object HasBreakableBlock = arg3;
5804 Variable Name = new Variable();
5805 Variable _FunctorArgs = new Variable();
5806 Variable ArgList = new Variable();
5807 Variable RestStatements = new Variable();
5808 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements)))
5809 {
5810 foreach (bool l3 in convertStatementListPython(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level, HasBreakableBlock))
5811 {
5812 yield return true;
5813 yield break;
5814 }
5815 }
5816 }
5817 {
5818 object Level = arg2;
5819 object HasBreakableBlock = arg3;
5820 Variable Obj = new Variable();
5821 Variable Name = new Variable();
5822 Variable ArgList = new Variable();
5823 Variable RestStatements = new Variable();
5824 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements)))
5825 {
5826 convertIndentationPython(Level);
5827 YP.write(Obj);
5828 YP.write(Atom.a("."));
5829 YP.write(Name);
5830 YP.write(Atom.a("("));
5831 convertArgListPython(ArgList);
5832 YP.write(Atom.a(")"));
5833 YP.nl();
5834 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5835 {
5836 yield return true;
5837 yield break;
5838 }
5839 }
5840 }
5841 {
5842 object Level = arg2;
5843 object HasBreakableBlock = arg3;
5844 Variable Body = new Variable();
5845 Variable RestStatements = new Variable();
5846 Variable NextLevel = new Variable();
5847 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements)))
5848 {
5849 if (YP.termEqual(HasBreakableBlock, 1))
5850 {
5851 convertIndentationPython(Level);
5852 YP.write(Atom.a("for _ in [1]:"));
5853 YP.nl();
5854 foreach (bool l4 in YP.unify(NextLevel, YP.add(Level, 1)))
5855 {
5856 foreach (bool l5 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5857 {
5858 if (YP.termEqual(HasBreakableBlock, 1))
5859 {
5860 if (YP.greaterThan(Level, 1))
5861 {
5862 convertIndentationPython(Level);
5863 YP.write(Atom.a("if doBreak:"));
5864 YP.nl();
5865 convertIndentationPython(NextLevel);
5866 YP.write(Atom.a("break"));
5867 YP.nl();
5868 foreach (bool l8 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5869 {
5870 yield return true;
5871 yield break;
5872 }
5873 goto cutIf3;
5874 }
5875 foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5876 {
5877 yield return true;
5878 yield break;
5879 }
5880 cutIf3:
5881 goto cutIf2;
5882 }
5883 foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5884 {
5885 yield return true;
5886 yield break;
5887 }
5888 cutIf2:
5889 { }
5890 }
5891 }
5892 goto cutIf1;
5893 }
5894 foreach (bool l3 in YP.unify(NextLevel, Level))
5895 {
5896 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5897 {
5898 if (YP.termEqual(HasBreakableBlock, 1))
5899 {
5900 if (YP.greaterThan(Level, 1))
5901 {
5902 convertIndentationPython(Level);
5903 YP.write(Atom.a("if doBreak:"));
5904 YP.nl();
5905 convertIndentationPython(NextLevel);
5906 YP.write(Atom.a("break"));
5907 YP.nl();
5908 foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5909 {
5910 yield return true;
5911 yield break;
5912 }
5913 goto cutIf5;
5914 }
5915 foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5916 {
5917 yield return true;
5918 yield break;
5919 }
5920 cutIf5:
5921 goto cutIf4;
5922 }
5923 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5924 {
5925 yield return true;
5926 yield break;
5927 }
5928 cutIf4:
5929 { }
5930 }
5931 }
5932 cutIf1:
5933 { }
5934 }
5935 }
5936 {
5937 object Level = arg2;
5938 object HasBreakableBlock = arg3;
5939 Variable Expression = new Variable();
5940 Variable Body = new Variable();
5941 Variable RestStatements = new Variable();
5942 Variable NextLevel = new Variable();
5943 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements)))
5944 {
5945 convertIndentationPython(Level);
5946 YP.write(Atom.a("if "));
5947 convertExpressionPython(Expression);
5948 YP.write(Atom.a(":"));
5949 YP.nl();
5950 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5951 {
5952 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5953 {
5954 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5955 {
5956 yield return true;
5957 yield break;
5958 }
5959 }
5960 }
5961 }
5962 }
5963 {
5964 object Level = arg2;
5965 object HasBreakableBlock = arg3;
5966 Variable Expression = new Variable();
5967 Variable Body = new Variable();
5968 Variable RestStatements = new Variable();
5969 Variable NextLevel = new Variable();
5970 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements)))
5971 {
5972 convertIndentationPython(Level);
5973 YP.write(Atom.a("for l"));
5974 YP.write(Level);
5975 YP.write(Atom.a(" in "));
5976 convertExpressionPython(Expression);
5977 YP.write(Atom.a(":"));
5978 YP.nl();
5979 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5980 {
5981 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5982 {
5983 if (YP.termEqual(HasBreakableBlock, 1))
5984 {
5985 convertIndentationPython(Level);
5986 YP.write(Atom.a("if doBreak:"));
5987 YP.nl();
5988 convertIndentationPython(NextLevel);
5989 YP.write(Atom.a("break"));
5990 YP.nl();
5991 foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5992 {
5993 yield return true;
5994 yield break;
5995 }
5996 goto cutIf6;
5997 }
5998 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5999 {
6000 yield return true;
6001 yield break;
6002 }
6003 cutIf6:
6004 { }
6005 }
6006 }
6007 }
6008 }
6009 {
6010 object Level = arg2;
6011 object HasBreakableBlock = arg3;
6012 Variable Expression = new Variable();
6013 Variable RestStatements = new Variable();
6014 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements)))
6015 {
6016 convertIndentationPython(Level);
6017 YP.write(Atom.a("raise "));
6018 convertExpressionPython(Expression);
6019 YP.nl();
6020 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
6021 {
6022 yield return true;
6023 yield break;
6024 }
6025 }
6026 }
6027 }
6028  
6029 public static void convertIndentationPython(object Level)
6030 {
6031 {
6032 Variable N = new Variable();
6033 foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2)))
6034 {
6035 repeatWrite(Atom.a(" "), N);
6036 return;
6037 }
6038 }
6039 }
6040  
6041 public static void convertArgListPython(object arg1)
6042 {
6043 {
6044 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
6045 {
6046 return;
6047 }
6048 }
6049 {
6050 Variable Head = new Variable();
6051 Variable Tail = new Variable();
6052 foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail)))
6053 {
6054 convertExpressionPython(Head);
6055 if (YP.termNotEqual(Tail, Atom.NIL))
6056 {
6057 YP.write(Atom.a(", "));
6058 convertArgListPython(Tail);
6059 return;
6060 goto cutIf1;
6061 }
6062 convertArgListPython(Tail);
6063 return;
6064 cutIf1:
6065 { }
6066 }
6067 }
6068 }
6069  
6070 public static void convertExpressionPython(object arg1)
6071 {
6072 {
6073 Variable X = new Variable();
6074 foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X)))
6075 {
6076 YP.write(X);
6077 return;
6078 }
6079 }
6080 {
6081 Variable Name = new Variable();
6082 Variable ArgList = new Variable();
6083 foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList)))
6084 {
6085 YP.write(Name);
6086 YP.write(Atom.a("("));
6087 convertArgListPython(ArgList);
6088 YP.write(Atom.a(")"));
6089 return;
6090 }
6091 }
6092 {
6093 Variable Name = new Variable();
6094 Variable _FunctorArgs = new Variable();
6095 Variable ArgList = new Variable();
6096 foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList)))
6097 {
6098 convertExpressionPython(new Functor2("call", Name, ArgList));
6099 return;
6100 }
6101 }
6102 {
6103 Variable Obj = new Variable();
6104 Variable Name = new Variable();
6105 Variable ArgList = new Variable();
6106 foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList)))
6107 {
6108 YP.write(Obj);
6109 YP.write(Atom.a("."));
6110 YP.write(Name);
6111 YP.write(Atom.a("("));
6112 convertArgListPython(ArgList);
6113 YP.write(Atom.a(")"));
6114 return;
6115 }
6116 }
6117 {
6118 Variable Name = new Variable();
6119 Variable ArgList = new Variable();
6120 foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList)))
6121 {
6122 YP.write(Name);
6123 YP.write(Atom.a("("));
6124 convertArgListPython(ArgList);
6125 YP.write(Atom.a(")"));
6126 return;
6127 }
6128 }
6129 {
6130 Variable Name = new Variable();
6131 foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name)))
6132 {
6133 YP.write(Name);
6134 return;
6135 }
6136 }
6137 {
6138 foreach (bool l2 in YP.unify(arg1, Atom.a("null")))
6139 {
6140 YP.write(Atom.a("None"));
6141 return;
6142 }
6143 }
6144 {
6145 Variable X = new Variable();
6146 foreach (bool l2 in YP.unify(arg1, new Functor1("not", X)))
6147 {
6148 YP.write(Atom.a("not ("));
6149 convertExpressionPython(X);
6150 YP.write(Atom.a(")"));
6151 return;
6152 }
6153 }
6154 {
6155 Variable X = new Variable();
6156 Variable Y = new Variable();
6157 foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y)))
6158 {
6159 YP.write(Atom.a("("));
6160 convertExpressionPython(X);
6161 YP.write(Atom.a(") and ("));
6162 convertExpressionPython(Y);
6163 YP.write(Atom.a(")"));
6164 return;
6165 }
6166 }
6167 {
6168 Variable ArgList = new Variable();
6169 foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList)))
6170 {
6171 YP.write(Atom.a("["));
6172 convertArgListPython(ArgList);
6173 YP.write(Atom.a("]"));
6174 return;
6175 }
6176 }
6177 {
6178 Variable X = new Variable();
6179 Variable Codes = new Variable();
6180 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
6181 {
6182 if (YP.atom(X))
6183 {
6184 YP.write(Atom.a("\""));
6185 foreach (bool l4 in YP.atom_codes(X, Codes))
6186 {
6187 convertStringCodesPython(Codes);
6188 YP.write(Atom.a("\""));
6189 return;
6190 }
6191 }
6192 }
6193 }
6194 {
6195 Variable X = new Variable();
6196 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
6197 {
6198 YP.write(X);
6199 return;
6200 }
6201 }
6202 }
6203  
6204 public static void convertStringCodesPython(object arg1)
6205 {
6206 {
6207 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
6208 {
6209 return;
6210 }
6211 }
6212 {
6213 Variable Code = new Variable();
6214 Variable RestCodes = new Variable();
6215 foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes)))
6216 {
6217 if (YP.termEqual(Code, 34))
6218 {
6219 YP.put_code(92);
6220 YP.put_code(Code);
6221 convertStringCodesPython(RestCodes);
6222 return;
6223 goto cutIf1;
6224 }
6225 if (YP.termEqual(Code, 92))
6226 {
6227 YP.put_code(92);
6228 YP.put_code(Code);
6229 convertStringCodesPython(RestCodes);
6230 return;
6231 goto cutIf1;
6232 }
6233 YP.put_code(Code);
6234 convertStringCodesPython(RestCodes);
6235 return;
6236 cutIf1:
6237 { }
6238 }
6239 }
6240 }
6241  
6242 public static IEnumerable<bool> putCStringCode(object Code)
6243 {
6244 {
6245 Variable HexDigit = new Variable();
6246 Variable HexChar = new Variable();
6247 if (YP.lessThanOrEqual(Code, 31))
6248 {
6249 if (YP.lessThanOrEqual(Code, 15))
6250 {
6251 YP.write(Atom.a("\\u000"));
6252 foreach (bool l4 in YP.unify(HexDigit, Code))
6253 {
6254 if (YP.lessThanOrEqual(HexDigit, 9))
6255 {
6256 foreach (bool l6 in YP.unify(HexChar, YP.add(HexDigit, 48)))
6257 {
6258 YP.put_code(HexChar);
6259 yield return true;
6260 yield break;
6261 }
6262 goto cutIf2;
6263 }
6264 foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 55)))
6265 {
6266 YP.put_code(HexChar);
6267 yield return true;
6268 yield break;
6269 }
6270 cutIf2:
6271 { }
6272 }
6273 goto cutIf1;
6274 }
6275 YP.write(Atom.a("\\u001"));
6276 foreach (bool l3 in YP.unify(HexDigit, YP.subtract(Code, 16)))
6277 {
6278 if (YP.lessThanOrEqual(HexDigit, 9))
6279 {
6280 foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 48)))
6281 {
6282 YP.put_code(HexChar);
6283 yield return true;
6284 yield break;
6285 }
6286 goto cutIf3;
6287 }
6288 foreach (bool l4 in YP.unify(HexChar, YP.add(HexDigit, 55)))
6289 {
6290 YP.put_code(HexChar);
6291 yield return true;
6292 yield break;
6293 }
6294 cutIf3:
6295 { }
6296 }
6297 cutIf1:
6298 { }
6299 }
6300 }
6301 {
6302 if (YP.termEqual(Code, 34))
6303 {
6304 YP.put_code(92);
6305 YP.put_code(34);
6306 yield return true;
6307 yield break;
6308 }
6309 }
6310 {
6311 if (YP.termEqual(Code, 92))
6312 {
6313 YP.put_code(92);
6314 YP.put_code(92);
6315 yield return true;
6316 yield break;
6317 }
6318 }
6319 {
6320 YP.put_code(Code);
6321 yield return true;
6322 yield break;
6323 }
6324 }
6325  
6326 public static IEnumerable<bool> member(object X, object arg2)
6327 {
6328 {
6329 Variable x2 = new Variable();
6330 foreach (bool l2 in YP.unify(arg2, new ListPair(X, x2)))
6331 {
6332 yield return false;
6333 }
6334 }
6335 {
6336 Variable x2 = new Variable();
6337 Variable Rest = new Variable();
6338 foreach (bool l2 in YP.unify(arg2, new ListPair(x2, Rest)))
6339 {
6340 foreach (bool l3 in member(X, Rest))
6341 {
6342 yield return false;
6343 }
6344 }
6345 }
6346 }
6347  
6348 public static IEnumerable<bool> append(object arg1, object arg2, object arg3)
6349 {
6350 {
6351 Variable List = new Variable();
6352 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
6353 {
6354 foreach (bool l3 in YP.unify(arg2, List))
6355 {
6356 foreach (bool l4 in YP.unify(arg3, List))
6357 {
6358 yield return false;
6359 }
6360 }
6361 }
6362 }
6363 {
6364 object List2 = arg2;
6365 Variable X = new Variable();
6366 Variable List1 = new Variable();
6367 Variable List12 = new Variable();
6368 foreach (bool l2 in YP.unify(arg1, new ListPair(X, List1)))
6369 {
6370 foreach (bool l3 in YP.unify(arg3, new ListPair(X, List12)))
6371 {
6372 foreach (bool l4 in append(List1, List2, List12))
6373 {
6374 yield return false;
6375 }
6376 }
6377 }
6378 }
6379 }
6380 #pragma warning restore 0168, 0219, 0164,0162
6381 }
6382 }