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