diff options
author | Charles Krinke | 2008-07-16 01:00:40 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-16 01:00:40 +0000 |
commit | 620f7926f3f2ad05fdb72050a87e49d0fa2357dd (patch) | |
tree | 848c3c4071ff70f6e24c7e46741bca67b39495c4 /OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs | |
parent | add migration for SceneGroupID to char(36) plus add an index. This (diff) | |
download | opensim-SC_OLD-620f7926f3f2ad05fdb72050a87e49d0fa2357dd.zip opensim-SC_OLD-620f7926f3f2ad05fdb72050a87e49d0fa2357dd.tar.gz opensim-SC_OLD-620f7926f3f2ad05fdb72050a87e49d0fa2357dd.tar.bz2 opensim-SC_OLD-620f7926f3f2ad05fdb72050a87e49d0fa2357dd.tar.xz |
Mantis#1753. Thank you kindly, Kinoc for a patch that:
Brings Yield Prolog up to date with sourceforge version 0.9.10
Patched applies to both DotNet and XEngine.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs | 2266 |
1 files changed, 1369 insertions, 897 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs index 96f2b89..1f1b41d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs | |||
@@ -1,20 +1,20 @@ | |||
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 |
@@ -34,6 +34,7 @@ using System.Collections; | |||
34 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
35 | using System.Text; | 35 | using System.Text; |
36 | using System.CodeDom.Compiler; | 36 | using System.CodeDom.Compiler; |
37 | using System.Reflection; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | 39 | namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog |
39 | { | 40 | { |
@@ -41,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
41 | { | 42 | { |
42 | private class CompilerState | 43 | private class CompilerState |
43 | { | 44 | { |
44 | public IndexedAnswers _pred = new IndexedAnswers(); | 45 | public IndexedAnswers _pred = new IndexedAnswers(4); |
45 | public Dictionary<YP.NameArity, Atom> _moduleForNameArity = new Dictionary<YP.NameArity, Atom>(); | 46 | public Dictionary<YP.NameArity, Atom> _moduleForNameArity = new Dictionary<YP.NameArity, Atom>(); |
46 | public int _gensymCounter; | 47 | public int _gensymCounter; |
47 | public bool _useFinalCutCode; | 48 | public bool _useFinalCutCode; |
@@ -81,11 +82,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
81 | Module = YP.getValue(Module); | 82 | Module = YP.getValue(Module); |
82 | // If the Module Atom comes from the parser, it always has null _declaringClass. | 83 | // 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) | 84 | if (Module is Atom && ((Atom)Module)._module == null && Name is Atom && Arity is int) |
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 | } | ||
89 | } | 88 | } |
90 | 89 | ||
91 | public static void startFunction(object State, object Head) | 90 | public static void startFunction(object State, object Head) |
@@ -202,6 +201,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
202 | return YP.unify(Symbol, Atom.a(Base.ToString() + ++((CompilerState)State)._gensymCounter)); | 201 | return YP.unify(Symbol, Atom.a(Base.ToString() + ++((CompilerState)State)._gensymCounter)); |
203 | } | 202 | } |
204 | 203 | ||
204 | // disable warning on l1, don't see how we can | ||
205 | // code this differently | ||
206 | #pragma warning disable 0168, 0164, 0162 | ||
205 | public static bool isDetNoneOut(object State, object Term) | 207 | public static bool isDetNoneOut(object State, object Term) |
206 | { | 208 | { |
207 | State = YP.getValue(State); | 209 | State = YP.getValue(State); |
@@ -209,18 +211,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
209 | object[] functorArgs = YP.getFunctorArgs(Term); | 211 | object[] functorArgs = YP.getFunctorArgs(Term); |
210 | 212 | ||
211 | Variable pred = new Variable(); | 213 | Variable pred = new Variable(); |
212 | // disable warning: don't see how we can code this differently short | ||
213 | // of rewriting the whole thing | ||
214 | #pragma warning disable 0168 | ||
215 | foreach (bool l1 in ((CompilerState)State)._pred.match | 214 | foreach (bool l1 in ((CompilerState)State)._pred.match |
216 | (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") })) | 215 | (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") })) |
217 | { | 216 | { |
218 | if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue()))) | 217 | if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue()))) |
219 | { | 218 | { |
220 | return true; | 219 | return true; |
221 | } | 220 | } |
222 | } | 221 | } |
223 | #pragma warning restore 0168 | ||
224 | 222 | ||
225 | return false; | 223 | return false; |
226 | } | 224 | } |
@@ -232,21 +230,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
232 | object[] functorArgs = YP.getFunctorArgs(Term); | 230 | object[] functorArgs = YP.getFunctorArgs(Term); |
233 | 231 | ||
234 | Variable pred = new Variable(); | 232 | Variable pred = new Variable(); |
235 | // disable warning: don't see how we can code this differently short | ||
236 | // of rewriting the whole thing | ||
237 | #pragma warning disable 0168 | ||
238 | foreach (bool l1 in ((CompilerState)State)._pred.match | 233 | foreach (bool l1 in ((CompilerState)State)._pred.match |
239 | (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") })) | 234 | (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") })) |
240 | { | 235 | { |
241 | if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue()))) | 236 | if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue()))) |
242 | { | 237 | { |
243 | return true; | 238 | return true; |
244 | } | 239 | } |
245 | } | 240 | } |
246 | #pragma warning restore 0168 | ||
247 | 241 | ||
248 | return false; | 242 | return false; |
249 | } | 243 | } |
244 | #pragma warning restore 0168, 0164, 0162 | ||
250 | 245 | ||
251 | /// <summary> | 246 | /// <summary> |
252 | /// Return false if any of args is out, otherwise true. | 247 | /// Return false if any of args is out, otherwise true. |
@@ -283,9 +278,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
283 | } | 278 | } |
284 | } | 279 | } |
285 | 280 | ||
286 | // disable warning unused variables, the following code is | 281 | // disable warning on l1, don't see how we can |
287 | // infested with it. | 282 | // code this differently |
288 | #pragma warning disable 0168, 0219 | 283 | #pragma warning disable 0168, 0219, 0164, 0162 |
289 | 284 | ||
290 | /// <summary> | 285 | /// <summary> |
291 | /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction | 286 | /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction |
@@ -317,15 +312,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
317 | try | 312 | try |
318 | { | 313 | { |
319 | YP.tell(functionCode); | 314 | YP.tell(functionCode); |
320 | Variable FunctionCode = new Variable(); | 315 | Variable PseudoCode = new Variable(); |
321 | foreach (bool l2 in makeFunctionPseudoCode(RuleList, FunctionCode)) | 316 | foreach (bool l2 in makeFunctionPseudoCode(RuleList, PseudoCode)) |
322 | { | 317 | { |
323 | if (YP.termEqual(FunctionCode, Atom.a("getDeclaringClass"))) | 318 | if (YP.termEqual(PseudoCode, Atom.a("getDeclaringClass"))) |
324 | // Ignore getDeclaringClass since we have access to the one passed in. | 319 | // Ignore getDeclaringClass since we have access to the one passed in. |
325 | continue; | 320 | continue; |
326 | 321 | ||
327 | // Debug: should check if FunctionCode is a single call. | 322 | convertFunctionCSharp(PseudoCode); |
328 | convertFunctionCSharp(FunctionCode); | ||
329 | } | 323 | } |
330 | YP.told(); | 324 | YP.told(); |
331 | } | 325 | } |
@@ -340,7 +334,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog | |||
340 | } | 334 | } |
341 | 335 | ||
342 | /// <summary> | 336 | /// <summary> |
343 | /// Use CodeDomProvider to compile the functionCode and return a YP.IClause. | 337 | /// Use CodeDomProvider to compile the functionCode and return a YP.ClauseHeadAndBody |
338 | /// which implements YP.IClause. | ||
344 | /// The function name must be "function" and have nArgs arguments. | 339 | /// The function name must be "function" and have nArgs arguments. |
345 | /// </summary> | 340 | /// </summary> |
346 | /// <param name="functionCode">the code for the iterator, such as | 341 | /// <param name="functionCode">the code for the iterator, such as |
@@ -370,8 +365,16 @@ using System.Collections.Generic; | |||
370 | using OpenSim.Region.ScriptEngine.Shared.YieldProlog; | 365 | using OpenSim.Region.ScriptEngine.Shared.YieldProlog; |
371 | 366 | ||
372 | namespace Temporary { | 367 | namespace Temporary { |
373 | public class Temporary : YP.IClause { | 368 | public class Temporary : YP.ClauseHeadAndBody, YP.IClause {"); |
374 | public class Inner" + (declaringClass == null ? "" : " : " + declaringClass.FullName) + @" { | 369 | if (declaringClass == null) |
370 | // We don't extend a class with getDeclaringClass, so define it. | ||
371 | sourceCode.Append(@" | ||
372 | public class Inner { | ||
373 | public static System.Type getDeclaringClass() { return null; } | ||
374 | "); | ||
375 | else | ||
376 | sourceCode.Append(@" | ||
377 | public class Inner : " + declaringClass.FullName + @" { | ||
375 | "); | 378 | "); |
376 | sourceCode.Append(functionCode); | 379 | sourceCode.Append(functionCode); |
377 | // Basically, match applies the args to function. | 380 | // Basically, match applies the args to function. |
@@ -399,6 +402,102 @@ namespace Temporary { | |||
399 | ("Temporary.Temporary").GetConstructor(Type.EmptyTypes).Invoke(null); | 402 | ("Temporary.Temporary").GetConstructor(Type.EmptyTypes).Invoke(null); |
400 | } | 403 | } |
401 | 404 | ||
405 | /// <summary> | ||
406 | /// If the functor with name and args can be called directly as determined by | ||
407 | /// functorCallFunctionName, then call it and return its iterator. If the predicate is | ||
408 | /// dynamic and undefined, or if static and the method cannot be found, throw | ||
409 | /// a PrologException for existence_error. | ||
410 | /// This returns null if the functor has a special form than needs to be compiled | ||
411 | /// (including ,/2 and ;/2). | ||
412 | /// </summary> | ||
413 | /// <param name="name"></param> | ||
414 | /// <param name="args"></param> | ||
415 | /// <param name="declaringClass">used to resolve references to the default | ||
416 | /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is | ||
417 | /// null, this throws a PrologException for existence_error</param> | ||
418 | /// <returns></returns> | ||
419 | public static IEnumerable<bool> getSimpleIterator(Atom name, object[] args, Type declaringClass) | ||
420 | { | ||
421 | CompilerState state = new CompilerState(); | ||
422 | Variable FunctionName = new Variable(); | ||
423 | foreach (bool l1 in functorCallFunctionName(state, name, args.Length, FunctionName)) | ||
424 | { | ||
425 | Atom functionNameAtom = ((Atom)FunctionName.getValue()); | ||
426 | if (functionNameAtom == Atom.NIL) | ||
427 | { | ||
428 | // name is for a dynamic predicate. | ||
429 | return YP.matchDynamic(name, args); | ||
430 | } | ||
431 | |||
432 | // Set the default for the method to call. | ||
433 | string methodName = functionNameAtom._name; | ||
434 | Type methodClass = declaringClass; | ||
435 | |||
436 | bool checkMode = false; | ||
437 | if (methodName.StartsWith("YP.")) | ||
438 | { | ||
439 | // Assume we only check mode in calls to standard Prolog predicates in YP. | ||
440 | checkMode = true; | ||
441 | |||
442 | // Use the method in class YP. | ||
443 | methodName = methodName.Substring(3); | ||
444 | methodClass = typeof(YP); | ||
445 | } | ||
446 | if (methodName.Contains(".")) | ||
447 | // We don't support calling inner classes, etc. | ||
448 | return null; | ||
449 | |||
450 | if (methodClass == null) | ||
451 | throw new PrologException | ||
452 | (new Functor2 | ||
453 | (Atom.a("existence_error"), Atom.a("procedure"), | ||
454 | new Functor2(Atom.a("/"), name, args.Length)), | ||
455 | "Cannot find predicate function for: " + name + "/" + args.Length + | ||
456 | " because declaringClass is null. Set declaringClass to the class containing " + | ||
457 | methodName); | ||
458 | try | ||
459 | { | ||
460 | if (checkMode) | ||
461 | { | ||
462 | assertYPPred(state); | ||
463 | object functor = Functor.make(name, args); | ||
464 | if (CompilerState.isDetNoneOut(state, functor)) | ||
465 | { | ||
466 | methodClass.InvokeMember | ||
467 | (methodName, BindingFlags.InvokeMethod, null, null, args); | ||
468 | return YP.succeed(); | ||
469 | } | ||
470 | if (CompilerState.isSemidetNoneOut(state, functor)) | ||
471 | { | ||
472 | if ((bool)methodClass.InvokeMember | ||
473 | (methodName, BindingFlags.InvokeMethod, null, null, args)) | ||
474 | return YP.succeed(); | ||
475 | else | ||
476 | return YP.fail(); | ||
477 | } | ||
478 | |||
479 | } | ||
480 | return (IEnumerable<bool>)methodClass.InvokeMember | ||
481 | (methodName, BindingFlags.InvokeMethod, null, null, args); | ||
482 | } | ||
483 | catch (TargetInvocationException exception) | ||
484 | { | ||
485 | throw exception.InnerException; | ||
486 | } | ||
487 | catch (MissingMethodException) | ||
488 | { | ||
489 | throw new PrologException | ||
490 | (new Functor2 | ||
491 | (Atom.a("existence_error"), Atom.a("procedure"), | ||
492 | new Functor2(Atom.a("/"), name, args.Length)), | ||
493 | "Cannot find predicate function " + methodName + " for " + name + "/" + args.Length + | ||
494 | " in " + methodClass.FullName); | ||
495 | } | ||
496 | } | ||
497 | |||
498 | return null; | ||
499 | } | ||
500 | |||
402 | // Compiler output follows. | 501 | // Compiler output follows. |
403 | 502 | ||
404 | public class YPInnerClass { } | 503 | public class YPInnerClass { } |
@@ -448,26 +547,9 @@ namespace Temporary { | |||
448 | Variable State = new Variable(); | 547 | Variable State = new Variable(); |
449 | foreach (bool l2 in CompilerState.make(State)) | 548 | foreach (bool l2 in CompilerState.make(State)) |
450 | { | 549 | { |
451 | CompilerState.assertPred(State, Atom.a(@"nl"), Atom.a(@"det")); | 550 | assertYPPred(State); |
452 | CompilerState.assertPred(State, new Functor1(@"write", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"det")); | ||
453 | CompilerState.assertPred(State, new Functor1(@"put_code", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"det")); | ||
454 | CompilerState.assertPred(State, new Functor1(@"throw", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"det")); | ||
455 | CompilerState.assertPred(State, new Functor1(@"var", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
456 | CompilerState.assertPred(State, new Functor1(@"nonvar", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
457 | CompilerState.assertPred(State, new Functor1(@"atom", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
458 | CompilerState.assertPred(State, new Functor1(@"integer", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
459 | CompilerState.assertPred(State, new Functor1(@"float", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
460 | CompilerState.assertPred(State, new Functor1(@"number", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
461 | CompilerState.assertPred(State, new Functor1(@"atomic", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
462 | CompilerState.assertPred(State, new Functor1(@"compound", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
463 | CompilerState.assertPred(State, new Functor2(@"==", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in")), new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
464 | CompilerState.assertPred(State, new Functor2(@"\==", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in")), new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
465 | CompilerState.assertPred(State, new Functor2(@"@<", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in")), new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
466 | CompilerState.assertPred(State, new Functor2(@"@=<", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in")), new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
467 | CompilerState.assertPred(State, new Functor2(@"@>", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in")), new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
468 | CompilerState.assertPred(State, new Functor2(@"@>=", new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in")), new Functor2(@"::", Atom.a(@"univ"), Atom.a(@"in"))), Atom.a(@"semidet")); | ||
469 | processCompilerDirectives(RuleList, State); | 551 | processCompilerDirectives(RuleList, State); |
470 | foreach (bool l3 in YP.unify(FunctionCode, Atom.a(@"getDeclaringClass"))) | 552 | foreach (bool l3 in YP.unify(FunctionCode, Atom.a("getDeclaringClass"))) |
471 | { | 553 | { |
472 | yield return false; | 554 | yield return false; |
473 | } | 555 | } |
@@ -479,6 +561,33 @@ namespace Temporary { | |||
479 | } | 561 | } |
480 | } | 562 | } |
481 | 563 | ||
564 | public static void assertYPPred(object State) | ||
565 | { | ||
566 | { | ||
567 | CompilerState.assertPred(State, Atom.a("nl"), Atom.a("det")); | ||
568 | CompilerState.assertPred(State, new Functor1("write", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det")); | ||
569 | CompilerState.assertPred(State, new Functor1("put_code", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det")); | ||
570 | CompilerState.assertPred(State, new Functor1("throw", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det")); | ||
571 | CompilerState.assertPred(State, new Functor1("abolish", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det")); | ||
572 | CompilerState.assertPred(State, new Functor1("retractall", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det")); | ||
573 | CompilerState.assertPred(State, new Functor1("var", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
574 | CompilerState.assertPred(State, new Functor1("nonvar", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
575 | CompilerState.assertPred(State, new Functor1("atom", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
576 | CompilerState.assertPred(State, new Functor1("integer", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
577 | CompilerState.assertPred(State, new Functor1("float", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
578 | CompilerState.assertPred(State, new Functor1("number", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
579 | CompilerState.assertPred(State, new Functor1("atomic", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
580 | CompilerState.assertPred(State, new Functor1("compound", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
581 | CompilerState.assertPred(State, new Functor2("==", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
582 | CompilerState.assertPred(State, new Functor2("\\==", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
583 | CompilerState.assertPred(State, new Functor2("@<", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
584 | CompilerState.assertPred(State, new Functor2("@=<", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
585 | CompilerState.assertPred(State, new Functor2("@>", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
586 | CompilerState.assertPred(State, new Functor2("@>=", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet")); | ||
587 | return; | ||
588 | } | ||
589 | } | ||
590 | |||
482 | public static void processCompilerDirectives(object arg1, object arg2) | 591 | public static void processCompilerDirectives(object arg1, object arg2) |
483 | { | 592 | { |
484 | { | 593 | { |
@@ -494,7 +603,7 @@ namespace Temporary { | |||
494 | Variable Determinism = new Variable(); | 603 | Variable Determinism = new Variable(); |
495 | Variable x3 = new Variable(); | 604 | Variable x3 = new Variable(); |
496 | Variable RestRules = new Variable(); | 605 | Variable RestRules = new Variable(); |
497 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", new Functor1(@":-", new Functor1(@"pred", new Functor2(@"is", Pred, Determinism))), x3), RestRules))) | 606 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor1("pred", new Functor2("is", Pred, Determinism))), x3), RestRules))) |
498 | { | 607 | { |
499 | CompilerState.assertPred(State, Pred, Determinism); | 608 | CompilerState.assertPred(State, Pred, Determinism); |
500 | processCompilerDirectives(RestRules, State); | 609 | processCompilerDirectives(RestRules, State); |
@@ -507,7 +616,7 @@ namespace Temporary { | |||
507 | Variable PredicateList = new Variable(); | 616 | Variable PredicateList = new Variable(); |
508 | Variable x3 = new Variable(); | 617 | Variable x3 = new Variable(); |
509 | Variable RestRules = new Variable(); | 618 | Variable RestRules = new Variable(); |
510 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", new Functor1(@":-", new Functor2(@"import", Module, PredicateList)), x3), RestRules))) | 619 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor2("import", Module, PredicateList)), x3), RestRules))) |
511 | { | 620 | { |
512 | foreach (bool l3 in importPredicateList(State, Module, PredicateList)) | 621 | foreach (bool l3 in importPredicateList(State, Module, PredicateList)) |
513 | { | 622 | { |
@@ -521,7 +630,7 @@ namespace Temporary { | |||
521 | Variable x1 = new Variable(); | 630 | Variable x1 = new Variable(); |
522 | Variable x2 = new Variable(); | 631 | Variable x2 = new Variable(); |
523 | Variable RestRules = new Variable(); | 632 | Variable RestRules = new Variable(); |
524 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", new Functor1(@":-", x1), x2), RestRules))) | 633 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", x1), x2), RestRules))) |
525 | { | 634 | { |
526 | processCompilerDirectives(RestRules, State); | 635 | processCompilerDirectives(RestRules, State); |
527 | return; | 636 | return; |
@@ -535,11 +644,11 @@ namespace Temporary { | |||
535 | Variable RestRules = new Variable(); | 644 | Variable RestRules = new Variable(); |
536 | Variable Name = new Variable(); | 645 | Variable Name = new Variable(); |
537 | Variable Arity = new Variable(); | 646 | Variable Arity = new Variable(); |
538 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", new Functor2(@":-", Head, _Body), x3), RestRules))) | 647 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor2(":-", Head, _Body), x3), RestRules))) |
539 | { | 648 | { |
540 | foreach (bool l3 in YP.functor(Head, Name, Arity)) | 649 | foreach (bool l3 in YP.functor(Head, Name, Arity)) |
541 | { | 650 | { |
542 | CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a(@"")); | 651 | CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a("")); |
543 | processCompilerDirectives(RestRules, State); | 652 | processCompilerDirectives(RestRules, State); |
544 | return; | 653 | return; |
545 | } | 654 | } |
@@ -552,11 +661,11 @@ namespace Temporary { | |||
552 | Variable RestRules = new Variable(); | 661 | Variable RestRules = new Variable(); |
553 | Variable Name = new Variable(); | 662 | Variable Name = new Variable(); |
554 | Variable Arity = new Variable(); | 663 | Variable Arity = new Variable(); |
555 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", Fact, x2), RestRules))) | 664 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", Fact, x2), RestRules))) |
556 | { | 665 | { |
557 | foreach (bool l3 in YP.functor(Fact, Name, Arity)) | 666 | foreach (bool l3 in YP.functor(Fact, Name, Arity)) |
558 | { | 667 | { |
559 | CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a(@"")); | 668 | CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a("")); |
560 | processCompilerDirectives(RestRules, State); | 669 | processCompilerDirectives(RestRules, State); |
561 | return; | 670 | return; |
562 | } | 671 | } |
@@ -591,7 +700,7 @@ namespace Temporary { | |||
591 | Variable Name = new Variable(); | 700 | Variable Name = new Variable(); |
592 | Variable Arity = new Variable(); | 701 | Variable Arity = new Variable(); |
593 | Variable Rest = new Variable(); | 702 | Variable Rest = new Variable(); |
594 | foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2(@"/", Name, Arity), Rest))) | 703 | foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2("/", Name, Arity), Rest))) |
595 | { | 704 | { |
596 | CompilerState.assertModuleForNameArity(State, Name, Arity, Module); | 705 | CompilerState.assertModuleForNameArity(State, Name, Arity, Module); |
597 | foreach (bool l3 in importPredicateList(State, Module, Rest)) | 706 | foreach (bool l3 in importPredicateList(State, Module, Rest)) |
@@ -663,17 +772,17 @@ namespace Temporary { | |||
663 | Variable BodyCode = new Variable(); | 772 | Variable BodyCode = new Variable(); |
664 | Variable ReturnType = new Variable(); | 773 | Variable ReturnType = new Variable(); |
665 | Variable BodyWithReturn = new Variable(); | 774 | Variable BodyWithReturn = new Variable(); |
666 | foreach (bool l2 in YP.unify(new ListPair(new Functor2(@"f", FirstRule, x5), x6), SamePredicateRuleList)) | 775 | foreach (bool l2 in YP.unify(new ListPair(new Functor2("f", FirstRule, x5), x6), SamePredicateRuleList)) |
667 | { | 776 | { |
668 | foreach (bool l3 in YP.unify(FirstRule, new Functor1(@":-", x7))) | 777 | foreach (bool l3 in YP.unify(FirstRule, new Functor1(":-", x7))) |
669 | { | 778 | { |
670 | goto cutIf1; | 779 | goto cutIf1; |
671 | } | 780 | } |
672 | foreach (bool l3 in YP.unify(new Functor2(@":-", Head, x9), FirstRule)) | 781 | foreach (bool l3 in YP.unify(new Functor2(":-", Head, x9), FirstRule)) |
673 | { | 782 | { |
674 | CompilerState.startFunction(State, Head); | 783 | CompilerState.startFunction(State, Head); |
675 | FindallAnswers findallAnswers3 = new FindallAnswers(new Functor2(@"f", ArgAssignments, Calls)); | 784 | FindallAnswers findallAnswers3 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls)); |
676 | foreach (bool l4 in member(new Functor2(@"f", Rule, VariableNameSuggestions), SamePredicateRuleList)) | 785 | foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList)) |
677 | { | 786 | { |
678 | foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls)) | 787 | foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls)) |
679 | { | 788 | { |
@@ -707,26 +816,26 @@ namespace Temporary { | |||
707 | { | 816 | { |
708 | foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode)) | 817 | foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode)) |
709 | { | 818 | { |
710 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 819 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
711 | { | 820 | { |
712 | foreach (bool l11 in YP.unify(ReturnType, Atom.a(@"void"))) | 821 | foreach (bool l11 in YP.unify(ReturnType, Atom.a("void"))) |
713 | { | 822 | { |
714 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 823 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
715 | { | 824 | { |
716 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a(@"returnfalse"), Atom.NIL), BodyWithReturn)) | 825 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) |
717 | { | 826 | { |
718 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 827 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
719 | { | 828 | { |
720 | yield return false; | 829 | yield return false; |
721 | } | 830 | } |
722 | } | 831 | } |
723 | goto cutIf7; | 832 | goto cutIf7; |
724 | } | 833 | } |
725 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 834 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
726 | { | 835 | { |
727 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 836 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
728 | { | 837 | { |
729 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 838 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
730 | { | 839 | { |
731 | yield return false; | 840 | yield return false; |
732 | } | 841 | } |
@@ -737,16 +846,16 @@ namespace Temporary { | |||
737 | { | 846 | { |
738 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 847 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
739 | { | 848 | { |
740 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 849 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
741 | { | 850 | { |
742 | yield return false; | 851 | yield return false; |
743 | } | 852 | } |
744 | } | 853 | } |
745 | goto cutIf9; | 854 | goto cutIf9; |
746 | } | 855 | } |
747 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2(@"foreach", new Functor2(@"call", Atom.a(@"YP.fail"), Atom.NIL), new ListPair(Atom.a(@"yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) | 856 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) |
748 | { | 857 | { |
749 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 858 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
750 | { | 859 | { |
751 | yield return false; | 860 | yield return false; |
752 | } | 861 | } |
@@ -758,26 +867,26 @@ namespace Temporary { | |||
758 | } | 867 | } |
759 | goto cutIf6; | 868 | goto cutIf6; |
760 | } | 869 | } |
761 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 870 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
762 | { | 871 | { |
763 | foreach (bool l11 in YP.unify(ReturnType, Atom.a(@"bool"))) | 872 | foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool"))) |
764 | { | 873 | { |
765 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 874 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
766 | { | 875 | { |
767 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a(@"returnfalse"), Atom.NIL), BodyWithReturn)) | 876 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) |
768 | { | 877 | { |
769 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 878 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
770 | { | 879 | { |
771 | yield return false; | 880 | yield return false; |
772 | } | 881 | } |
773 | } | 882 | } |
774 | goto cutIf11; | 883 | goto cutIf11; |
775 | } | 884 | } |
776 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 885 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
777 | { | 886 | { |
778 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 887 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
779 | { | 888 | { |
780 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 889 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
781 | { | 890 | { |
782 | yield return false; | 891 | yield return false; |
783 | } | 892 | } |
@@ -788,16 +897,16 @@ namespace Temporary { | |||
788 | { | 897 | { |
789 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 898 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
790 | { | 899 | { |
791 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 900 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
792 | { | 901 | { |
793 | yield return false; | 902 | yield return false; |
794 | } | 903 | } |
795 | } | 904 | } |
796 | goto cutIf13; | 905 | goto cutIf13; |
797 | } | 906 | } |
798 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2(@"foreach", new Functor2(@"call", Atom.a(@"YP.fail"), Atom.NIL), new ListPair(Atom.a(@"yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) | 907 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) |
799 | { | 908 | { |
800 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 909 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
801 | { | 910 | { |
802 | yield return false; | 911 | yield return false; |
803 | } | 912 | } |
@@ -809,24 +918,24 @@ namespace Temporary { | |||
809 | } | 918 | } |
810 | goto cutIf10; | 919 | goto cutIf10; |
811 | } | 920 | } |
812 | foreach (bool l10 in YP.unify(ReturnType, Atom.a(@"IEnumerable<bool>"))) | 921 | foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>"))) |
813 | { | 922 | { |
814 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 923 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
815 | { | 924 | { |
816 | foreach (bool l12 in append(BodyCode, new ListPair(Atom.a(@"returnfalse"), Atom.NIL), BodyWithReturn)) | 925 | foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) |
817 | { | 926 | { |
818 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 927 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
819 | { | 928 | { |
820 | yield return false; | 929 | yield return false; |
821 | } | 930 | } |
822 | } | 931 | } |
823 | goto cutIf14; | 932 | goto cutIf14; |
824 | } | 933 | } |
825 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 934 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
826 | { | 935 | { |
827 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) | 936 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) |
828 | { | 937 | { |
829 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 938 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
830 | { | 939 | { |
831 | yield return false; | 940 | yield return false; |
832 | } | 941 | } |
@@ -837,16 +946,16 @@ namespace Temporary { | |||
837 | { | 946 | { |
838 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) | 947 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) |
839 | { | 948 | { |
840 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 949 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
841 | { | 950 | { |
842 | yield return false; | 951 | yield return false; |
843 | } | 952 | } |
844 | } | 953 | } |
845 | goto cutIf16; | 954 | goto cutIf16; |
846 | } | 955 | } |
847 | foreach (bool l11 in append(BodyCode, new ListPair(new Functor2(@"foreach", new Functor2(@"call", Atom.a(@"YP.fail"), Atom.NIL), new ListPair(Atom.a(@"yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) | 956 | foreach (bool l11 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) |
848 | { | 957 | { |
849 | foreach (bool l12 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 958 | foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
850 | { | 959 | { |
851 | yield return false; | 960 | yield return false; |
852 | } | 961 | } |
@@ -870,8 +979,8 @@ namespace Temporary { | |||
870 | foreach (bool l3 in YP.unify(Head, FirstRule)) | 979 | foreach (bool l3 in YP.unify(Head, FirstRule)) |
871 | { | 980 | { |
872 | CompilerState.startFunction(State, Head); | 981 | CompilerState.startFunction(State, Head); |
873 | FindallAnswers findallAnswers17 = new FindallAnswers(new Functor2(@"f", ArgAssignments, Calls)); | 982 | FindallAnswers findallAnswers17 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls)); |
874 | foreach (bool l4 in member(new Functor2(@"f", Rule, VariableNameSuggestions), SamePredicateRuleList)) | 983 | foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList)) |
875 | { | 984 | { |
876 | foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls)) | 985 | foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls)) |
877 | { | 986 | { |
@@ -905,26 +1014,26 @@ namespace Temporary { | |||
905 | { | 1014 | { |
906 | foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode)) | 1015 | foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode)) |
907 | { | 1016 | { |
908 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 1017 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
909 | { | 1018 | { |
910 | foreach (bool l11 in YP.unify(ReturnType, Atom.a(@"void"))) | 1019 | foreach (bool l11 in YP.unify(ReturnType, Atom.a("void"))) |
911 | { | 1020 | { |
912 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 1021 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
913 | { | 1022 | { |
914 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a(@"returnfalse"), Atom.NIL), BodyWithReturn)) | 1023 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) |
915 | { | 1024 | { |
916 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1025 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
917 | { | 1026 | { |
918 | yield return false; | 1027 | yield return false; |
919 | } | 1028 | } |
920 | } | 1029 | } |
921 | goto cutIf21; | 1030 | goto cutIf21; |
922 | } | 1031 | } |
923 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 1032 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
924 | { | 1033 | { |
925 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 1034 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
926 | { | 1035 | { |
927 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1036 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
928 | { | 1037 | { |
929 | yield return false; | 1038 | yield return false; |
930 | } | 1039 | } |
@@ -935,16 +1044,16 @@ namespace Temporary { | |||
935 | { | 1044 | { |
936 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 1045 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
937 | { | 1046 | { |
938 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1047 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
939 | { | 1048 | { |
940 | yield return false; | 1049 | yield return false; |
941 | } | 1050 | } |
942 | } | 1051 | } |
943 | goto cutIf23; | 1052 | goto cutIf23; |
944 | } | 1053 | } |
945 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2(@"foreach", new Functor2(@"call", Atom.a(@"YP.fail"), Atom.NIL), new ListPair(Atom.a(@"yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) | 1054 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) |
946 | { | 1055 | { |
947 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1056 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
948 | { | 1057 | { |
949 | yield return false; | 1058 | yield return false; |
950 | } | 1059 | } |
@@ -956,26 +1065,26 @@ namespace Temporary { | |||
956 | } | 1065 | } |
957 | goto cutIf20; | 1066 | goto cutIf20; |
958 | } | 1067 | } |
959 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 1068 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
960 | { | 1069 | { |
961 | foreach (bool l11 in YP.unify(ReturnType, Atom.a(@"bool"))) | 1070 | foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool"))) |
962 | { | 1071 | { |
963 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 1072 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
964 | { | 1073 | { |
965 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a(@"returnfalse"), Atom.NIL), BodyWithReturn)) | 1074 | foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) |
966 | { | 1075 | { |
967 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1076 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
968 | { | 1077 | { |
969 | yield return false; | 1078 | yield return false; |
970 | } | 1079 | } |
971 | } | 1080 | } |
972 | goto cutIf25; | 1081 | goto cutIf25; |
973 | } | 1082 | } |
974 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 1083 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
975 | { | 1084 | { |
976 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 1085 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
977 | { | 1086 | { |
978 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1087 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
979 | { | 1088 | { |
980 | yield return false; | 1089 | yield return false; |
981 | } | 1090 | } |
@@ -986,16 +1095,16 @@ namespace Temporary { | |||
986 | { | 1095 | { |
987 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) | 1096 | foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode)) |
988 | { | 1097 | { |
989 | foreach (bool l14 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1098 | foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
990 | { | 1099 | { |
991 | yield return false; | 1100 | yield return false; |
992 | } | 1101 | } |
993 | } | 1102 | } |
994 | goto cutIf27; | 1103 | goto cutIf27; |
995 | } | 1104 | } |
996 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2(@"foreach", new Functor2(@"call", Atom.a(@"YP.fail"), Atom.NIL), new ListPair(Atom.a(@"yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) | 1105 | foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) |
997 | { | 1106 | { |
998 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1107 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
999 | { | 1108 | { |
1000 | yield return false; | 1109 | yield return false; |
1001 | } | 1110 | } |
@@ -1007,24 +1116,24 @@ namespace Temporary { | |||
1007 | } | 1116 | } |
1008 | goto cutIf24; | 1117 | goto cutIf24; |
1009 | } | 1118 | } |
1010 | foreach (bool l10 in YP.unify(ReturnType, Atom.a(@"IEnumerable<bool>"))) | 1119 | foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>"))) |
1011 | { | 1120 | { |
1012 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 1121 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) |
1013 | { | 1122 | { |
1014 | foreach (bool l12 in append(BodyCode, new ListPair(Atom.a(@"returnfalse"), Atom.NIL), BodyWithReturn)) | 1123 | foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn)) |
1015 | { | 1124 | { |
1016 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1125 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
1017 | { | 1126 | { |
1018 | yield return false; | 1127 | yield return false; |
1019 | } | 1128 | } |
1020 | } | 1129 | } |
1021 | goto cutIf28; | 1130 | goto cutIf28; |
1022 | } | 1131 | } |
1023 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 1132 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) |
1024 | { | 1133 | { |
1025 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) | 1134 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) |
1026 | { | 1135 | { |
1027 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1136 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
1028 | { | 1137 | { |
1029 | yield return false; | 1138 | yield return false; |
1030 | } | 1139 | } |
@@ -1035,16 +1144,16 @@ namespace Temporary { | |||
1035 | { | 1144 | { |
1036 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) | 1145 | foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode)) |
1037 | { | 1146 | { |
1038 | foreach (bool l13 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1147 | foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
1039 | { | 1148 | { |
1040 | yield return false; | 1149 | yield return false; |
1041 | } | 1150 | } |
1042 | } | 1151 | } |
1043 | goto cutIf30; | 1152 | goto cutIf30; |
1044 | } | 1153 | } |
1045 | foreach (bool l11 in append(BodyCode, new ListPair(new Functor2(@"foreach", new Functor2(@"call", Atom.a(@"YP.fail"), Atom.NIL), new ListPair(Atom.a(@"yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) | 1154 | foreach (bool l11 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn)) |
1046 | { | 1155 | { |
1047 | foreach (bool l12 in YP.unify(FunctionCode, new Functor(@"function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) | 1156 | foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn }))) |
1048 | { | 1157 | { |
1049 | yield return false; | 1158 | yield return false; |
1050 | } | 1159 | } |
@@ -1119,13 +1228,13 @@ namespace Temporary { | |||
1119 | Variable RestSamePredicates = new Variable(); | 1228 | Variable RestSamePredicates = new Variable(); |
1120 | foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest))) | 1229 | foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest))) |
1121 | { | 1230 | { |
1122 | foreach (bool l3 in YP.unify(new Functor2(@"f", FirstRule, x6), First)) | 1231 | foreach (bool l3 in YP.unify(new Functor2("f", FirstRule, x6), First)) |
1123 | { | 1232 | { |
1124 | foreach (bool l4 in YP.unify(new ListPair(new Functor2(@"f", SecondRule, x8), x9), Rest)) | 1233 | foreach (bool l4 in YP.unify(new ListPair(new Functor2("f", SecondRule, x8), x9), Rest)) |
1125 | { | 1234 | { |
1126 | foreach (bool l5 in YP.unify(new Functor2(@":-", FirstHead, x11), FirstRule)) | 1235 | foreach (bool l5 in YP.unify(new Functor2(":-", FirstHead, x11), FirstRule)) |
1127 | { | 1236 | { |
1128 | foreach (bool l6 in YP.unify(new Functor2(@":-", SecondHead, x13), SecondRule)) | 1237 | foreach (bool l6 in YP.unify(new Functor2(":-", SecondHead, x13), SecondRule)) |
1129 | { | 1238 | { |
1130 | foreach (bool l7 in YP.functor(FirstHead, Name, Arity)) | 1239 | foreach (bool l7 in YP.functor(FirstHead, Name, Arity)) |
1131 | { | 1240 | { |
@@ -1187,7 +1296,7 @@ namespace Temporary { | |||
1187 | } | 1296 | } |
1188 | foreach (bool l5 in YP.unify(FirstHead, FirstRule)) | 1297 | foreach (bool l5 in YP.unify(FirstHead, FirstRule)) |
1189 | { | 1298 | { |
1190 | foreach (bool l6 in YP.unify(new Functor2(@":-", SecondHead, x13), SecondRule)) | 1299 | foreach (bool l6 in YP.unify(new Functor2(":-", SecondHead, x13), SecondRule)) |
1191 | { | 1300 | { |
1192 | foreach (bool l7 in YP.functor(FirstHead, Name, Arity)) | 1301 | foreach (bool l7 in YP.functor(FirstHead, Name, Arity)) |
1193 | { | 1302 | { |
@@ -1275,9 +1384,9 @@ namespace Temporary { | |||
1275 | Variable Rest = new Variable(); | 1384 | Variable Rest = new Variable(); |
1276 | Variable ClauseCode = new Variable(); | 1385 | Variable ClauseCode = new Variable(); |
1277 | Variable RestResults = new Variable(); | 1386 | Variable RestResults = new Variable(); |
1278 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", ArgAssignments, Calls), Rest))) | 1387 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", ArgAssignments, Calls), Rest))) |
1279 | { | 1388 | { |
1280 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1(@"blockScope", ClauseCode), RestResults))) | 1389 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("blockScope", ClauseCode), RestResults))) |
1281 | { | 1390 | { |
1282 | foreach (bool l4 in prependArgAssignments(ArgAssignments, Calls, MergedArgNames, ClauseCode)) | 1391 | foreach (bool l4 in prependArgAssignments(ArgAssignments, Calls, MergedArgNames, ClauseCode)) |
1283 | { | 1392 | { |
@@ -1316,7 +1425,7 @@ namespace Temporary { | |||
1316 | Variable VariableName = new Variable(); | 1425 | Variable VariableName = new Variable(); |
1317 | Variable ArgName = new Variable(); | 1426 | Variable ArgName = new Variable(); |
1318 | Variable RestArgAssignments = new Variable(); | 1427 | Variable RestArgAssignments = new Variable(); |
1319 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"f", VariableName, ArgName), RestArgAssignments))) | 1428 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", VariableName, ArgName), RestArgAssignments))) |
1320 | { | 1429 | { |
1321 | foreach (bool l3 in member(VariableName, MergedArgNames)) | 1430 | foreach (bool l3 in member(VariableName, MergedArgNames)) |
1322 | { | 1431 | { |
@@ -1327,7 +1436,7 @@ namespace Temporary { | |||
1327 | } | 1436 | } |
1328 | goto cutIf1; | 1437 | goto cutIf1; |
1329 | } | 1438 | } |
1330 | foreach (bool l3 in prependArgAssignments(RestArgAssignments, new ListPair(new Functor3(@"declare", Atom.a(@"object"), VariableName, new Functor1(@"var", ArgName)), In), MergedArgNames, ClauseCode)) | 1439 | foreach (bool l3 in prependArgAssignments(RestArgAssignments, new ListPair(new Functor3("declare", Atom.a("object"), VariableName, new Functor1("var", ArgName)), In), MergedArgNames, ClauseCode)) |
1331 | { | 1440 | { |
1332 | yield return true; | 1441 | yield return true; |
1333 | yield break; | 1442 | yield break; |
@@ -1356,9 +1465,9 @@ namespace Temporary { | |||
1356 | Variable ArgAssignments = new Variable(); | 1465 | Variable ArgAssignments = new Variable(); |
1357 | Variable _Calls = new Variable(); | 1466 | Variable _Calls = new Variable(); |
1358 | Variable RestClauseBag = new Variable(); | 1467 | Variable RestClauseBag = new Variable(); |
1359 | foreach (bool l2 in YP.unify(arg2, new ListPair(new Functor2(@"f", ArgAssignments, _Calls), RestClauseBag))) | 1468 | foreach (bool l2 in YP.unify(arg2, new ListPair(new Functor2("f", ArgAssignments, _Calls), RestClauseBag))) |
1360 | { | 1469 | { |
1361 | foreach (bool l3 in member(new Functor2(@"f", VariableName, ArgName), ArgAssignments)) | 1470 | foreach (bool l3 in member(new Functor2("f", VariableName, ArgName), ArgAssignments)) |
1362 | { | 1471 | { |
1363 | foreach (bool l4 in argAssignedAll(ArgName, RestClauseBag, VariableName)) | 1472 | foreach (bool l4 in argAssignedAll(ArgName, RestClauseBag, VariableName)) |
1364 | { | 1473 | { |
@@ -1387,7 +1496,7 @@ namespace Temporary { | |||
1387 | Variable RestResults = new Variable(); | 1496 | Variable RestResults = new Variable(); |
1388 | foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest))) | 1497 | foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest))) |
1389 | { | 1498 | { |
1390 | foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor1(@"arg", First), RestResults))) | 1499 | foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor1("arg", First), RestResults))) |
1391 | { | 1500 | { |
1392 | foreach (bool l4 in maplist_arg(Rest, RestResults)) | 1501 | foreach (bool l4 in maplist_arg(Rest, RestResults)) |
1393 | { | 1502 | { |
@@ -1429,7 +1538,7 @@ namespace Temporary { | |||
1429 | { | 1538 | { |
1430 | foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes)) | 1539 | foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes)) |
1431 | { | 1540 | { |
1432 | foreach (bool l6 in YP.atom_concat(Atom.a(@"arg"), NumberAtom, ArgName)) | 1541 | foreach (bool l6 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName)) |
1433 | { | 1542 | { |
1434 | foreach (bool l7 in YP.unify(NextArgNumber, YP.add(StartArgNumber, 1))) | 1543 | foreach (bool l7 in YP.unify(NextArgNumber, YP.add(StartArgNumber, 1))) |
1435 | { | 1544 | { |
@@ -1458,7 +1567,7 @@ namespace Temporary { | |||
1458 | Variable BodyCode = new Variable(); | 1567 | Variable BodyCode = new Variable(); |
1459 | Variable VariableNamesList = new Variable(); | 1568 | Variable VariableNamesList = new Variable(); |
1460 | Variable ArgUnifications = new Variable(); | 1569 | Variable ArgUnifications = new Variable(); |
1461 | foreach (bool l2 in YP.unify(new Functor2(@":-", Head, Body), Rule)) | 1570 | foreach (bool l2 in YP.unify(new Functor2(":-", Head, Body), Rule)) |
1462 | { | 1571 | { |
1463 | CompilerState.newVariableNames(State, Rule, VariableNameSuggestions); | 1572 | CompilerState.newVariableNames(State, Rule, VariableNameSuggestions); |
1464 | foreach (bool l3 in YP.univ(Head, new ListPair(x8, HeadArgs))) | 1573 | foreach (bool l3 in YP.univ(Head, new ListPair(x8, HeadArgs))) |
@@ -1484,7 +1593,7 @@ namespace Temporary { | |||
1484 | } | 1593 | } |
1485 | } | 1594 | } |
1486 | { | 1595 | { |
1487 | foreach (bool l2 in compileBodyWithHeadBindings(new Functor2(@":-", Rule, Atom.a(@"true")), VariableNameSuggestions, State, ArgAssignments, Calls)) | 1596 | foreach (bool l2 in compileBodyWithHeadBindings(new Functor2(":-", Rule, Atom.a("true")), VariableNameSuggestions, State, ArgAssignments, Calls)) |
1488 | { | 1597 | { |
1489 | yield return true; | 1598 | yield return true; |
1490 | yield break; | 1599 | yield break; |
@@ -1557,13 +1666,13 @@ namespace Temporary { | |||
1557 | { | 1666 | { |
1558 | foreach (bool l3 in YP.unify(arg2, new ListPair(CompiledHeadArg, RestCompiledHeadArgs))) | 1667 | foreach (bool l3 in YP.unify(arg2, new ListPair(CompiledHeadArg, RestCompiledHeadArgs))) |
1559 | { | 1668 | { |
1560 | 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))) | 1669 | 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))) |
1561 | { | 1670 | { |
1562 | foreach (bool l5 in YP.number_codes(Index, NumberCodes)) | 1671 | foreach (bool l5 in YP.number_codes(Index, NumberCodes)) |
1563 | { | 1672 | { |
1564 | foreach (bool l6 in YP.atom_codes(NumberAtom, NumberCodes)) | 1673 | foreach (bool l6 in YP.atom_codes(NumberAtom, NumberCodes)) |
1565 | { | 1674 | { |
1566 | foreach (bool l7 in YP.atom_concat(Atom.a(@"arg"), NumberAtom, ArgName)) | 1675 | foreach (bool l7 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName)) |
1567 | { | 1676 | { |
1568 | foreach (bool l8 in YP.unify(NextIndex, YP.add(Index, 1))) | 1677 | foreach (bool l8 in YP.unify(NextIndex, YP.add(Index, 1))) |
1569 | { | 1678 | { |
@@ -1619,7 +1728,7 @@ namespace Temporary { | |||
1619 | Variable NumberCodes = new Variable(); | 1728 | Variable NumberCodes = new Variable(); |
1620 | Variable NumberAtom = new Variable(); | 1729 | Variable NumberAtom = new Variable(); |
1621 | Variable ArgName = new Variable(); | 1730 | Variable ArgName = new Variable(); |
1622 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"=", VariableName, Var), RestVariableNames))) | 1731 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", VariableName, Var), RestVariableNames))) |
1623 | { | 1732 | { |
1624 | foreach (bool l3 in getVariableArgIndex1(Var, HeadArgs, ArgIndex1)) | 1733 | foreach (bool l3 in getVariableArgIndex1(Var, HeadArgs, ArgIndex1)) |
1625 | { | 1734 | { |
@@ -1627,9 +1736,9 @@ namespace Temporary { | |||
1627 | { | 1736 | { |
1628 | foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes)) | 1737 | foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes)) |
1629 | { | 1738 | { |
1630 | foreach (bool l6 in YP.atom_concat(Atom.a(@"arg"), NumberAtom, ArgName)) | 1739 | foreach (bool l6 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName)) |
1631 | { | 1740 | { |
1632 | foreach (bool l7 in compileDeclarations(RestVariableNames, HeadArgs, new ListPair(new Functor2(@"f", VariableName, ArgName), ArgAssignmentsIn), ArgAssignmentsOut, DeclarationsIn, DeclarationsOut)) | 1741 | foreach (bool l7 in compileDeclarations(RestVariableNames, HeadArgs, new ListPair(new Functor2("f", VariableName, ArgName), ArgAssignmentsIn), ArgAssignmentsOut, DeclarationsIn, DeclarationsOut)) |
1633 | { | 1742 | { |
1634 | yield return true; | 1743 | yield return true; |
1635 | yield break; | 1744 | yield break; |
@@ -1649,9 +1758,9 @@ namespace Temporary { | |||
1649 | Variable _Var = new Variable(); | 1758 | Variable _Var = new Variable(); |
1650 | Variable RestVariableNames = new Variable(); | 1759 | Variable RestVariableNames = new Variable(); |
1651 | Variable DeclarationsOut = new Variable(); | 1760 | Variable DeclarationsOut = new Variable(); |
1652 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"=", VariableName, _Var), RestVariableNames))) | 1761 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", VariableName, _Var), RestVariableNames))) |
1653 | { | 1762 | { |
1654 | 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))) | 1763 | 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))) |
1655 | { | 1764 | { |
1656 | foreach (bool l4 in compileDeclarations(RestVariableNames, HeadArgs, ArgAssignmentsIn, ArgAssignmentsOut, DeclarationsIn, DeclarationsOut)) | 1765 | foreach (bool l4 in compileDeclarations(RestVariableNames, HeadArgs, ArgAssignmentsIn, ArgAssignmentsOut, DeclarationsIn, DeclarationsOut)) |
1657 | { | 1766 | { |
@@ -1713,7 +1822,7 @@ namespace Temporary { | |||
1713 | object PseudoCode = arg3; | 1822 | object PseudoCode = arg3; |
1714 | if (YP.var(A)) | 1823 | if (YP.var(A)) |
1715 | { | 1824 | { |
1716 | foreach (bool l3 in compileRuleBody(new Functor2(@",", new Functor1(@"call", A), Atom.a(@"true")), State, PseudoCode)) | 1825 | foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("call", A), Atom.a("true")), State, PseudoCode)) |
1717 | { | 1826 | { |
1718 | yield return true; | 1827 | yield return true; |
1719 | yield break; | 1828 | yield break; |
@@ -1722,25 +1831,14 @@ namespace Temporary { | |||
1722 | } | 1831 | } |
1723 | { | 1832 | { |
1724 | object State = arg2; | 1833 | object State = arg2; |
1725 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"!"))) | 1834 | object PseudoCode = arg3; |
1726 | { | 1835 | Variable A = new Variable(); |
1727 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"return"), Atom.NIL))) | 1836 | Variable B = new Variable(); |
1728 | { | 1837 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B))) |
1729 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | ||
1730 | { | ||
1731 | yield return true; | ||
1732 | yield break; | ||
1733 | } | ||
1734 | } | ||
1735 | } | ||
1736 | } | ||
1737 | { | ||
1738 | object State = arg2; | ||
1739 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"!"))) | ||
1740 | { | 1838 | { |
1741 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"returntrue"), Atom.NIL))) | 1839 | if (YP.var(A)) |
1742 | { | 1840 | { |
1743 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | 1841 | foreach (bool l4 in compileRuleBody(new Functor2(",", new Functor1("call", A), B), State, PseudoCode)) |
1744 | { | 1842 | { |
1745 | yield return true; | 1843 | yield return true; |
1746 | yield break; | 1844 | yield break; |
@@ -1750,81 +1848,44 @@ namespace Temporary { | |||
1750 | } | 1848 | } |
1751 | { | 1849 | { |
1752 | object State = arg2; | 1850 | object State = arg2; |
1753 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"!"))) | 1851 | object PseudoCode = arg3; |
1754 | { | 1852 | Variable A = new Variable(); |
1755 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"yieldtrue"), new ListPair(Atom.a(@"yieldbreak"), Atom.NIL)))) | 1853 | Variable B = new Variable(); |
1756 | { | 1854 | Variable ACode = new Variable(); |
1757 | CompilerState.setCodeUsesYield(State); | 1855 | Variable BCode = new Variable(); |
1758 | yield return true; | 1856 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B))) |
1759 | yield break; | ||
1760 | } | ||
1761 | } | ||
1762 | } | ||
1763 | { | ||
1764 | object _State = arg2; | ||
1765 | Variable Name = new Variable(); | ||
1766 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"$CUTIF", Name))) | ||
1767 | { | ||
1768 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1(@"breakBlock", Name), Atom.NIL))) | ||
1769 | { | ||
1770 | yield return true; | ||
1771 | yield break; | ||
1772 | } | ||
1773 | } | ||
1774 | } | ||
1775 | { | ||
1776 | object State = arg2; | ||
1777 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"true"))) | ||
1778 | { | 1857 | { |
1779 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"return"), Atom.NIL))) | 1858 | foreach (bool l3 in compileFunctorCall(A, State, ACode)) |
1780 | { | 1859 | { |
1781 | if (CompilerState.determinismEquals(State, Atom.a(@"detNoneOut"))) | 1860 | if (CompilerState.isDetNoneOut(State, A)) |
1782 | { | 1861 | { |
1783 | yield return true; | 1862 | foreach (bool l5 in compileRuleBody(B, State, BCode)) |
1784 | yield break; | 1863 | { |
1864 | foreach (bool l6 in YP.unify(PseudoCode, new ListPair(ACode, BCode))) | ||
1865 | { | ||
1866 | yield return true; | ||
1867 | yield break; | ||
1868 | } | ||
1869 | } | ||
1785 | } | 1870 | } |
1786 | } | 1871 | if (CompilerState.isSemidetNoneOut(State, A)) |
1787 | } | ||
1788 | } | ||
1789 | { | ||
1790 | object State = arg2; | ||
1791 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"true"))) | ||
1792 | { | ||
1793 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"returntrue"), Atom.NIL))) | ||
1794 | { | ||
1795 | if (CompilerState.determinismEquals(State, Atom.a(@"semidetNoneOut"))) | ||
1796 | { | 1872 | { |
1797 | yield return true; | 1873 | foreach (bool l5 in compileRuleBody(B, State, BCode)) |
1798 | yield break; | 1874 | { |
1875 | foreach (bool l6 in YP.unify(PseudoCode, new ListPair(new Functor2("if", ACode, BCode), Atom.NIL))) | ||
1876 | { | ||
1877 | yield return true; | ||
1878 | yield break; | ||
1879 | } | ||
1880 | } | ||
1799 | } | 1881 | } |
1800 | } | 1882 | foreach (bool l4 in compileRuleBody(B, State, BCode)) |
1801 | } | ||
1802 | } | ||
1803 | { | ||
1804 | object State = arg2; | ||
1805 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"true"))) | ||
1806 | { | ||
1807 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"yieldfalse"), Atom.NIL))) | ||
1808 | { | ||
1809 | CompilerState.setCodeUsesYield(State); | ||
1810 | yield return true; | ||
1811 | yield break; | ||
1812 | } | ||
1813 | } | ||
1814 | } | ||
1815 | { | ||
1816 | object State = arg2; | ||
1817 | object PseudoCode = arg3; | ||
1818 | Variable A = new Variable(); | ||
1819 | Variable B = new Variable(); | ||
1820 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", A, B))) | ||
1821 | { | ||
1822 | if (YP.var(A)) | ||
1823 | { | ||
1824 | foreach (bool l4 in compileRuleBody(new Functor2(@",", new Functor1(@"call", A), B), State, PseudoCode)) | ||
1825 | { | 1883 | { |
1826 | yield return true; | 1884 | foreach (bool l5 in YP.unify(PseudoCode, new ListPair(new Functor2("foreach", ACode, BCode), Atom.NIL))) |
1827 | yield break; | 1885 | { |
1886 | yield return true; | ||
1887 | yield break; | ||
1888 | } | ||
1828 | } | 1889 | } |
1829 | } | 1890 | } |
1830 | } | 1891 | } |
@@ -1836,9 +1897,9 @@ namespace Temporary { | |||
1836 | Variable T = new Variable(); | 1897 | Variable T = new Variable(); |
1837 | Variable B = new Variable(); | 1898 | Variable B = new Variable(); |
1838 | Variable C = new Variable(); | 1899 | Variable C = new Variable(); |
1839 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor2(@";", new Functor2(@"->", A, T), B), C))) | 1900 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(";", new Functor2("->", A, T), B), C))) |
1840 | { | 1901 | { |
1841 | foreach (bool l3 in compileRuleBody(new Functor2(@";", new Functor2(@"->", A, new Functor2(@",", T, C)), new Functor2(@",", B, C)), State, PseudoCode)) | 1902 | foreach (bool l3 in compileRuleBody(new Functor2(";", new Functor2("->", A, new Functor2(",", T, C)), new Functor2(",", B, C)), State, PseudoCode)) |
1842 | { | 1903 | { |
1843 | yield return true; | 1904 | yield return true; |
1844 | yield break; | 1905 | yield break; |
@@ -1851,9 +1912,9 @@ namespace Temporary { | |||
1851 | Variable A = new Variable(); | 1912 | Variable A = new Variable(); |
1852 | Variable B = new Variable(); | 1913 | Variable B = new Variable(); |
1853 | Variable C = new Variable(); | 1914 | Variable C = new Variable(); |
1854 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor2(@";", A, B), C))) | 1915 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(";", A, B), C))) |
1855 | { | 1916 | { |
1856 | foreach (bool l3 in compileRuleBody(new Functor2(@";", new Functor2(@",", A, C), new Functor2(@",", B, C)), State, PseudoCode)) | 1917 | foreach (bool l3 in compileRuleBody(new Functor2(";", new Functor2(",", A, C), new Functor2(",", B, C)), State, PseudoCode)) |
1857 | { | 1918 | { |
1858 | yield return true; | 1919 | yield return true; |
1859 | yield break; | 1920 | yield break; |
@@ -1866,9 +1927,9 @@ namespace Temporary { | |||
1866 | Variable B = new Variable(); | 1927 | Variable B = new Variable(); |
1867 | Variable ACode = new Variable(); | 1928 | Variable ACode = new Variable(); |
1868 | Variable BCode = new Variable(); | 1929 | Variable BCode = new Variable(); |
1869 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"\+", A), B))) | 1930 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("\\+", A), B))) |
1870 | { | 1931 | { |
1871 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"if", new Functor1(@"not", ACode), BCode), Atom.NIL))) | 1932 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("if", new Functor1("not", ACode), BCode), Atom.NIL))) |
1872 | { | 1933 | { |
1873 | if (CompilerState.isSemidetNoneOut(State, A)) | 1934 | if (CompilerState.isSemidetNoneOut(State, A)) |
1874 | { | 1935 | { |
@@ -1889,9 +1950,9 @@ namespace Temporary { | |||
1889 | object PseudoCode = arg3; | 1950 | object PseudoCode = arg3; |
1890 | Variable A = new Variable(); | 1951 | Variable A = new Variable(); |
1891 | Variable B = new Variable(); | 1952 | Variable B = new Variable(); |
1892 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"\+", A), B))) | 1953 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("\\+", A), B))) |
1893 | { | 1954 | { |
1894 | foreach (bool l3 in compileRuleBody(new Functor2(@",", new Functor2(@";", new Functor2(@"->", A, Atom.a(@"fail")), Atom.a(@"true")), B), State, PseudoCode)) | 1955 | foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, Atom.a("fail")), Atom.a("true")), B), State, PseudoCode)) |
1895 | { | 1956 | { |
1896 | yield return true; | 1957 | yield return true; |
1897 | yield break; | 1958 | yield break; |
@@ -1903,9 +1964,9 @@ namespace Temporary { | |||
1903 | object PseudoCode = arg3; | 1964 | object PseudoCode = arg3; |
1904 | Variable A = new Variable(); | 1965 | Variable A = new Variable(); |
1905 | Variable B = new Variable(); | 1966 | Variable B = new Variable(); |
1906 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"once", A), B))) | 1967 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("once", A), B))) |
1907 | { | 1968 | { |
1908 | foreach (bool l3 in compileRuleBody(new Functor2(@",", new Functor2(@";", new Functor2(@"->", A, Atom.a(@"true")), Atom.a(@"fail")), B), State, PseudoCode)) | 1969 | foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, Atom.a("true")), Atom.a("fail")), B), State, PseudoCode)) |
1909 | { | 1970 | { |
1910 | yield return true; | 1971 | yield return true; |
1911 | yield break; | 1972 | yield break; |
@@ -1918,9 +1979,9 @@ namespace Temporary { | |||
1918 | Variable A = new Variable(); | 1979 | Variable A = new Variable(); |
1919 | Variable T = new Variable(); | 1980 | Variable T = new Variable(); |
1920 | Variable B = new Variable(); | 1981 | Variable B = new Variable(); |
1921 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor2(@"->", A, T), B))) | 1982 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("->", A, T), B))) |
1922 | { | 1983 | { |
1923 | foreach (bool l3 in compileRuleBody(new Functor2(@",", new Functor2(@";", new Functor2(@"->", A, T), Atom.a(@"fail")), B), State, PseudoCode)) | 1984 | foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, T), Atom.a("fail")), B), State, PseudoCode)) |
1924 | { | 1985 | { |
1925 | yield return true; | 1986 | yield return true; |
1926 | yield break; | 1987 | yield break; |
@@ -1933,9 +1994,9 @@ namespace Temporary { | |||
1933 | Variable A = new Variable(); | 1994 | Variable A = new Variable(); |
1934 | Variable B = new Variable(); | 1995 | Variable B = new Variable(); |
1935 | Variable C = new Variable(); | 1996 | Variable C = new Variable(); |
1936 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor2(@"\=", A, B), C))) | 1997 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("\\=", A, B), C))) |
1937 | { | 1998 | { |
1938 | foreach (bool l3 in compileRuleBody(new Functor2(@",", new Functor1(@"\+", new Functor2(@"=", A, B)), C), State, PseudoCode)) | 1999 | foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("\\+", new Functor2("=", A, B)), C), State, PseudoCode)) |
1939 | { | 2000 | { |
1940 | yield return true; | 2001 | yield return true; |
1941 | yield break; | 2002 | yield break; |
@@ -1947,11 +2008,11 @@ namespace Temporary { | |||
1947 | object PseudoCode = arg3; | 2008 | object PseudoCode = arg3; |
1948 | Variable A = new Variable(); | 2009 | Variable A = new Variable(); |
1949 | Variable ACode = new Variable(); | 2010 | Variable ACode = new Variable(); |
1950 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", Atom.a(@"!"), A))) | 2011 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("!"), A))) |
1951 | { | 2012 | { |
1952 | foreach (bool l3 in compileRuleBody(A, State, ACode)) | 2013 | foreach (bool l3 in compileRuleBody(A, State, ACode)) |
1953 | { | 2014 | { |
1954 | foreach (bool l4 in append(ACode, new ListPair(Atom.a(@"yieldbreak"), Atom.NIL), PseudoCode)) | 2015 | foreach (bool l4 in append(ACode, new ListPair(Atom.a("yieldbreak"), Atom.NIL), PseudoCode)) |
1955 | { | 2016 | { |
1956 | yield return true; | 2017 | yield return true; |
1957 | yield break; | 2018 | yield break; |
@@ -1965,11 +2026,11 @@ namespace Temporary { | |||
1965 | Variable Name = new Variable(); | 2026 | Variable Name = new Variable(); |
1966 | Variable A = new Variable(); | 2027 | Variable A = new Variable(); |
1967 | Variable ACode = new Variable(); | 2028 | Variable ACode = new Variable(); |
1968 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"$CUTIF", Name), A))) | 2029 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("$CUTIF", Name), A))) |
1969 | { | 2030 | { |
1970 | foreach (bool l3 in compileRuleBody(A, State, ACode)) | 2031 | foreach (bool l3 in compileRuleBody(A, State, ACode)) |
1971 | { | 2032 | { |
1972 | foreach (bool l4 in append(ACode, new ListPair(new Functor1(@"breakBlock", Name), Atom.NIL), PseudoCode)) | 2033 | foreach (bool l4 in append(ACode, new ListPair(new Functor1("breakBlock", Name), Atom.NIL), PseudoCode)) |
1973 | { | 2034 | { |
1974 | yield return true; | 2035 | yield return true; |
1975 | yield break; | 2036 | yield break; |
@@ -1980,7 +2041,7 @@ namespace Temporary { | |||
1980 | { | 2041 | { |
1981 | object _State = arg2; | 2042 | object _State = arg2; |
1982 | Variable x1 = new Variable(); | 2043 | Variable x1 = new Variable(); |
1983 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", Atom.a(@"fail"), x1))) | 2044 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("fail"), x1))) |
1984 | { | 2045 | { |
1985 | foreach (bool l3 in YP.unify(arg3, Atom.NIL)) | 2046 | foreach (bool l3 in YP.unify(arg3, Atom.NIL)) |
1986 | { | 2047 | { |
@@ -1993,7 +2054,7 @@ namespace Temporary { | |||
1993 | object State = arg2; | 2054 | object State = arg2; |
1994 | object PseudoCode = arg3; | 2055 | object PseudoCode = arg3; |
1995 | Variable A = new Variable(); | 2056 | Variable A = new Variable(); |
1996 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", Atom.a(@"true"), A))) | 2057 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("true"), A))) |
1997 | { | 2058 | { |
1998 | foreach (bool l3 in compileRuleBody(A, State, PseudoCode)) | 2059 | foreach (bool l3 in compileRuleBody(A, State, PseudoCode)) |
1999 | { | 2060 | { |
@@ -2010,9 +2071,9 @@ namespace Temporary { | |||
2010 | Variable ACode = new Variable(); | 2071 | Variable ACode = new Variable(); |
2011 | Variable TermCode = new Variable(); | 2072 | Variable TermCode = new Variable(); |
2012 | Variable BCode = new Variable(); | 2073 | Variable BCode = new Variable(); |
2013 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor2(@"is", A, Term), B))) | 2074 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("is", A, Term), B))) |
2014 | { | 2075 | { |
2015 | 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))) | 2076 | 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))) |
2016 | { | 2077 | { |
2017 | foreach (bool l4 in compileTerm(A, State, ACode)) | 2078 | foreach (bool l4 in compileTerm(A, State, ACode)) |
2018 | { | 2079 | { |
@@ -2030,58 +2091,10 @@ namespace Temporary { | |||
2030 | } | 2091 | } |
2031 | { | 2092 | { |
2032 | object State = arg2; | 2093 | object State = arg2; |
2033 | Variable A = new Variable(); | ||
2034 | Variable B = new Variable(); | ||
2035 | Variable ACode = new Variable(); | 2094 | Variable ACode = new Variable(); |
2036 | Variable BCode = new Variable(); | ||
2037 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", A, B))) | ||
2038 | { | ||
2039 | foreach (bool l3 in YP.unify(arg3, new ListPair(ACode, BCode))) | ||
2040 | { | ||
2041 | if (CompilerState.isDetNoneOut(State, A)) | ||
2042 | { | ||
2043 | foreach (bool l5 in compileFunctorCall(A, State, ACode)) | ||
2044 | { | ||
2045 | foreach (bool l6 in compileRuleBody(B, State, BCode)) | ||
2046 | { | ||
2047 | yield return true; | ||
2048 | yield break; | ||
2049 | } | ||
2050 | } | ||
2051 | } | ||
2052 | } | ||
2053 | } | ||
2054 | } | ||
2055 | { | ||
2056 | object State = arg2; | ||
2057 | Variable A = new Variable(); | ||
2058 | Variable B = new Variable(); | 2095 | Variable B = new Variable(); |
2059 | Variable ACode = new Variable(); | ||
2060 | Variable BCode = new Variable(); | 2096 | Variable BCode = new Variable(); |
2061 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", A, B))) | 2097 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("$DET_NONE_OUT", ACode), B))) |
2062 | { | ||
2063 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"if", ACode, BCode), Atom.NIL))) | ||
2064 | { | ||
2065 | if (CompilerState.isSemidetNoneOut(State, A)) | ||
2066 | { | ||
2067 | foreach (bool l5 in compileFunctorCall(A, State, ACode)) | ||
2068 | { | ||
2069 | foreach (bool l6 in compileRuleBody(B, State, BCode)) | ||
2070 | { | ||
2071 | yield return true; | ||
2072 | yield break; | ||
2073 | } | ||
2074 | } | ||
2075 | } | ||
2076 | } | ||
2077 | } | ||
2078 | } | ||
2079 | { | ||
2080 | object State = arg2; | ||
2081 | Variable ACode = new Variable(); | ||
2082 | Variable B = new Variable(); | ||
2083 | Variable BCode = new Variable(); | ||
2084 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"$DET_NONE_OUT", ACode), B))) | ||
2085 | { | 2098 | { |
2086 | foreach (bool l3 in YP.unify(arg3, new ListPair(ACode, BCode))) | 2099 | foreach (bool l3 in YP.unify(arg3, new ListPair(ACode, BCode))) |
2087 | { | 2100 | { |
@@ -2104,9 +2117,9 @@ namespace Temporary { | |||
2104 | Variable Name = new Variable(); | 2117 | Variable Name = new Variable(); |
2105 | Variable X1 = new Variable(); | 2118 | Variable X1 = new Variable(); |
2106 | Variable X2 = new Variable(); | 2119 | Variable X2 = new Variable(); |
2107 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", A, B))) | 2120 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B))) |
2108 | { | 2121 | { |
2109 | 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))) | 2122 | 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))) |
2110 | { | 2123 | { |
2111 | foreach (bool l4 in YP.univ(A, new ListPair(Name, new ListPair(X1, new ListPair(X2, Atom.NIL))))) | 2124 | foreach (bool l4 in YP.univ(A, new ListPair(Name, new ListPair(X1, new ListPair(X2, Atom.NIL))))) |
2112 | { | 2125 | { |
@@ -2131,21 +2144,6 @@ namespace Temporary { | |||
2131 | { | 2144 | { |
2132 | object State = arg2; | 2145 | object State = arg2; |
2133 | object PseudoCode = arg3; | 2146 | object PseudoCode = arg3; |
2134 | Variable A = new Variable(); | ||
2135 | Variable B = new Variable(); | ||
2136 | Variable C = new Variable(); | ||
2137 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor2(@",", A, B), C))) | ||
2138 | { | ||
2139 | foreach (bool l3 in compileRuleBody(new Functor2(@",", A, new Functor2(@",", B, C)), State, PseudoCode)) | ||
2140 | { | ||
2141 | yield return true; | ||
2142 | yield break; | ||
2143 | } | ||
2144 | } | ||
2145 | } | ||
2146 | { | ||
2147 | object State = arg2; | ||
2148 | object PseudoCode = arg3; | ||
2149 | Variable Template = new Variable(); | 2147 | Variable Template = new Variable(); |
2150 | Variable Goal = new Variable(); | 2148 | Variable Goal = new Variable(); |
2151 | Variable Bag = new Variable(); | 2149 | Variable Bag = new Variable(); |
@@ -2155,19 +2153,19 @@ namespace Temporary { | |||
2155 | Variable GoalAndAddCode = new Variable(); | 2153 | Variable GoalAndAddCode = new Variable(); |
2156 | Variable BagCode = new Variable(); | 2154 | Variable BagCode = new Variable(); |
2157 | Variable BCode = new Variable(); | 2155 | Variable BCode = new Variable(); |
2158 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor3(@"findall", Template, Goal, Bag), B))) | 2156 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("findall", Template, Goal, Bag), B))) |
2159 | { | 2157 | { |
2160 | foreach (bool l3 in compileTerm(Template, State, TemplateCode)) | 2158 | foreach (bool l3 in compileTerm(Template, State, TemplateCode)) |
2161 | { | 2159 | { |
2162 | foreach (bool l4 in CompilerState.gensym(State, Atom.a(@"findallAnswers"), FindallAnswers)) | 2160 | foreach (bool l4 in CompilerState.gensym(State, Atom.a("findallAnswers"), FindallAnswers)) |
2163 | { | 2161 | { |
2164 | 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)) | 2162 | 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)) |
2165 | { | 2163 | { |
2166 | foreach (bool l6 in compileTerm(Bag, State, BagCode)) | 2164 | foreach (bool l6 in compileTerm(Bag, State, BagCode)) |
2167 | { | 2165 | { |
2168 | foreach (bool l7 in compileRuleBody(B, State, BCode)) | 2166 | foreach (bool l7 in compileRuleBody(B, State, BCode)) |
2169 | { | 2167 | { |
2170 | 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)) | 2168 | 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)) |
2171 | { | 2169 | { |
2172 | yield return true; | 2170 | yield return true; |
2173 | yield break; | 2171 | yield break; |
@@ -2186,9 +2184,9 @@ namespace Temporary { | |||
2186 | Variable Goal = new Variable(); | 2184 | Variable Goal = new Variable(); |
2187 | Variable Bag = new Variable(); | 2185 | Variable Bag = new Variable(); |
2188 | Variable B = new Variable(); | 2186 | Variable B = new Variable(); |
2189 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor3(@"bagof", Template, Goal, Bag), B))) | 2187 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("bagof", Template, Goal, Bag), B))) |
2190 | { | 2188 | { |
2191 | foreach (bool l3 in compileBagof(Atom.a(@"result"), Template, Goal, Bag, B, State, PseudoCode)) | 2189 | foreach (bool l3 in compileBagof(Atom.a("result"), Template, Goal, Bag, B, State, PseudoCode)) |
2192 | { | 2190 | { |
2193 | yield return true; | 2191 | yield return true; |
2194 | yield break; | 2192 | yield break; |
@@ -2202,9 +2200,9 @@ namespace Temporary { | |||
2202 | Variable Goal = new Variable(); | 2200 | Variable Goal = new Variable(); |
2203 | Variable Bag = new Variable(); | 2201 | Variable Bag = new Variable(); |
2204 | Variable B = new Variable(); | 2202 | Variable B = new Variable(); |
2205 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor3(@"setof", Template, Goal, Bag), B))) | 2203 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("setof", Template, Goal, Bag), B))) |
2206 | { | 2204 | { |
2207 | foreach (bool l3 in compileBagof(Atom.a(@"resultSet"), Template, Goal, Bag, B, State, PseudoCode)) | 2205 | foreach (bool l3 in compileBagof(Atom.a("resultSet"), Template, Goal, Bag, B, State, PseudoCode)) |
2208 | { | 2206 | { |
2209 | yield return true; | 2207 | yield return true; |
2210 | yield break; | 2208 | yield break; |
@@ -2217,9 +2215,9 @@ namespace Temporary { | |||
2217 | Variable B = new Variable(); | 2215 | Variable B = new Variable(); |
2218 | Variable ATermCode = new Variable(); | 2216 | Variable ATermCode = new Variable(); |
2219 | Variable BCode = new Variable(); | 2217 | Variable BCode = new Variable(); |
2220 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"call", A), B))) | 2218 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("call", A), B))) |
2221 | { | 2219 | { |
2222 | 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))) | 2220 | 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))) |
2223 | { | 2221 | { |
2224 | foreach (bool l4 in compileTerm(A, State, ATermCode)) | 2222 | foreach (bool l4 in compileTerm(A, State, ATermCode)) |
2225 | { | 2223 | { |
@@ -2238,9 +2236,9 @@ namespace Temporary { | |||
2238 | Variable B = new Variable(); | 2236 | Variable B = new Variable(); |
2239 | Variable ATermCode = new Variable(); | 2237 | Variable ATermCode = new Variable(); |
2240 | Variable BCode = new Variable(); | 2238 | Variable BCode = new Variable(); |
2241 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"asserta", A), B))) | 2239 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("asserta", A), B))) |
2242 | { | 2240 | { |
2243 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"call", Atom.a(@"YP.asserta"), new ListPair(ATermCode, new ListPair(new Functor2(@"call", Atom.a(@"getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode))) | 2241 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.asserta"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode))) |
2244 | { | 2242 | { |
2245 | foreach (bool l4 in compileTerm(A, State, ATermCode)) | 2243 | foreach (bool l4 in compileTerm(A, State, ATermCode)) |
2246 | { | 2244 | { |
@@ -2259,9 +2257,9 @@ namespace Temporary { | |||
2259 | Variable B = new Variable(); | 2257 | Variable B = new Variable(); |
2260 | Variable ATermCode = new Variable(); | 2258 | Variable ATermCode = new Variable(); |
2261 | Variable BCode = new Variable(); | 2259 | Variable BCode = new Variable(); |
2262 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"assertz", A), B))) | 2260 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("assertz", A), B))) |
2263 | { | 2261 | { |
2264 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"call", Atom.a(@"YP.assertz"), new ListPair(ATermCode, new ListPair(new Functor2(@"call", Atom.a(@"getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode))) | 2262 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.assertz"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode))) |
2265 | { | 2263 | { |
2266 | foreach (bool l4 in compileTerm(A, State, ATermCode)) | 2264 | foreach (bool l4 in compileTerm(A, State, ATermCode)) |
2267 | { | 2265 | { |
@@ -2279,9 +2277,9 @@ namespace Temporary { | |||
2279 | object PseudoCode = arg3; | 2277 | object PseudoCode = arg3; |
2280 | Variable A = new Variable(); | 2278 | Variable A = new Variable(); |
2281 | Variable B = new Variable(); | 2279 | Variable B = new Variable(); |
2282 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor1(@"assert", A), B))) | 2280 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("assert", A), B))) |
2283 | { | 2281 | { |
2284 | foreach (bool l3 in compileRuleBody(new Functor2(@",", new Functor1(@"assertz", A), B), State, PseudoCode)) | 2282 | foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("assertz", A), B), State, PseudoCode)) |
2285 | { | 2283 | { |
2286 | yield return true; | 2284 | yield return true; |
2287 | yield break; | 2285 | yield break; |
@@ -2299,11 +2297,11 @@ namespace Temporary { | |||
2299 | Variable BCode = new Variable(); | 2297 | Variable BCode = new Variable(); |
2300 | Variable CatcherTermCode = new Variable(); | 2298 | Variable CatcherTermCode = new Variable(); |
2301 | Variable HandlerAndBCode = new Variable(); | 2299 | Variable HandlerAndBCode = new Variable(); |
2302 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", new Functor3(@"catch", Goal, Catcher, Handler), B))) | 2300 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("catch", Goal, Catcher, Handler), B))) |
2303 | { | 2301 | { |
2304 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor3(@"declare", Atom.a(@"YP.Catch"), CatchGoal, new Functor2(@"new", Atom.a(@"YP.Catch"), new ListPair(new Functor2(@"call", Atom.a(@"YP.getIterator"), new ListPair(GoalTermCode, new ListPair(new Functor2(@"call", Atom.a(@"getDeclaringClass"), Atom.NIL), Atom.NIL))), Atom.NIL))), new ListPair(new Functor2(@"foreach", new Functor1(@"var", CatchGoal), BCode), new ListPair(new Functor2(@"foreach", new Functor3(@"callMember", new Functor1(@"var", CatchGoal), Atom.a(@"unifyExceptionOrThrow"), new ListPair(CatcherTermCode, Atom.NIL)), HandlerAndBCode), Atom.NIL))))) | 2302 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor3("declare", Atom.a("YP.Catch"), CatchGoal, new Functor2("new", Atom.a("YP.Catch"), new ListPair(new Functor2("call", Atom.a("YP.getIterator"), new ListPair(GoalTermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), Atom.NIL))), new ListPair(new Functor2("foreach", new Functor1("var", CatchGoal), BCode), new ListPair(new Functor2("foreach", new Functor3("callMember", new Functor1("var", CatchGoal), Atom.a("unifyExceptionOrThrow"), new ListPair(CatcherTermCode, Atom.NIL)), HandlerAndBCode), Atom.NIL))))) |
2305 | { | 2303 | { |
2306 | foreach (bool l4 in CompilerState.gensym(State, Atom.a(@"catchGoal"), CatchGoal)) | 2304 | foreach (bool l4 in CompilerState.gensym(State, Atom.a("catchGoal"), CatchGoal)) |
2307 | { | 2305 | { |
2308 | foreach (bool l5 in compileTerm(Goal, State, GoalTermCode)) | 2306 | foreach (bool l5 in compileTerm(Goal, State, GoalTermCode)) |
2309 | { | 2307 | { |
@@ -2311,7 +2309,7 @@ namespace Temporary { | |||
2311 | { | 2309 | { |
2312 | foreach (bool l7 in compileRuleBody(B, State, BCode)) | 2310 | foreach (bool l7 in compileRuleBody(B, State, BCode)) |
2313 | { | 2311 | { |
2314 | foreach (bool l8 in compileRuleBody(new Functor2(@",", Handler, B), State, HandlerAndBCode)) | 2312 | foreach (bool l8 in compileRuleBody(new Functor2(",", Handler, B), State, HandlerAndBCode)) |
2315 | { | 2313 | { |
2316 | yield return true; | 2314 | yield return true; |
2317 | yield break; | 2315 | yield break; |
@@ -2325,22 +2323,16 @@ namespace Temporary { | |||
2325 | } | 2323 | } |
2326 | { | 2324 | { |
2327 | object State = arg2; | 2325 | object State = arg2; |
2326 | object PseudoCode = arg3; | ||
2328 | Variable A = new Variable(); | 2327 | Variable A = new Variable(); |
2329 | Variable B = new Variable(); | 2328 | Variable B = new Variable(); |
2330 | Variable ACode = new Variable(); | 2329 | Variable C = new Variable(); |
2331 | Variable BCode = new Variable(); | 2330 | foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(",", A, B), C))) |
2332 | foreach (bool l2 in YP.unify(arg1, new Functor2(@",", A, B))) | ||
2333 | { | 2331 | { |
2334 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"foreach", ACode, BCode), Atom.NIL))) | 2332 | foreach (bool l3 in compileRuleBody(new Functor2(",", A, new Functor2(",", B, C)), State, PseudoCode)) |
2335 | { | 2333 | { |
2336 | foreach (bool l4 in compileFunctorCall(A, State, ACode)) | 2334 | yield return true; |
2337 | { | 2335 | yield break; |
2338 | foreach (bool l5 in compileRuleBody(B, State, BCode)) | ||
2339 | { | ||
2340 | yield return true; | ||
2341 | yield break; | ||
2342 | } | ||
2343 | } | ||
2344 | } | 2336 | } |
2345 | } | 2337 | } |
2346 | } | 2338 | } |
@@ -2349,11 +2341,11 @@ namespace Temporary { | |||
2349 | object PseudoCode = arg3; | 2341 | object PseudoCode = arg3; |
2350 | Variable A = new Variable(); | 2342 | Variable A = new Variable(); |
2351 | Variable B = new Variable(); | 2343 | Variable B = new Variable(); |
2352 | foreach (bool l2 in YP.unify(arg1, new Functor2(@";", A, B))) | 2344 | foreach (bool l2 in YP.unify(arg1, new Functor2(";", A, B))) |
2353 | { | 2345 | { |
2354 | if (YP.var(A)) | 2346 | if (YP.var(A)) |
2355 | { | 2347 | { |
2356 | foreach (bool l4 in compileRuleBody(new Functor2(@";", new Functor1(@"call", A), B), State, PseudoCode)) | 2348 | foreach (bool l4 in compileRuleBody(new Functor2(";", new Functor1("call", A), B), State, PseudoCode)) |
2357 | { | 2349 | { |
2358 | yield return true; | 2350 | yield return true; |
2359 | yield break; | 2351 | yield break; |
@@ -2368,13 +2360,13 @@ namespace Temporary { | |||
2368 | Variable B = new Variable(); | 2360 | Variable B = new Variable(); |
2369 | Variable CutIfLabel = new Variable(); | 2361 | Variable CutIfLabel = new Variable(); |
2370 | Variable Code = new Variable(); | 2362 | Variable Code = new Variable(); |
2371 | foreach (bool l2 in YP.unify(arg1, new Functor2(@";", new Functor2(@"->", A, T), B))) | 2363 | foreach (bool l2 in YP.unify(arg1, new Functor2(";", new Functor2("->", A, T), B))) |
2372 | { | 2364 | { |
2373 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"breakableBlock", CutIfLabel, Code), Atom.NIL))) | 2365 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("breakableBlock", CutIfLabel, Code), Atom.NIL))) |
2374 | { | 2366 | { |
2375 | foreach (bool l4 in CompilerState.gensym(State, Atom.a(@"cutIf"), CutIfLabel)) | 2367 | foreach (bool l4 in CompilerState.gensym(State, Atom.a("cutIf"), CutIfLabel)) |
2376 | { | 2368 | { |
2377 | foreach (bool l5 in compileRuleBody(new Functor2(@";", new Functor2(@",", A, new Functor2(@",", new Functor1(@"$CUTIF", CutIfLabel), T)), B), State, Code)) | 2369 | foreach (bool l5 in compileRuleBody(new Functor2(";", new Functor2(",", A, new Functor2(",", new Functor1("$CUTIF", CutIfLabel), T)), B), State, Code)) |
2378 | { | 2370 | { |
2379 | yield return true; | 2371 | yield return true; |
2380 | yield break; | 2372 | yield break; |
@@ -2386,11 +2378,24 @@ namespace Temporary { | |||
2386 | { | 2378 | { |
2387 | object State = arg2; | 2379 | object State = arg2; |
2388 | object PseudoCode = arg3; | 2380 | object PseudoCode = arg3; |
2381 | Variable _B = new Variable(); | ||
2382 | foreach (bool l2 in YP.unify(arg1, new Functor2(";", Atom.a("!"), _B))) | ||
2383 | { | ||
2384 | foreach (bool l3 in compileRuleBody(Atom.a("!"), State, PseudoCode)) | ||
2385 | { | ||
2386 | yield return true; | ||
2387 | yield break; | ||
2388 | } | ||
2389 | } | ||
2390 | } | ||
2391 | { | ||
2392 | object State = arg2; | ||
2393 | object PseudoCode = arg3; | ||
2389 | Variable A = new Variable(); | 2394 | Variable A = new Variable(); |
2390 | Variable B = new Variable(); | 2395 | Variable B = new Variable(); |
2391 | Variable ACode = new Variable(); | 2396 | Variable ACode = new Variable(); |
2392 | Variable BCode = new Variable(); | 2397 | Variable BCode = new Variable(); |
2393 | foreach (bool l2 in YP.unify(arg1, new Functor2(@";", A, B))) | 2398 | foreach (bool l2 in YP.unify(arg1, new Functor2(";", A, B))) |
2394 | { | 2399 | { |
2395 | foreach (bool l3 in compileRuleBody(A, State, ACode)) | 2400 | foreach (bool l3 in compileRuleBody(A, State, ACode)) |
2396 | { | 2401 | { |
@@ -2406,10 +2411,102 @@ namespace Temporary { | |||
2406 | } | 2411 | } |
2407 | } | 2412 | } |
2408 | { | 2413 | { |
2414 | object State = arg2; | ||
2415 | foreach (bool l2 in YP.unify(arg1, Atom.a("!"))) | ||
2416 | { | ||
2417 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("return"), Atom.NIL))) | ||
2418 | { | ||
2419 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) | ||
2420 | { | ||
2421 | yield return true; | ||
2422 | yield break; | ||
2423 | } | ||
2424 | } | ||
2425 | } | ||
2426 | } | ||
2427 | { | ||
2428 | object State = arg2; | ||
2429 | foreach (bool l2 in YP.unify(arg1, Atom.a("!"))) | ||
2430 | { | ||
2431 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("returntrue"), Atom.NIL))) | ||
2432 | { | ||
2433 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) | ||
2434 | { | ||
2435 | yield return true; | ||
2436 | yield break; | ||
2437 | } | ||
2438 | } | ||
2439 | } | ||
2440 | } | ||
2441 | { | ||
2442 | object State = arg2; | ||
2443 | foreach (bool l2 in YP.unify(arg1, Atom.a("!"))) | ||
2444 | { | ||
2445 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("yieldtrue"), new ListPair(Atom.a("yieldbreak"), Atom.NIL)))) | ||
2446 | { | ||
2447 | CompilerState.setCodeUsesYield(State); | ||
2448 | yield return true; | ||
2449 | yield break; | ||
2450 | } | ||
2451 | } | ||
2452 | } | ||
2453 | { | ||
2454 | object _State = arg2; | ||
2455 | Variable Name = new Variable(); | ||
2456 | foreach (bool l2 in YP.unify(arg1, new Functor1("$CUTIF", Name))) | ||
2457 | { | ||
2458 | foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("breakBlock", Name), Atom.NIL))) | ||
2459 | { | ||
2460 | yield return true; | ||
2461 | yield break; | ||
2462 | } | ||
2463 | } | ||
2464 | } | ||
2465 | { | ||
2466 | object State = arg2; | ||
2467 | foreach (bool l2 in YP.unify(arg1, Atom.a("true"))) | ||
2468 | { | ||
2469 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("return"), Atom.NIL))) | ||
2470 | { | ||
2471 | if (CompilerState.determinismEquals(State, Atom.a("detNoneOut"))) | ||
2472 | { | ||
2473 | yield return true; | ||
2474 | yield break; | ||
2475 | } | ||
2476 | } | ||
2477 | } | ||
2478 | } | ||
2479 | { | ||
2480 | object State = arg2; | ||
2481 | foreach (bool l2 in YP.unify(arg1, Atom.a("true"))) | ||
2482 | { | ||
2483 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("returntrue"), Atom.NIL))) | ||
2484 | { | ||
2485 | if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut"))) | ||
2486 | { | ||
2487 | yield return true; | ||
2488 | yield break; | ||
2489 | } | ||
2490 | } | ||
2491 | } | ||
2492 | } | ||
2493 | { | ||
2494 | object State = arg2; | ||
2495 | foreach (bool l2 in YP.unify(arg1, Atom.a("true"))) | ||
2496 | { | ||
2497 | foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("yieldfalse"), Atom.NIL))) | ||
2498 | { | ||
2499 | CompilerState.setCodeUsesYield(State); | ||
2500 | yield return true; | ||
2501 | yield break; | ||
2502 | } | ||
2503 | } | ||
2504 | } | ||
2505 | { | ||
2409 | object A = arg1; | 2506 | object A = arg1; |
2410 | object State = arg2; | 2507 | object State = arg2; |
2411 | object PseudoCode = arg3; | 2508 | object PseudoCode = arg3; |
2412 | foreach (bool l2 in compileRuleBody(new Functor2(@",", A, Atom.a(@"true")), State, PseudoCode)) | 2509 | foreach (bool l2 in compileRuleBody(new Functor2(",", A, Atom.a("true")), State, PseudoCode)) |
2413 | { | 2510 | { |
2414 | yield return true; | 2511 | yield return true; |
2415 | yield break; | 2512 | yield break; |
@@ -2433,15 +2530,15 @@ namespace Temporary { | |||
2433 | { | 2530 | { |
2434 | foreach (bool l4 in unqualifiedGoal(Goal, UnqualifiedGoal)) | 2531 | foreach (bool l4 in unqualifiedGoal(Goal, UnqualifiedGoal)) |
2435 | { | 2532 | { |
2436 | foreach (bool l5 in CompilerState.gensym(State, Atom.a(@"bagofAnswers"), BagofAnswers)) | 2533 | foreach (bool l5 in CompilerState.gensym(State, Atom.a("bagofAnswers"), BagofAnswers)) |
2437 | { | 2534 | { |
2438 | 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)) | 2535 | 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)) |
2439 | { | 2536 | { |
2440 | foreach (bool l7 in compileTerm(Bag, State, BagCode)) | 2537 | foreach (bool l7 in compileTerm(Bag, State, BagCode)) |
2441 | { | 2538 | { |
2442 | foreach (bool l8 in compileRuleBody(B, State, BCode)) | 2539 | foreach (bool l8 in compileRuleBody(B, State, BCode)) |
2443 | { | 2540 | { |
2444 | 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)) | 2541 | 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)) |
2445 | { | 2542 | { |
2446 | yield return true; | 2543 | yield return true; |
2447 | yield break; | 2544 | yield break; |
@@ -2460,7 +2557,7 @@ namespace Temporary { | |||
2460 | { | 2557 | { |
2461 | { | 2558 | { |
2462 | object Goal = arg1; | 2559 | object Goal = arg1; |
2463 | foreach (bool l2 in YP.unify(arg2, new Functor1(@"call", Goal))) | 2560 | foreach (bool l2 in YP.unify(arg2, new Functor1("call", Goal))) |
2464 | { | 2561 | { |
2465 | if (YP.var(Goal)) | 2562 | if (YP.var(Goal)) |
2466 | { | 2563 | { |
@@ -2473,7 +2570,7 @@ namespace Temporary { | |||
2473 | object UnqualifiedGoal = arg2; | 2570 | object UnqualifiedGoal = arg2; |
2474 | Variable x1 = new Variable(); | 2571 | Variable x1 = new Variable(); |
2475 | Variable Goal = new Variable(); | 2572 | Variable Goal = new Variable(); |
2476 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"^", x1, Goal))) | 2573 | foreach (bool l2 in YP.unify(arg1, new Functor2("^", x1, Goal))) |
2477 | { | 2574 | { |
2478 | foreach (bool l3 in unqualifiedGoal(Goal, UnqualifiedGoal)) | 2575 | foreach (bool l3 in unqualifiedGoal(Goal, UnqualifiedGoal)) |
2479 | { | 2576 | { |
@@ -2498,9 +2595,9 @@ namespace Temporary { | |||
2498 | public static IEnumerable<bool> binaryExpressionConditional(object arg1, object arg2) | 2595 | public static IEnumerable<bool> binaryExpressionConditional(object arg1, object arg2) |
2499 | { | 2596 | { |
2500 | { | 2597 | { |
2501 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"=:="))) | 2598 | foreach (bool l2 in YP.unify(arg1, Atom.a("=:="))) |
2502 | { | 2599 | { |
2503 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.equal"))) | 2600 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.equal"))) |
2504 | { | 2601 | { |
2505 | yield return true; | 2602 | yield return true; |
2506 | yield break; | 2603 | yield break; |
@@ -2508,9 +2605,9 @@ namespace Temporary { | |||
2508 | } | 2605 | } |
2509 | } | 2606 | } |
2510 | { | 2607 | { |
2511 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"=\="))) | 2608 | foreach (bool l2 in YP.unify(arg1, Atom.a("=\\="))) |
2512 | { | 2609 | { |
2513 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.notEqual"))) | 2610 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.notEqual"))) |
2514 | { | 2611 | { |
2515 | yield return true; | 2612 | yield return true; |
2516 | yield break; | 2613 | yield break; |
@@ -2518,9 +2615,9 @@ namespace Temporary { | |||
2518 | } | 2615 | } |
2519 | } | 2616 | } |
2520 | { | 2617 | { |
2521 | foreach (bool l2 in YP.unify(arg1, Atom.a(@">"))) | 2618 | foreach (bool l2 in YP.unify(arg1, Atom.a(">"))) |
2522 | { | 2619 | { |
2523 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.greaterThan"))) | 2620 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.greaterThan"))) |
2524 | { | 2621 | { |
2525 | yield return true; | 2622 | yield return true; |
2526 | yield break; | 2623 | yield break; |
@@ -2528,9 +2625,9 @@ namespace Temporary { | |||
2528 | } | 2625 | } |
2529 | } | 2626 | } |
2530 | { | 2627 | { |
2531 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"<"))) | 2628 | foreach (bool l2 in YP.unify(arg1, Atom.a("<"))) |
2532 | { | 2629 | { |
2533 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.lessThan"))) | 2630 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.lessThan"))) |
2534 | { | 2631 | { |
2535 | yield return true; | 2632 | yield return true; |
2536 | yield break; | 2633 | yield break; |
@@ -2538,9 +2635,9 @@ namespace Temporary { | |||
2538 | } | 2635 | } |
2539 | } | 2636 | } |
2540 | { | 2637 | { |
2541 | foreach (bool l2 in YP.unify(arg1, Atom.a(@">="))) | 2638 | foreach (bool l2 in YP.unify(arg1, Atom.a(">="))) |
2542 | { | 2639 | { |
2543 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.greaterThanOrEqual"))) | 2640 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.greaterThanOrEqual"))) |
2544 | { | 2641 | { |
2545 | yield return true; | 2642 | yield return true; |
2546 | yield break; | 2643 | yield break; |
@@ -2548,9 +2645,9 @@ namespace Temporary { | |||
2548 | } | 2645 | } |
2549 | } | 2646 | } |
2550 | { | 2647 | { |
2551 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"=<"))) | 2648 | foreach (bool l2 in YP.unify(arg1, Atom.a("=<"))) |
2552 | { | 2649 | { |
2553 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.lessThanOrEqual"))) | 2650 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.lessThanOrEqual"))) |
2554 | { | 2651 | { |
2555 | yield return true; | 2652 | yield return true; |
2556 | yield break; | 2653 | yield break; |
@@ -2566,26 +2663,26 @@ namespace Temporary { | |||
2566 | Variable FunctorArgs = new Variable(); | 2663 | Variable FunctorArgs = new Variable(); |
2567 | Variable x6 = new Variable(); | 2664 | Variable x6 = new Variable(); |
2568 | Variable Arity = new Variable(); | 2665 | Variable Arity = new Variable(); |
2569 | Variable CompiledArgs = new Variable(); | ||
2570 | Variable FunctionName = new Variable(); | 2666 | Variable FunctionName = new Variable(); |
2667 | Variable CompiledArgs = new Variable(); | ||
2571 | foreach (bool l2 in YP.univ(Functor_1, new ListPair(FunctorName, FunctorArgs))) | 2668 | foreach (bool l2 in YP.univ(Functor_1, new ListPair(FunctorName, FunctorArgs))) |
2572 | { | 2669 | { |
2573 | foreach (bool l3 in YP.functor(Functor_1, x6, Arity)) | 2670 | foreach (bool l3 in YP.functor(Functor_1, x6, Arity)) |
2574 | { | 2671 | { |
2575 | foreach (bool l4 in maplist_compileTerm(FunctorArgs, State, CompiledArgs)) | 2672 | foreach (bool l4 in functorCallFunctionName(State, FunctorName, Arity, FunctionName)) |
2576 | { | 2673 | { |
2577 | foreach (bool l5 in functorCallFunctionName(State, FunctorName, Arity, FunctionName)) | 2674 | foreach (bool l5 in maplist_compileTerm(FunctorArgs, State, CompiledArgs)) |
2578 | { | 2675 | { |
2579 | if (YP.termEqual(FunctionName, Atom.NIL)) | 2676 | if (YP.termEqual(FunctionName, Atom.NIL)) |
2580 | { | 2677 | { |
2581 | foreach (bool l7 in YP.unify(PseudoCode, new Functor2(@"call", Atom.a(@"YP.matchDynamic"), new ListPair(new Functor2(@"call", Atom.a(@"Atom.a"), new ListPair(new Functor1(@"object", FunctorName), Atom.NIL)), new ListPair(new Functor1(@"objectArray", CompiledArgs), Atom.NIL))))) | 2678 | foreach (bool l7 in YP.unify(PseudoCode, new Functor2("call", Atom.a("YP.matchDynamic"), new ListPair(new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", FunctorName), Atom.NIL)), new ListPair(new Functor1("objectArray", CompiledArgs), Atom.NIL))))) |
2582 | { | 2679 | { |
2583 | yield return true; | 2680 | yield return true; |
2584 | yield break; | 2681 | yield break; |
2585 | } | 2682 | } |
2586 | goto cutIf1; | 2683 | goto cutIf1; |
2587 | } | 2684 | } |
2588 | foreach (bool l6 in YP.unify(PseudoCode, new Functor2(@"call", FunctionName, CompiledArgs))) | 2685 | foreach (bool l6 in YP.unify(PseudoCode, new Functor3("functorCall", FunctionName, FunctorArgs, CompiledArgs))) |
2589 | { | 2686 | { |
2590 | yield return true; | 2687 | yield return true; |
2591 | yield break; | 2688 | yield break; |
@@ -2602,6 +2699,16 @@ namespace Temporary { | |||
2602 | public static IEnumerable<bool> functorCallFunctionName(object arg1, object arg2, object arg3, object arg4) | 2699 | public static IEnumerable<bool> functorCallFunctionName(object arg1, object arg2, object arg3, object arg4) |
2603 | { | 2700 | { |
2604 | { | 2701 | { |
2702 | object _State = arg1; | ||
2703 | object Name = arg2; | ||
2704 | object Arity = arg3; | ||
2705 | object x4 = arg4; | ||
2706 | if (functorCallIsSpecialForm(Name, Arity)) | ||
2707 | { | ||
2708 | yield break; | ||
2709 | } | ||
2710 | } | ||
2711 | { | ||
2605 | object x1 = arg1; | 2712 | object x1 = arg1; |
2606 | object Name = arg2; | 2713 | object Name = arg2; |
2607 | object Arity = arg3; | 2714 | object Arity = arg3; |
@@ -2620,7 +2727,7 @@ namespace Temporary { | |||
2620 | { | 2727 | { |
2621 | foreach (bool l3 in YP.unify(arg4, Name)) | 2728 | foreach (bool l3 in YP.unify(arg4, Name)) |
2622 | { | 2729 | { |
2623 | if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a(@""))) | 2730 | if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a(""))) |
2624 | { | 2731 | { |
2625 | yield return true; | 2732 | yield return true; |
2626 | yield break; | 2733 | yield break; |
@@ -2636,7 +2743,7 @@ namespace Temporary { | |||
2636 | { | 2743 | { |
2637 | foreach (bool l3 in YP.unify(arg4, Name)) | 2744 | foreach (bool l3 in YP.unify(arg4, Name)) |
2638 | { | 2745 | { |
2639 | foreach (bool l4 in Atom.module(Name, Atom.a(@""))) | 2746 | foreach (bool l4 in Atom.module(Name, Atom.a(""))) |
2640 | { | 2747 | { |
2641 | yield return true; | 2748 | yield return true; |
2642 | yield break; | 2749 | yield break; |
@@ -2647,7 +2754,7 @@ namespace Temporary { | |||
2647 | { | 2754 | { |
2648 | object _State = arg1; | 2755 | object _State = arg1; |
2649 | object Name = arg2; | 2756 | object Name = arg2; |
2650 | object Arity = arg3; | 2757 | object _Arity = arg3; |
2651 | foreach (bool l2 in YP.unify(arg4, Atom.NIL)) | 2758 | foreach (bool l2 in YP.unify(arg4, Atom.NIL)) |
2652 | { | 2759 | { |
2653 | foreach (bool l3 in Atom.module(Name, Atom.NIL)) | 2760 | foreach (bool l3 in Atom.module(Name, Atom.NIL)) |
@@ -2666,33 +2773,137 @@ namespace Temporary { | |||
2666 | Variable Message = new Variable(); | 2773 | Variable Message = new Variable(); |
2667 | foreach (bool l2 in Atom.module(Name, Module)) | 2774 | foreach (bool l2 in Atom.module(Name, Module)) |
2668 | { | 2775 | { |
2669 | foreach (bool l3 in YP.atom_concat(Atom.a(@"Not supporting calls to external module: "), Module, Message)) | 2776 | foreach (bool l3 in YP.atom_concat(Atom.a("Not supporting calls to external module: "), Module, Message)) |
2670 | { | 2777 | { |
2671 | YP.throwException(new Functor2(@"error", new Functor2(@"type_error", Atom.a(@"callable"), new Functor2(@"/", Name, Arity)), Message)); | 2778 | YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("callable"), new Functor2("/", Name, Arity)), Message)); |
2672 | yield return true; | 2779 | yield return true; |
2673 | yield break; | 2780 | yield break; |
2674 | } | 2781 | } |
2675 | } | 2782 | } |
2676 | } | 2783 | } |
2677 | { | 2784 | { |
2678 | object _State = arg1; | 2785 | object _State = arg1; |
2679 | object Name = arg2; | 2786 | object Name = arg2; |
2680 | object _Arity = arg3; | 2787 | object _Arity = arg3; |
2681 | object x4 = arg4; | 2788 | object x4 = arg4; |
2682 | YP.throwException(new Functor2(@"error", new Functor2(@"type_error", Atom.a(@"callable"), Name), Atom.a(@"Term is not callable"))); | 2789 | YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("callable"), Name), Atom.a("Term is not callable"))); |
2683 | yield return true; | 2790 | yield return true; |
2684 | yield break; | 2791 | yield break; |
2685 | } | 2792 | } |
2686 | } | 2793 | } |
2687 | 2794 | ||
2795 | public static bool functorCallIsSpecialForm(object Name, object Arity) | ||
2796 | { | ||
2797 | { | ||
2798 | Variable x3 = new Variable(); | ||
2799 | if (YP.termEqual(Arity, 0)) | ||
2800 | { | ||
2801 | if (YP.termEqual(Name, Atom.a("!"))) | ||
2802 | { | ||
2803 | return true; | ||
2804 | } | ||
2805 | if (YP.termEqual(Name, Atom.a("fail"))) | ||
2806 | { | ||
2807 | return true; | ||
2808 | } | ||
2809 | if (YP.termEqual(Name, Atom.a("true"))) | ||
2810 | { | ||
2811 | return true; | ||
2812 | } | ||
2813 | } | ||
2814 | if (YP.termEqual(Arity, 1)) | ||
2815 | { | ||
2816 | if (YP.termEqual(Name, Atom.a("\\+"))) | ||
2817 | { | ||
2818 | return true; | ||
2819 | } | ||
2820 | if (YP.termEqual(Name, Atom.a("once"))) | ||
2821 | { | ||
2822 | return true; | ||
2823 | } | ||
2824 | if (YP.termEqual(Name, Atom.a("$CUTIF"))) | ||
2825 | { | ||
2826 | return true; | ||
2827 | } | ||
2828 | if (YP.termEqual(Name, Atom.a("$DET_NONE_OUT"))) | ||
2829 | { | ||
2830 | return true; | ||
2831 | } | ||
2832 | if (YP.termEqual(Name, Atom.a("call"))) | ||
2833 | { | ||
2834 | return true; | ||
2835 | } | ||
2836 | if (YP.termEqual(Name, Atom.a("asserta"))) | ||
2837 | { | ||
2838 | return true; | ||
2839 | } | ||
2840 | if (YP.termEqual(Name, Atom.a("assertz"))) | ||
2841 | { | ||
2842 | return true; | ||
2843 | } | ||
2844 | if (YP.termEqual(Name, Atom.a("assert"))) | ||
2845 | { | ||
2846 | return true; | ||
2847 | } | ||
2848 | } | ||
2849 | if (YP.termEqual(Arity, 2)) | ||
2850 | { | ||
2851 | if (YP.termEqual(Name, Atom.a(";"))) | ||
2852 | { | ||
2853 | return true; | ||
2854 | } | ||
2855 | if (YP.termEqual(Name, Atom.a(","))) | ||
2856 | { | ||
2857 | return true; | ||
2858 | } | ||
2859 | if (YP.termEqual(Name, Atom.a("->"))) | ||
2860 | { | ||
2861 | return true; | ||
2862 | } | ||
2863 | if (YP.termEqual(Name, Atom.a("\\="))) | ||
2864 | { | ||
2865 | return true; | ||
2866 | } | ||
2867 | if (YP.termEqual(Name, Atom.a("is"))) | ||
2868 | { | ||
2869 | return true; | ||
2870 | } | ||
2871 | foreach (bool l3 in binaryExpressionConditional(Name, x3)) | ||
2872 | { | ||
2873 | return true; | ||
2874 | } | ||
2875 | } | ||
2876 | if (YP.termEqual(Arity, 3)) | ||
2877 | { | ||
2878 | if (YP.termEqual(Name, Atom.a("findall"))) | ||
2879 | { | ||
2880 | return true; | ||
2881 | } | ||
2882 | if (YP.termEqual(Name, Atom.a("bagof"))) | ||
2883 | { | ||
2884 | return true; | ||
2885 | } | ||
2886 | if (YP.termEqual(Name, Atom.a("setof"))) | ||
2887 | { | ||
2888 | return true; | ||
2889 | } | ||
2890 | if (YP.termEqual(Name, Atom.a("catch"))) | ||
2891 | { | ||
2892 | return true; | ||
2893 | } | ||
2894 | } | ||
2895 | } | ||
2896 | return false; | ||
2897 | } | ||
2898 | |||
2688 | public static IEnumerable<bool> functorCallYPFunctionName(object arg1, object arg2, object arg3) | 2899 | public static IEnumerable<bool> functorCallYPFunctionName(object arg1, object arg2, object arg3) |
2689 | { | 2900 | { |
2690 | { | 2901 | { |
2691 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"="))) | 2902 | foreach (bool l2 in YP.unify(arg1, Atom.a("="))) |
2692 | { | 2903 | { |
2693 | foreach (bool l3 in YP.unify(arg2, 2)) | 2904 | foreach (bool l3 in YP.unify(arg2, 2)) |
2694 | { | 2905 | { |
2695 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.unify"))) | 2906 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.unify"))) |
2696 | { | 2907 | { |
2697 | yield return true; | 2908 | yield return true; |
2698 | yield break; | 2909 | yield break; |
@@ -2701,11 +2912,11 @@ namespace Temporary { | |||
2701 | } | 2912 | } |
2702 | } | 2913 | } |
2703 | { | 2914 | { |
2704 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"=.."))) | 2915 | foreach (bool l2 in YP.unify(arg1, Atom.a("=.."))) |
2705 | { | 2916 | { |
2706 | foreach (bool l3 in YP.unify(arg2, 2)) | 2917 | foreach (bool l3 in YP.unify(arg2, 2)) |
2707 | { | 2918 | { |
2708 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.univ"))) | 2919 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.univ"))) |
2709 | { | 2920 | { |
2710 | yield return true; | 2921 | yield return true; |
2711 | yield break; | 2922 | yield break; |
@@ -2714,11 +2925,11 @@ namespace Temporary { | |||
2714 | } | 2925 | } |
2715 | } | 2926 | } |
2716 | { | 2927 | { |
2717 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"var"))) | 2928 | foreach (bool l2 in YP.unify(arg1, Atom.a("var"))) |
2718 | { | 2929 | { |
2719 | foreach (bool l3 in YP.unify(arg2, 1)) | 2930 | foreach (bool l3 in YP.unify(arg2, 1)) |
2720 | { | 2931 | { |
2721 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.var"))) | 2932 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.var"))) |
2722 | { | 2933 | { |
2723 | yield return true; | 2934 | yield return true; |
2724 | yield break; | 2935 | yield break; |
@@ -2727,11 +2938,11 @@ namespace Temporary { | |||
2727 | } | 2938 | } |
2728 | } | 2939 | } |
2729 | { | 2940 | { |
2730 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"nonvar"))) | 2941 | foreach (bool l2 in YP.unify(arg1, Atom.a("nonvar"))) |
2731 | { | 2942 | { |
2732 | foreach (bool l3 in YP.unify(arg2, 1)) | 2943 | foreach (bool l3 in YP.unify(arg2, 1)) |
2733 | { | 2944 | { |
2734 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.nonvar"))) | 2945 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.nonvar"))) |
2735 | { | 2946 | { |
2736 | yield return true; | 2947 | yield return true; |
2737 | yield break; | 2948 | yield break; |
@@ -2740,11 +2951,11 @@ namespace Temporary { | |||
2740 | } | 2951 | } |
2741 | } | 2952 | } |
2742 | { | 2953 | { |
2743 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"arg"))) | 2954 | foreach (bool l2 in YP.unify(arg1, Atom.a("arg"))) |
2744 | { | 2955 | { |
2745 | foreach (bool l3 in YP.unify(arg2, 3)) | 2956 | foreach (bool l3 in YP.unify(arg2, 3)) |
2746 | { | 2957 | { |
2747 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.arg"))) | 2958 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.arg"))) |
2748 | { | 2959 | { |
2749 | yield return true; | 2960 | yield return true; |
2750 | yield break; | 2961 | yield break; |
@@ -2753,11 +2964,11 @@ namespace Temporary { | |||
2753 | } | 2964 | } |
2754 | } | 2965 | } |
2755 | { | 2966 | { |
2756 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"functor"))) | 2967 | foreach (bool l2 in YP.unify(arg1, Atom.a("functor"))) |
2757 | { | 2968 | { |
2758 | foreach (bool l3 in YP.unify(arg2, 3)) | 2969 | foreach (bool l3 in YP.unify(arg2, 3)) |
2759 | { | 2970 | { |
2760 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.functor"))) | 2971 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.functor"))) |
2761 | { | 2972 | { |
2762 | yield return true; | 2973 | yield return true; |
2763 | yield break; | 2974 | yield break; |
@@ -2766,11 +2977,11 @@ namespace Temporary { | |||
2766 | } | 2977 | } |
2767 | } | 2978 | } |
2768 | { | 2979 | { |
2769 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"repeat"))) | 2980 | foreach (bool l2 in YP.unify(arg1, Atom.a("repeat"))) |
2770 | { | 2981 | { |
2771 | foreach (bool l3 in YP.unify(arg2, 0)) | 2982 | foreach (bool l3 in YP.unify(arg2, 0)) |
2772 | { | 2983 | { |
2773 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.repeat"))) | 2984 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.repeat"))) |
2774 | { | 2985 | { |
2775 | yield return true; | 2986 | yield return true; |
2776 | yield break; | 2987 | yield break; |
@@ -2779,11 +2990,11 @@ namespace Temporary { | |||
2779 | } | 2990 | } |
2780 | } | 2991 | } |
2781 | { | 2992 | { |
2782 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"get_code"))) | 2993 | foreach (bool l2 in YP.unify(arg1, Atom.a("get_code"))) |
2783 | { | 2994 | { |
2784 | foreach (bool l3 in YP.unify(arg2, 1)) | 2995 | foreach (bool l3 in YP.unify(arg2, 1)) |
2785 | { | 2996 | { |
2786 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.get_code"))) | 2997 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.get_code"))) |
2787 | { | 2998 | { |
2788 | yield return true; | 2999 | yield return true; |
2789 | yield break; | 3000 | yield break; |
@@ -2792,11 +3003,11 @@ namespace Temporary { | |||
2792 | } | 3003 | } |
2793 | } | 3004 | } |
2794 | { | 3005 | { |
2795 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"current_op"))) | 3006 | foreach (bool l2 in YP.unify(arg1, Atom.a("current_op"))) |
2796 | { | 3007 | { |
2797 | foreach (bool l3 in YP.unify(arg2, 3)) | 3008 | foreach (bool l3 in YP.unify(arg2, 3)) |
2798 | { | 3009 | { |
2799 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.current_op"))) | 3010 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_op"))) |
2800 | { | 3011 | { |
2801 | yield return true; | 3012 | yield return true; |
2802 | yield break; | 3013 | yield break; |
@@ -2805,11 +3016,24 @@ namespace Temporary { | |||
2805 | } | 3016 | } |
2806 | } | 3017 | } |
2807 | { | 3018 | { |
2808 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"atom_length"))) | 3019 | foreach (bool l2 in YP.unify(arg1, Atom.a("current_predicate"))) |
3020 | { | ||
3021 | foreach (bool l3 in YP.unify(arg2, 1)) | ||
3022 | { | ||
3023 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_predicate"))) | ||
3024 | { | ||
3025 | yield return true; | ||
3026 | yield break; | ||
3027 | } | ||
3028 | } | ||
3029 | } | ||
3030 | } | ||
3031 | { | ||
3032 | foreach (bool l2 in YP.unify(arg1, Atom.a("atom_length"))) | ||
2809 | { | 3033 | { |
2810 | foreach (bool l3 in YP.unify(arg2, 2)) | 3034 | foreach (bool l3 in YP.unify(arg2, 2)) |
2811 | { | 3035 | { |
2812 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.atom_length"))) | 3036 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_length"))) |
2813 | { | 3037 | { |
2814 | yield return true; | 3038 | yield return true; |
2815 | yield break; | 3039 | yield break; |
@@ -2818,11 +3042,11 @@ namespace Temporary { | |||
2818 | } | 3042 | } |
2819 | } | 3043 | } |
2820 | { | 3044 | { |
2821 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"atom_concat"))) | 3045 | foreach (bool l2 in YP.unify(arg1, Atom.a("atom_concat"))) |
2822 | { | 3046 | { |
2823 | foreach (bool l3 in YP.unify(arg2, 3)) | 3047 | foreach (bool l3 in YP.unify(arg2, 3)) |
2824 | { | 3048 | { |
2825 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.atom_concat"))) | 3049 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_concat"))) |
2826 | { | 3050 | { |
2827 | yield return true; | 3051 | yield return true; |
2828 | yield break; | 3052 | yield break; |
@@ -2831,11 +3055,11 @@ namespace Temporary { | |||
2831 | } | 3055 | } |
2832 | } | 3056 | } |
2833 | { | 3057 | { |
2834 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"sub_atom"))) | 3058 | foreach (bool l2 in YP.unify(arg1, Atom.a("sub_atom"))) |
2835 | { | 3059 | { |
2836 | foreach (bool l3 in YP.unify(arg2, 5)) | 3060 | foreach (bool l3 in YP.unify(arg2, 5)) |
2837 | { | 3061 | { |
2838 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.sub_atom"))) | 3062 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.sub_atom"))) |
2839 | { | 3063 | { |
2840 | yield return true; | 3064 | yield return true; |
2841 | yield break; | 3065 | yield break; |
@@ -2844,11 +3068,11 @@ namespace Temporary { | |||
2844 | } | 3068 | } |
2845 | } | 3069 | } |
2846 | { | 3070 | { |
2847 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"atom_codes"))) | 3071 | foreach (bool l2 in YP.unify(arg1, Atom.a("atom_chars"))) |
2848 | { | 3072 | { |
2849 | foreach (bool l3 in YP.unify(arg2, 2)) | 3073 | foreach (bool l3 in YP.unify(arg2, 2)) |
2850 | { | 3074 | { |
2851 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.atom_codes"))) | 3075 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_chars"))) |
2852 | { | 3076 | { |
2853 | yield return true; | 3077 | yield return true; |
2854 | yield break; | 3078 | yield break; |
@@ -2857,11 +3081,11 @@ namespace Temporary { | |||
2857 | } | 3081 | } |
2858 | } | 3082 | } |
2859 | { | 3083 | { |
2860 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"number_codes"))) | 3084 | foreach (bool l2 in YP.unify(arg1, Atom.a("atom_codes"))) |
2861 | { | 3085 | { |
2862 | foreach (bool l3 in YP.unify(arg2, 2)) | 3086 | foreach (bool l3 in YP.unify(arg2, 2)) |
2863 | { | 3087 | { |
2864 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.number_codes"))) | 3088 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_codes"))) |
2865 | { | 3089 | { |
2866 | yield return true; | 3090 | yield return true; |
2867 | yield break; | 3091 | yield break; |
@@ -2870,11 +3094,11 @@ namespace Temporary { | |||
2870 | } | 3094 | } |
2871 | } | 3095 | } |
2872 | { | 3096 | { |
2873 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"copy_term"))) | 3097 | foreach (bool l2 in YP.unify(arg1, Atom.a("char_code"))) |
2874 | { | 3098 | { |
2875 | foreach (bool l3 in YP.unify(arg2, 2)) | 3099 | foreach (bool l3 in YP.unify(arg2, 2)) |
2876 | { | 3100 | { |
2877 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.copy_term"))) | 3101 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.char_code"))) |
2878 | { | 3102 | { |
2879 | yield return true; | 3103 | yield return true; |
2880 | yield break; | 3104 | yield break; |
@@ -2883,11 +3107,50 @@ namespace Temporary { | |||
2883 | } | 3107 | } |
2884 | } | 3108 | } |
2885 | { | 3109 | { |
2886 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"sort"))) | 3110 | foreach (bool l2 in YP.unify(arg1, Atom.a("number_chars"))) |
2887 | { | 3111 | { |
2888 | foreach (bool l3 in YP.unify(arg2, 2)) | 3112 | foreach (bool l3 in YP.unify(arg2, 2)) |
2889 | { | 3113 | { |
2890 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.sort"))) | 3114 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number_chars"))) |
3115 | { | ||
3116 | yield return true; | ||
3117 | yield break; | ||
3118 | } | ||
3119 | } | ||
3120 | } | ||
3121 | } | ||
3122 | { | ||
3123 | foreach (bool l2 in YP.unify(arg1, Atom.a("number_codes"))) | ||
3124 | { | ||
3125 | foreach (bool l3 in YP.unify(arg2, 2)) | ||
3126 | { | ||
3127 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number_codes"))) | ||
3128 | { | ||
3129 | yield return true; | ||
3130 | yield break; | ||
3131 | } | ||
3132 | } | ||
3133 | } | ||
3134 | } | ||
3135 | { | ||
3136 | foreach (bool l2 in YP.unify(arg1, Atom.a("copy_term"))) | ||
3137 | { | ||
3138 | foreach (bool l3 in YP.unify(arg2, 2)) | ||
3139 | { | ||
3140 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.copy_term"))) | ||
3141 | { | ||
3142 | yield return true; | ||
3143 | yield break; | ||
3144 | } | ||
3145 | } | ||
3146 | } | ||
3147 | } | ||
3148 | { | ||
3149 | foreach (bool l2 in YP.unify(arg1, Atom.a("sort"))) | ||
3150 | { | ||
3151 | foreach (bool l3 in YP.unify(arg2, 2)) | ||
3152 | { | ||
3153 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.sort"))) | ||
2891 | { | 3154 | { |
2892 | yield return true; | 3155 | yield return true; |
2893 | yield break; | 3156 | yield break; |
@@ -2912,11 +3175,24 @@ namespace Temporary { | |||
2912 | } | 3175 | } |
2913 | } | 3176 | } |
2914 | { | 3177 | { |
2915 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"nl"))) | 3178 | foreach (bool l2 in YP.unify(arg1, Atom.a("nl"))) |
2916 | { | 3179 | { |
2917 | foreach (bool l3 in YP.unify(arg2, 0)) | 3180 | foreach (bool l3 in YP.unify(arg2, 0)) |
2918 | { | 3181 | { |
2919 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.nl"))) | 3182 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.nl"))) |
3183 | { | ||
3184 | yield return true; | ||
3185 | yield break; | ||
3186 | } | ||
3187 | } | ||
3188 | } | ||
3189 | } | ||
3190 | { | ||
3191 | foreach (bool l2 in YP.unify(arg1, Atom.a("write"))) | ||
3192 | { | ||
3193 | foreach (bool l3 in YP.unify(arg2, 1)) | ||
3194 | { | ||
3195 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.write"))) | ||
2920 | { | 3196 | { |
2921 | yield return true; | 3197 | yield return true; |
2922 | yield break; | 3198 | yield break; |
@@ -2925,11 +3201,24 @@ namespace Temporary { | |||
2925 | } | 3201 | } |
2926 | } | 3202 | } |
2927 | { | 3203 | { |
2928 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"write"))) | 3204 | foreach (bool l2 in YP.unify(arg1, Atom.a("put_code"))) |
2929 | { | 3205 | { |
2930 | foreach (bool l3 in YP.unify(arg2, 1)) | 3206 | foreach (bool l3 in YP.unify(arg2, 1)) |
2931 | { | 3207 | { |
2932 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.write"))) | 3208 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.put_code"))) |
3209 | { | ||
3210 | yield return true; | ||
3211 | yield break; | ||
3212 | } | ||
3213 | } | ||
3214 | } | ||
3215 | } | ||
3216 | { | ||
3217 | foreach (bool l2 in YP.unify(arg1, Atom.a("clause"))) | ||
3218 | { | ||
3219 | foreach (bool l3 in YP.unify(arg2, 2)) | ||
3220 | { | ||
3221 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.clause"))) | ||
2933 | { | 3222 | { |
2934 | yield return true; | 3223 | yield return true; |
2935 | yield break; | 3224 | yield break; |
@@ -2938,11 +3227,11 @@ namespace Temporary { | |||
2938 | } | 3227 | } |
2939 | } | 3228 | } |
2940 | { | 3229 | { |
2941 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"put_code"))) | 3230 | foreach (bool l2 in YP.unify(arg1, Atom.a("retract"))) |
2942 | { | 3231 | { |
2943 | foreach (bool l3 in YP.unify(arg2, 1)) | 3232 | foreach (bool l3 in YP.unify(arg2, 1)) |
2944 | { | 3233 | { |
2945 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.put_code"))) | 3234 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.retract"))) |
2946 | { | 3235 | { |
2947 | yield return true; | 3236 | yield return true; |
2948 | yield break; | 3237 | yield break; |
@@ -2951,11 +3240,11 @@ namespace Temporary { | |||
2951 | } | 3240 | } |
2952 | } | 3241 | } |
2953 | { | 3242 | { |
2954 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"atom"))) | 3243 | foreach (bool l2 in YP.unify(arg1, Atom.a("abolish"))) |
2955 | { | 3244 | { |
2956 | foreach (bool l3 in YP.unify(arg2, 1)) | 3245 | foreach (bool l3 in YP.unify(arg2, 1)) |
2957 | { | 3246 | { |
2958 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.atom"))) | 3247 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.abolish"))) |
2959 | { | 3248 | { |
2960 | yield return true; | 3249 | yield return true; |
2961 | yield break; | 3250 | yield break; |
@@ -2964,11 +3253,11 @@ namespace Temporary { | |||
2964 | } | 3253 | } |
2965 | } | 3254 | } |
2966 | { | 3255 | { |
2967 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"integer"))) | 3256 | foreach (bool l2 in YP.unify(arg1, Atom.a("retractall"))) |
2968 | { | 3257 | { |
2969 | foreach (bool l3 in YP.unify(arg2, 1)) | 3258 | foreach (bool l3 in YP.unify(arg2, 1)) |
2970 | { | 3259 | { |
2971 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.integer"))) | 3260 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.retractall"))) |
2972 | { | 3261 | { |
2973 | yield return true; | 3262 | yield return true; |
2974 | yield break; | 3263 | yield break; |
@@ -2977,12 +3266,25 @@ namespace Temporary { | |||
2977 | } | 3266 | } |
2978 | } | 3267 | } |
2979 | { | 3268 | { |
2980 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"float"))) | 3269 | foreach (bool l2 in YP.unify(arg1, Atom.a("atom"))) |
2981 | { | 3270 | { |
2982 | foreach (bool l3 in YP.unify(arg2, 1)) | 3271 | foreach (bool l3 in YP.unify(arg2, 1)) |
2983 | { | 3272 | { |
2984 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.isFloat"))) | 3273 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom"))) |
3274 | { | ||
3275 | yield return true; | ||
3276 | yield break; | ||
3277 | } | ||
3278 | } | ||
3279 | } | ||
3280 | } | ||
3281 | { | ||
3282 | foreach (bool l2 in YP.unify(arg1, Atom.a("integer"))) | ||
2985 | { | 3283 | { |
3284 | foreach (bool l3 in YP.unify(arg2, 1)) | ||
3285 | { | ||
3286 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.integer"))) | ||
3287 | { | ||
2986 | yield return true; | 3288 | yield return true; |
2987 | yield break; | 3289 | yield break; |
2988 | } | 3290 | } |
@@ -2990,11 +3292,11 @@ namespace Temporary { | |||
2990 | } | 3292 | } |
2991 | } | 3293 | } |
2992 | { | 3294 | { |
2993 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"number"))) | 3295 | foreach (bool l2 in YP.unify(arg1, Atom.a("float"))) |
2994 | { | 3296 | { |
2995 | foreach (bool l3 in YP.unify(arg2, 1)) | 3297 | foreach (bool l3 in YP.unify(arg2, 1)) |
2996 | { | 3298 | { |
2997 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.number"))) | 3299 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.isFloat"))) |
2998 | { | 3300 | { |
2999 | yield return true; | 3301 | yield return true; |
3000 | yield break; | 3302 | yield break; |
@@ -3003,11 +3305,11 @@ namespace Temporary { | |||
3003 | } | 3305 | } |
3004 | } | 3306 | } |
3005 | { | 3307 | { |
3006 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"atomic"))) | 3308 | foreach (bool l2 in YP.unify(arg1, Atom.a("number"))) |
3007 | { | 3309 | { |
3008 | foreach (bool l3 in YP.unify(arg2, 1)) | 3310 | foreach (bool l3 in YP.unify(arg2, 1)) |
3009 | { | 3311 | { |
3010 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.atomic"))) | 3312 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number"))) |
3011 | { | 3313 | { |
3012 | yield return true; | 3314 | yield return true; |
3013 | yield break; | 3315 | yield break; |
@@ -3016,11 +3318,11 @@ namespace Temporary { | |||
3016 | } | 3318 | } |
3017 | } | 3319 | } |
3018 | { | 3320 | { |
3019 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"compound"))) | 3321 | foreach (bool l2 in YP.unify(arg1, Atom.a("atomic"))) |
3020 | { | 3322 | { |
3021 | foreach (bool l3 in YP.unify(arg2, 1)) | 3323 | foreach (bool l3 in YP.unify(arg2, 1)) |
3022 | { | 3324 | { |
3023 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.compound"))) | 3325 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atomic"))) |
3024 | { | 3326 | { |
3025 | yield return true; | 3327 | yield return true; |
3026 | yield break; | 3328 | yield break; |
@@ -3029,11 +3331,11 @@ namespace Temporary { | |||
3029 | } | 3331 | } |
3030 | } | 3332 | } |
3031 | { | 3333 | { |
3032 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"=="))) | 3334 | foreach (bool l2 in YP.unify(arg1, Atom.a("compound"))) |
3033 | { | 3335 | { |
3034 | foreach (bool l3 in YP.unify(arg2, 2)) | 3336 | foreach (bool l3 in YP.unify(arg2, 1)) |
3035 | { | 3337 | { |
3036 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.termEqual"))) | 3338 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.compound"))) |
3037 | { | 3339 | { |
3038 | yield return true; | 3340 | yield return true; |
3039 | yield break; | 3341 | yield break; |
@@ -3042,11 +3344,11 @@ namespace Temporary { | |||
3042 | } | 3344 | } |
3043 | } | 3345 | } |
3044 | { | 3346 | { |
3045 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"\=="))) | 3347 | foreach (bool l2 in YP.unify(arg1, Atom.a("=="))) |
3046 | { | 3348 | { |
3047 | foreach (bool l3 in YP.unify(arg2, 2)) | 3349 | foreach (bool l3 in YP.unify(arg2, 2)) |
3048 | { | 3350 | { |
3049 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.termNotEqual"))) | 3351 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termEqual"))) |
3050 | { | 3352 | { |
3051 | yield return true; | 3353 | yield return true; |
3052 | yield break; | 3354 | yield break; |
@@ -3055,11 +3357,11 @@ namespace Temporary { | |||
3055 | } | 3357 | } |
3056 | } | 3358 | } |
3057 | { | 3359 | { |
3058 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"@<"))) | 3360 | foreach (bool l2 in YP.unify(arg1, Atom.a("\\=="))) |
3059 | { | 3361 | { |
3060 | foreach (bool l3 in YP.unify(arg2, 2)) | 3362 | foreach (bool l3 in YP.unify(arg2, 2)) |
3061 | { | 3363 | { |
3062 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.termLessThan"))) | 3364 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termNotEqual"))) |
3063 | { | 3365 | { |
3064 | yield return true; | 3366 | yield return true; |
3065 | yield break; | 3367 | yield break; |
@@ -3068,11 +3370,11 @@ namespace Temporary { | |||
3068 | } | 3370 | } |
3069 | } | 3371 | } |
3070 | { | 3372 | { |
3071 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"@=<"))) | 3373 | foreach (bool l2 in YP.unify(arg1, Atom.a("@<"))) |
3072 | { | 3374 | { |
3073 | foreach (bool l3 in YP.unify(arg2, 2)) | 3375 | foreach (bool l3 in YP.unify(arg2, 2)) |
3074 | { | 3376 | { |
3075 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.termLessThanOrEqual"))) | 3377 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termLessThan"))) |
3076 | { | 3378 | { |
3077 | yield return true; | 3379 | yield return true; |
3078 | yield break; | 3380 | yield break; |
@@ -3081,11 +3383,11 @@ namespace Temporary { | |||
3081 | } | 3383 | } |
3082 | } | 3384 | } |
3083 | { | 3385 | { |
3084 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"@>"))) | 3386 | foreach (bool l2 in YP.unify(arg1, Atom.a("@=<"))) |
3085 | { | 3387 | { |
3086 | foreach (bool l3 in YP.unify(arg2, 2)) | 3388 | foreach (bool l3 in YP.unify(arg2, 2)) |
3087 | { | 3389 | { |
3088 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.termGreaterThan"))) | 3390 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termLessThanOrEqual"))) |
3089 | { | 3391 | { |
3090 | yield return true; | 3392 | yield return true; |
3091 | yield break; | 3393 | yield break; |
@@ -3094,32 +3396,45 @@ namespace Temporary { | |||
3094 | } | 3396 | } |
3095 | } | 3397 | } |
3096 | { | 3398 | { |
3097 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"@>="))) | 3399 | foreach (bool l2 in YP.unify(arg1, Atom.a("@>"))) |
3098 | { | 3400 | { |
3099 | foreach (bool l3 in YP.unify(arg2, 2)) | 3401 | foreach (bool l3 in YP.unify(arg2, 2)) |
3100 | { | 3402 | { |
3101 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.termGreaterThanOrEqual"))) | 3403 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termGreaterThan"))) |
3102 | { | 3404 | { |
3103 | yield return true; | 3405 | yield return true; |
3104 | yield break; | 3406 | yield break; |
3407 | } | ||
3408 | } | ||
3105 | } | 3409 | } |
3106 | } | 3410 | } |
3411 | { | ||
3412 | foreach (bool l2 in YP.unify(arg1, Atom.a("@>="))) | ||
3413 | { | ||
3414 | foreach (bool l3 in YP.unify(arg2, 2)) | ||
3415 | { | ||
3416 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termGreaterThanOrEqual"))) | ||
3417 | { | ||
3418 | yield return true; | ||
3419 | yield break; | ||
3420 | } | ||
3421 | } | ||
3107 | } | 3422 | } |
3108 | } | 3423 | } |
3109 | { | 3424 | { |
3110 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"throw"))) | 3425 | foreach (bool l2 in YP.unify(arg1, Atom.a("throw"))) |
3111 | { | 3426 | { |
3112 | foreach (bool l3 in YP.unify(arg2, 1)) | 3427 | foreach (bool l3 in YP.unify(arg2, 1)) |
3113 | { | ||
3114 | foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.throwException"))) | ||
3115 | { | 3428 | { |
3116 | yield return true; | 3429 | foreach (bool l4 in YP.unify(arg3, Atom.a("YP.throwException"))) |
3117 | yield break; | 3430 | { |
3431 | yield return true; | ||
3432 | yield break; | ||
3433 | } | ||
3118 | } | 3434 | } |
3119 | } | 3435 | } |
3120 | } | 3436 | } |
3121 | } | 3437 | } |
3122 | } | ||
3123 | 3438 | ||
3124 | public static IEnumerable<bool> compileTerm(object arg1, object arg2, object arg3) | 3439 | public static IEnumerable<bool> compileTerm(object arg1, object arg2, object arg3) |
3125 | { | 3440 | { |
@@ -3127,7 +3442,7 @@ namespace Temporary { | |||
3127 | object Term = arg1; | 3442 | object Term = arg1; |
3128 | object State = arg2; | 3443 | object State = arg2; |
3129 | Variable VariableName = new Variable(); | 3444 | Variable VariableName = new Variable(); |
3130 | foreach (bool l2 in YP.unify(arg3, new Functor1(@"var", VariableName))) | 3445 | foreach (bool l2 in YP.unify(arg3, new Functor1("var", VariableName))) |
3131 | { | 3446 | { |
3132 | if (YP.var(Term)) | 3447 | if (YP.var(Term)) |
3133 | { | 3448 | { |
@@ -3143,7 +3458,7 @@ namespace Temporary { | |||
3143 | object _State = arg2; | 3458 | object _State = arg2; |
3144 | foreach (bool l2 in YP.unify(arg1, Atom.NIL)) | 3459 | foreach (bool l2 in YP.unify(arg1, Atom.NIL)) |
3145 | { | 3460 | { |
3146 | foreach (bool l3 in YP.unify(arg3, new Functor1(@"var", Atom.a(@"Atom.NIL")))) | 3461 | foreach (bool l3 in YP.unify(arg3, new Functor1("var", Atom.a("Atom.NIL")))) |
3147 | { | 3462 | { |
3148 | yield return true; | 3463 | yield return true; |
3149 | yield break; | 3464 | yield break; |
@@ -3159,14 +3474,14 @@ namespace Temporary { | |||
3159 | { | 3474 | { |
3160 | foreach (bool l3 in compileAtomModule(Term, 0, State, ModuleCode)) | 3475 | foreach (bool l3 in compileAtomModule(Term, 0, State, ModuleCode)) |
3161 | { | 3476 | { |
3162 | 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))))) | 3477 | 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))))) |
3163 | { | 3478 | { |
3164 | yield return true; | 3479 | yield return true; |
3165 | yield break; | 3480 | yield break; |
3166 | } | 3481 | } |
3167 | goto cutIf1; | 3482 | goto cutIf1; |
3168 | } | 3483 | } |
3169 | foreach (bool l3 in YP.unify(Code, new Functor2(@"call", Atom.a(@"Atom.a"), new ListPair(new Functor1(@"object", Term), Atom.NIL)))) | 3484 | foreach (bool l3 in YP.unify(Code, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Term), Atom.NIL)))) |
3170 | { | 3485 | { |
3171 | yield return true; | 3486 | yield return true; |
3172 | yield break; | 3487 | yield break; |
@@ -3183,7 +3498,7 @@ namespace Temporary { | |||
3183 | Variable Arg2 = new Variable(); | 3498 | Variable Arg2 = new Variable(); |
3184 | foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest))) | 3499 | foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest))) |
3185 | { | 3500 | { |
3186 | foreach (bool l3 in YP.unify(arg3, new Functor2(@"new", Atom.a(@"ListPair"), new ListPair(Arg1, new ListPair(Arg2, Atom.NIL))))) | 3501 | foreach (bool l3 in YP.unify(arg3, new Functor2("new", Atom.a("ListPair"), new ListPair(Arg1, new ListPair(Arg2, Atom.NIL))))) |
3187 | { | 3502 | { |
3188 | foreach (bool l4 in compileTerm(First, State, Arg1)) | 3503 | foreach (bool l4 in compileTerm(First, State, Arg1)) |
3189 | { | 3504 | { |
@@ -3217,7 +3532,7 @@ namespace Temporary { | |||
3217 | { | 3532 | { |
3218 | if (YP.termEqual(TermArgs, Atom.NIL)) | 3533 | if (YP.termEqual(TermArgs, Atom.NIL)) |
3219 | { | 3534 | { |
3220 | foreach (bool l4 in YP.unify(Result, new Functor1(@"object", Name))) | 3535 | foreach (bool l4 in YP.unify(Result, new Functor1("object", Name))) |
3221 | { | 3536 | { |
3222 | yield return true; | 3537 | yield return true; |
3223 | yield break; | 3538 | yield break; |
@@ -3228,55 +3543,55 @@ namespace Temporary { | |||
3228 | { | 3543 | { |
3229 | foreach (bool l4 in compileAtomModule(Name, Arity, State, ModuleCode)) | 3544 | foreach (bool l4 in compileAtomModule(Name, Arity, State, ModuleCode)) |
3230 | { | 3545 | { |
3231 | 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))))) | 3546 | 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))))) |
3232 | { | 3547 | { |
3233 | foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL))) | 3548 | foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL))) |
3234 | { | 3549 | { |
3235 | foreach (bool l7 in compileTerm(X1, State, Arg1)) | 3550 | foreach (bool l7 in compileTerm(X1, State, Arg1)) |
3236 | { | 3551 | { |
3237 | foreach (bool l8 in YP.unify(Result, new Functor2(@"new", Atom.a(@"Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL))))) | 3552 | foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL))))) |
3238 | { | 3553 | { |
3239 | yield return true; | 3554 | yield return true; |
3240 | yield break; | 3555 | yield break; |
3241 | } | 3556 | } |
3242 | } | 3557 | } |
3243 | goto cutIf4; | 3558 | goto cutIf4; |
3244 | } | 3559 | } |
3245 | foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL)))) | 3560 | foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL)))) |
3246 | { | 3561 | { |
3247 | foreach (bool l7 in compileTerm(X1, State, Arg1)) | 3562 | foreach (bool l7 in compileTerm(X1, State, Arg1)) |
3248 | { | 3563 | { |
3249 | foreach (bool l8 in compileTerm(X2, State, Arg2)) | 3564 | foreach (bool l8 in compileTerm(X2, State, Arg2)) |
3250 | { | 3565 | { |
3251 | foreach (bool l9 in YP.unify(Result, new Functor2(@"new", Atom.a(@"Functor2"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))) | 3566 | foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))) |
3252 | { | 3567 | { |
3253 | yield return true; | 3568 | yield return true; |
3254 | yield break; | 3569 | yield break; |
3255 | } | 3570 | } |
3256 | } | 3571 | } |
3257 | } | 3572 | } |
3258 | goto cutIf5; | 3573 | goto cutIf5; |
3259 | } | 3574 | } |
3260 | foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, new ListPair(X3, Atom.NIL))))) | 3575 | foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, new ListPair(X3, Atom.NIL))))) |
3261 | { | 3576 | { |
3262 | foreach (bool l7 in compileTerm(X1, State, Arg1)) | 3577 | foreach (bool l7 in compileTerm(X1, State, Arg1)) |
3263 | { | 3578 | { |
3264 | foreach (bool l8 in compileTerm(X2, State, Arg2)) | 3579 | foreach (bool l8 in compileTerm(X2, State, Arg2)) |
3265 | { | 3580 | { |
3266 | foreach (bool l9 in compileTerm(X3, State, Arg3)) | 3581 | foreach (bool l9 in compileTerm(X3, State, Arg3)) |
3267 | { | 3582 | { |
3268 | 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))))))) | 3583 | 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))))))) |
3269 | { | 3584 | { |
3270 | yield return true; | 3585 | yield return true; |
3271 | yield break; | 3586 | yield break; |
3272 | } | 3587 | } |
3273 | } | 3588 | } |
3274 | } | 3589 | } |
3275 | } | 3590 | } |
3276 | } | 3591 | } |
3277 | foreach (bool l6 in maplist_compileTerm(TermArgs, State, Args)) | 3592 | foreach (bool l6 in maplist_compileTerm(TermArgs, State, Args)) |
3278 | { | 3593 | { |
3279 | foreach (bool l7 in YP.unify(Result, new Functor2(@"new", Atom.a(@"Functor"), new ListPair(NameCode, new ListPair(new Functor1(@"objectArray", Args), Atom.NIL))))) | 3594 | foreach (bool l7 in YP.unify(Result, new Functor2("new", Atom.a("Functor"), new ListPair(NameCode, new ListPair(new Functor1("objectArray", Args), Atom.NIL))))) |
3280 | { | 3595 | { |
3281 | yield return true; | 3596 | yield return true; |
3282 | yield break; | 3597 | yield break; |
@@ -3286,15 +3601,15 @@ namespace Temporary { | |||
3286 | cutIf4: | 3601 | cutIf4: |
3287 | { } | 3602 | { } |
3288 | } | 3603 | } |
3289 | goto cutIf3; | 3604 | goto cutIf3; |
3290 | } | 3605 | } |
3291 | foreach (bool l4 in YP.unify(NameCode, new Functor1(@"object", Name))) | 3606 | foreach (bool l4 in YP.unify(NameCode, new Functor1("object", Name))) |
3292 | { | 3607 | { |
3293 | foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL))) | 3608 | foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL))) |
3294 | { | 3609 | { |
3295 | foreach (bool l6 in compileTerm(X1, State, Arg1)) | 3610 | foreach (bool l6 in compileTerm(X1, State, Arg1)) |
3296 | { | 3611 | { |
3297 | foreach (bool l7 in YP.unify(Result, new Functor2(@"new", Atom.a(@"Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL))))) | 3612 | foreach (bool l7 in YP.unify(Result, new Functor2("new", Atom.a("Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL))))) |
3298 | { | 3613 | { |
3299 | yield return true; | 3614 | yield return true; |
3300 | yield break; | 3615 | yield break; |
@@ -3308,7 +3623,7 @@ namespace Temporary { | |||
3308 | { | 3623 | { |
3309 | foreach (bool l7 in compileTerm(X2, State, Arg2)) | 3624 | foreach (bool l7 in compileTerm(X2, State, Arg2)) |
3310 | { | 3625 | { |
3311 | foreach (bool l8 in YP.unify(Result, new Functor2(@"new", Atom.a(@"Functor2"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))) | 3626 | foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))) |
3312 | { | 3627 | { |
3313 | yield return true; | 3628 | yield return true; |
3314 | yield break; | 3629 | yield break; |
@@ -3320,33 +3635,33 @@ namespace Temporary { | |||
3320 | foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, new ListPair(X3, Atom.NIL))))) | 3635 | foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, new ListPair(X3, Atom.NIL))))) |
3321 | { | 3636 | { |
3322 | foreach (bool l6 in compileTerm(X1, State, Arg1)) | 3637 | foreach (bool l6 in compileTerm(X1, State, Arg1)) |
3323 | { | ||
3324 | foreach (bool l7 in compileTerm(X2, State, Arg2)) | ||
3325 | { | ||
3326 | foreach (bool l8 in compileTerm(X3, State, Arg3)) | ||
3327 | { | 3638 | { |
3328 | 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))))))) | 3639 | foreach (bool l7 in compileTerm(X2, State, Arg2)) |
3329 | { | 3640 | { |
3330 | yield return true; | 3641 | foreach (bool l8 in compileTerm(X3, State, Arg3)) |
3331 | yield break; | 3642 | { |
3643 | 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))))))) | ||
3644 | { | ||
3645 | yield return true; | ||
3646 | yield break; | ||
3647 | } | ||
3648 | } | ||
3332 | } | 3649 | } |
3333 | } | 3650 | } |
3334 | } | 3651 | } |
3335 | } | ||
3336 | } | ||
3337 | foreach (bool l5 in maplist_compileTerm(TermArgs, State, Args)) | 3652 | foreach (bool l5 in maplist_compileTerm(TermArgs, State, Args)) |
3338 | { | 3653 | { |
3339 | foreach (bool l6 in YP.unify(Result, new Functor2(@"new", Atom.a(@"Functor"), new ListPair(NameCode, new ListPair(new Functor1(@"objectArray", Args), Atom.NIL))))) | 3654 | foreach (bool l6 in YP.unify(Result, new Functor2("new", Atom.a("Functor"), new ListPair(NameCode, new ListPair(new Functor1("objectArray", Args), Atom.NIL))))) |
3340 | { | 3655 | { |
3341 | yield return true; | 3656 | yield return true; |
3342 | yield break; | 3657 | yield break; |
3343 | } | 3658 | } |
3344 | } | 3659 | } |
3345 | cutIf7: | 3660 | cutIf7: |
3346 | cutIf6: | 3661 | cutIf6: |
3347 | { } | 3662 | { } |
3348 | } | 3663 | } |
3349 | cutIf3: | 3664 | cutIf3: |
3350 | { } | 3665 | { } |
3351 | } | 3666 | } |
3352 | cutIf2: | 3667 | cutIf2: |
@@ -3355,18 +3670,36 @@ namespace Temporary { | |||
3355 | } | 3670 | } |
3356 | } | 3671 | } |
3357 | 3672 | ||
3358 | public static IEnumerable<bool> compileAtomModule(object Name, object Arity, object State, object ModuleCode) | 3673 | public static IEnumerable<bool> compileAtomModule(object Name, object arg2, object arg3, object ModuleCode) |
3359 | { | 3674 | { |
3360 | { | 3675 | { |
3361 | if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a(@""))) | 3676 | object Arity = arg2; |
3677 | object State = arg3; | ||
3678 | if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a(""))) | ||
3362 | { | 3679 | { |
3363 | foreach (bool l3 in YP.unify(ModuleCode, new Functor2(@"call", Atom.a(@"Atom.a"), new ListPair(new Functor1(@"object", Atom.a(@"")), Atom.NIL)))) | 3680 | foreach (bool l3 in YP.unify(ModuleCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Atom.a("")), Atom.NIL)))) |
3364 | { | 3681 | { |
3365 | yield return true; | 3682 | yield return true; |
3366 | yield break; | 3683 | yield break; |
3367 | } | 3684 | } |
3368 | } | 3685 | } |
3369 | } | 3686 | } |
3687 | { | ||
3688 | object _Arity = arg2; | ||
3689 | object _State = arg3; | ||
3690 | Variable Module = new Variable(); | ||
3691 | foreach (bool l2 in Atom.module(Name, Module)) | ||
3692 | { | ||
3693 | if (YP.termNotEqual(Module, Atom.NIL)) | ||
3694 | { | ||
3695 | foreach (bool l4 in YP.unify(ModuleCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Module), Atom.NIL)))) | ||
3696 | { | ||
3697 | yield return true; | ||
3698 | yield break; | ||
3699 | } | ||
3700 | } | ||
3701 | } | ||
3702 | } | ||
3370 | } | 3703 | } |
3371 | 3704 | ||
3372 | public static IEnumerable<bool> maplist_compileTerm(object arg1, object arg2, object arg3) | 3705 | public static IEnumerable<bool> maplist_compileTerm(object arg1, object arg2, object arg3) |
@@ -3430,7 +3763,7 @@ namespace Temporary { | |||
3430 | { | 3763 | { |
3431 | foreach (bool l7 in compileExpression(X1, State, Arg1)) | 3764 | foreach (bool l7 in compileExpression(X1, State, Arg1)) |
3432 | { | 3765 | { |
3433 | foreach (bool l8 in YP.unify(Result, new Functor2(@"call", FunctionName, new ListPair(Arg1, Atom.NIL)))) | 3766 | foreach (bool l8 in YP.unify(Result, new Functor2("call", FunctionName, new ListPair(Arg1, Atom.NIL)))) |
3434 | { | 3767 | { |
3435 | yield return true; | 3768 | yield return true; |
3436 | yield break; | 3769 | yield break; |
@@ -3456,7 +3789,7 @@ namespace Temporary { | |||
3456 | { | 3789 | { |
3457 | foreach (bool l8 in compileExpression(X2, State, Arg2)) | 3790 | foreach (bool l8 in compileExpression(X2, State, Arg2)) |
3458 | { | 3791 | { |
3459 | foreach (bool l9 in YP.unify(Result, new Functor2(@"call", FunctionName, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL))))) | 3792 | foreach (bool l9 in YP.unify(Result, new Functor2("call", FunctionName, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL))))) |
3460 | { | 3793 | { |
3461 | yield return true; | 3794 | yield return true; |
3462 | yield break; | 3795 | yield break; |
@@ -3468,8 +3801,8 @@ namespace Temporary { | |||
3468 | } | 3801 | } |
3469 | foreach (bool l5 in YP.functor(Term, x12, Arity)) | 3802 | foreach (bool l5 in YP.functor(Term, x12, Arity)) |
3470 | { | 3803 | { |
3471 | YP.throwException(new Functor2(@"error", new Functor2(@"type_error", Atom.a(@"evaluable"), new Functor2(@"/", Name, Arity)), Atom.a(@"Not an expression function"))); | 3804 | YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("evaluable"), new Functor2("/", Name, Arity)), Atom.a("Not an expression function"))); |
3472 | yield return false; | 3805 | yield return false; |
3473 | } | 3806 | } |
3474 | cutIf3: | 3807 | cutIf3: |
3475 | cutIf2: | 3808 | cutIf2: |
@@ -3491,9 +3824,9 @@ namespace Temporary { | |||
3491 | public static IEnumerable<bool> unaryFunction(object arg1, object arg2) | 3824 | public static IEnumerable<bool> unaryFunction(object arg1, object arg2) |
3492 | { | 3825 | { |
3493 | { | 3826 | { |
3494 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"-"))) | 3827 | foreach (bool l2 in YP.unify(arg1, Atom.a("-"))) |
3495 | { | 3828 | { |
3496 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.negate"))) | 3829 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.negate"))) |
3497 | { | 3830 | { |
3498 | yield return true; | 3831 | yield return true; |
3499 | yield break; | 3832 | yield break; |
@@ -3501,9 +3834,9 @@ namespace Temporary { | |||
3501 | } | 3834 | } |
3502 | } | 3835 | } |
3503 | { | 3836 | { |
3504 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"abs"))) | 3837 | foreach (bool l2 in YP.unify(arg1, Atom.a("abs"))) |
3505 | { | 3838 | { |
3506 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.abs"))) | 3839 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.abs"))) |
3507 | { | 3840 | { |
3508 | yield return true; | 3841 | yield return true; |
3509 | yield break; | 3842 | yield break; |
@@ -3511,9 +3844,9 @@ namespace Temporary { | |||
3511 | } | 3844 | } |
3512 | } | 3845 | } |
3513 | { | 3846 | { |
3514 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"sign"))) | 3847 | foreach (bool l2 in YP.unify(arg1, Atom.a("sign"))) |
3515 | { | 3848 | { |
3516 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.sign"))) | 3849 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sign"))) |
3517 | { | 3850 | { |
3518 | yield return true; | 3851 | yield return true; |
3519 | yield break; | 3852 | yield break; |
@@ -3521,9 +3854,9 @@ namespace Temporary { | |||
3521 | } | 3854 | } |
3522 | } | 3855 | } |
3523 | { | 3856 | { |
3524 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"floor"))) | 3857 | foreach (bool l2 in YP.unify(arg1, Atom.a("float"))) |
3525 | { | 3858 | { |
3526 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.floor"))) | 3859 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.toFloat"))) |
3527 | { | 3860 | { |
3528 | yield return true; | 3861 | yield return true; |
3529 | yield break; | 3862 | yield break; |
@@ -3531,9 +3864,9 @@ namespace Temporary { | |||
3531 | } | 3864 | } |
3532 | } | 3865 | } |
3533 | { | 3866 | { |
3534 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"truncate"))) | 3867 | foreach (bool l2 in YP.unify(arg1, Atom.a("floor"))) |
3535 | { | 3868 | { |
3536 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.truncate"))) | 3869 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.floor"))) |
3537 | { | 3870 | { |
3538 | yield return true; | 3871 | yield return true; |
3539 | yield break; | 3872 | yield break; |
@@ -3541,9 +3874,9 @@ namespace Temporary { | |||
3541 | } | 3874 | } |
3542 | } | 3875 | } |
3543 | { | 3876 | { |
3544 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"round"))) | 3877 | foreach (bool l2 in YP.unify(arg1, Atom.a("truncate"))) |
3545 | { | 3878 | { |
3546 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.round"))) | 3879 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.truncate"))) |
3547 | { | 3880 | { |
3548 | yield return true; | 3881 | yield return true; |
3549 | yield break; | 3882 | yield break; |
@@ -3551,9 +3884,9 @@ namespace Temporary { | |||
3551 | } | 3884 | } |
3552 | } | 3885 | } |
3553 | { | 3886 | { |
3554 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"floor"))) | 3887 | foreach (bool l2 in YP.unify(arg1, Atom.a("round"))) |
3555 | { | 3888 | { |
3556 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.ceiling"))) | 3889 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.round"))) |
3557 | { | 3890 | { |
3558 | yield return true; | 3891 | yield return true; |
3559 | yield break; | 3892 | yield break; |
@@ -3561,9 +3894,9 @@ namespace Temporary { | |||
3561 | } | 3894 | } |
3562 | } | 3895 | } |
3563 | { | 3896 | { |
3564 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"sin"))) | 3897 | foreach (bool l2 in YP.unify(arg1, Atom.a("ceiling"))) |
3565 | { | 3898 | { |
3566 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.sin"))) | 3899 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.ceiling"))) |
3567 | { | 3900 | { |
3568 | yield return true; | 3901 | yield return true; |
3569 | yield break; | 3902 | yield break; |
@@ -3571,9 +3904,9 @@ namespace Temporary { | |||
3571 | } | 3904 | } |
3572 | } | 3905 | } |
3573 | { | 3906 | { |
3574 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"cos"))) | 3907 | foreach (bool l2 in YP.unify(arg1, Atom.a("sin"))) |
3575 | { | 3908 | { |
3576 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.cos"))) | 3909 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sin"))) |
3577 | { | 3910 | { |
3578 | yield return true; | 3911 | yield return true; |
3579 | yield break; | 3912 | yield break; |
@@ -3581,9 +3914,9 @@ namespace Temporary { | |||
3581 | } | 3914 | } |
3582 | } | 3915 | } |
3583 | { | 3916 | { |
3584 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"atan"))) | 3917 | foreach (bool l2 in YP.unify(arg1, Atom.a("cos"))) |
3585 | { | 3918 | { |
3586 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.atan"))) | 3919 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.cos"))) |
3587 | { | 3920 | { |
3588 | yield return true; | 3921 | yield return true; |
3589 | yield break; | 3922 | yield break; |
@@ -3591,9 +3924,9 @@ namespace Temporary { | |||
3591 | } | 3924 | } |
3592 | } | 3925 | } |
3593 | { | 3926 | { |
3594 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"exp"))) | 3927 | foreach (bool l2 in YP.unify(arg1, Atom.a("atan"))) |
3595 | { | 3928 | { |
3596 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.exp"))) | 3929 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.atan"))) |
3597 | { | 3930 | { |
3598 | yield return true; | 3931 | yield return true; |
3599 | yield break; | 3932 | yield break; |
@@ -3601,9 +3934,9 @@ namespace Temporary { | |||
3601 | } | 3934 | } |
3602 | } | 3935 | } |
3603 | { | 3936 | { |
3604 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"log"))) | 3937 | foreach (bool l2 in YP.unify(arg1, Atom.a("exp"))) |
3605 | { | 3938 | { |
3606 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.log"))) | 3939 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.exp"))) |
3607 | { | 3940 | { |
3608 | yield return true; | 3941 | yield return true; |
3609 | yield break; | 3942 | yield break; |
@@ -3611,9 +3944,9 @@ namespace Temporary { | |||
3611 | } | 3944 | } |
3612 | } | 3945 | } |
3613 | { | 3946 | { |
3614 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"sqrt"))) | 3947 | foreach (bool l2 in YP.unify(arg1, Atom.a("log"))) |
3615 | { | 3948 | { |
3616 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.sqrt"))) | 3949 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.log"))) |
3617 | { | 3950 | { |
3618 | yield return true; | 3951 | yield return true; |
3619 | yield break; | 3952 | yield break; |
@@ -3621,9 +3954,19 @@ namespace Temporary { | |||
3621 | } | 3954 | } |
3622 | } | 3955 | } |
3623 | { | 3956 | { |
3624 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"\"))) | 3957 | foreach (bool l2 in YP.unify(arg1, Atom.a("sqrt"))) |
3625 | { | 3958 | { |
3626 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.bitwiseComplement"))) | 3959 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sqrt"))) |
3960 | { | ||
3961 | yield return true; | ||
3962 | yield break; | ||
3963 | } | ||
3964 | } | ||
3965 | } | ||
3966 | { | ||
3967 | foreach (bool l2 in YP.unify(arg1, Atom.a("\\"))) | ||
3968 | { | ||
3969 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseComplement"))) | ||
3627 | { | 3970 | { |
3628 | yield return true; | 3971 | yield return true; |
3629 | yield break; | 3972 | yield break; |
@@ -3635,9 +3978,9 @@ namespace Temporary { | |||
3635 | public static IEnumerable<bool> binaryFunction(object arg1, object arg2) | 3978 | public static IEnumerable<bool> binaryFunction(object arg1, object arg2) |
3636 | { | 3979 | { |
3637 | { | 3980 | { |
3638 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"+"))) | 3981 | foreach (bool l2 in YP.unify(arg1, Atom.a("+"))) |
3639 | { | 3982 | { |
3640 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.add"))) | 3983 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.add"))) |
3641 | { | 3984 | { |
3642 | yield return true; | 3985 | yield return true; |
3643 | yield break; | 3986 | yield break; |
@@ -3645,9 +3988,9 @@ namespace Temporary { | |||
3645 | } | 3988 | } |
3646 | } | 3989 | } |
3647 | { | 3990 | { |
3648 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"-"))) | 3991 | foreach (bool l2 in YP.unify(arg1, Atom.a("-"))) |
3649 | { | 3992 | { |
3650 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.subtract"))) | 3993 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.subtract"))) |
3651 | { | 3994 | { |
3652 | yield return true; | 3995 | yield return true; |
3653 | yield break; | 3996 | yield break; |
@@ -3655,9 +3998,9 @@ namespace Temporary { | |||
3655 | } | 3998 | } |
3656 | } | 3999 | } |
3657 | { | 4000 | { |
3658 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"*"))) | 4001 | foreach (bool l2 in YP.unify(arg1, Atom.a("*"))) |
3659 | { | 4002 | { |
3660 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.multiply"))) | 4003 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.multiply"))) |
3661 | { | 4004 | { |
3662 | yield return true; | 4005 | yield return true; |
3663 | yield break; | 4006 | yield break; |
@@ -3665,9 +4008,9 @@ namespace Temporary { | |||
3665 | } | 4008 | } |
3666 | } | 4009 | } |
3667 | { | 4010 | { |
3668 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"/"))) | 4011 | foreach (bool l2 in YP.unify(arg1, Atom.a("/"))) |
3669 | { | 4012 | { |
3670 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.divide"))) | 4013 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.divide"))) |
3671 | { | 4014 | { |
3672 | yield return true; | 4015 | yield return true; |
3673 | yield break; | 4016 | yield break; |
@@ -3675,9 +4018,9 @@ namespace Temporary { | |||
3675 | } | 4018 | } |
3676 | } | 4019 | } |
3677 | { | 4020 | { |
3678 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"//"))) | 4021 | foreach (bool l2 in YP.unify(arg1, Atom.a("//"))) |
3679 | { | 4022 | { |
3680 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.intDivide"))) | 4023 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.intDivide"))) |
3681 | { | 4024 | { |
3682 | yield return true; | 4025 | yield return true; |
3683 | yield break; | 4026 | yield break; |
@@ -3685,9 +4028,9 @@ namespace Temporary { | |||
3685 | } | 4028 | } |
3686 | } | 4029 | } |
3687 | { | 4030 | { |
3688 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"mod"))) | 4031 | foreach (bool l2 in YP.unify(arg1, Atom.a("mod"))) |
3689 | { | 4032 | { |
3690 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.mod"))) | 4033 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.mod"))) |
3691 | { | 4034 | { |
3692 | yield return true; | 4035 | yield return true; |
3693 | yield break; | 4036 | yield break; |
@@ -3695,9 +4038,9 @@ namespace Temporary { | |||
3695 | } | 4038 | } |
3696 | } | 4039 | } |
3697 | { | 4040 | { |
3698 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"**"))) | 4041 | foreach (bool l2 in YP.unify(arg1, Atom.a("**"))) |
3699 | { | 4042 | { |
3700 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.pow"))) | 4043 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.pow"))) |
3701 | { | 4044 | { |
3702 | yield return true; | 4045 | yield return true; |
3703 | yield break; | 4046 | yield break; |
@@ -3705,9 +4048,9 @@ namespace Temporary { | |||
3705 | } | 4048 | } |
3706 | } | 4049 | } |
3707 | { | 4050 | { |
3708 | foreach (bool l2 in YP.unify(arg1, Atom.a(@">>"))) | 4051 | foreach (bool l2 in YP.unify(arg1, Atom.a(">>"))) |
3709 | { | 4052 | { |
3710 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.bitwiseShiftRight"))) | 4053 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseShiftRight"))) |
3711 | { | 4054 | { |
3712 | yield return true; | 4055 | yield return true; |
3713 | yield break; | 4056 | yield break; |
@@ -3715,9 +4058,9 @@ namespace Temporary { | |||
3715 | } | 4058 | } |
3716 | } | 4059 | } |
3717 | { | 4060 | { |
3718 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"<<"))) | 4061 | foreach (bool l2 in YP.unify(arg1, Atom.a("<<"))) |
3719 | { | 4062 | { |
3720 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.bitwiseShiftLeft"))) | 4063 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseShiftLeft"))) |
3721 | { | 4064 | { |
3722 | yield return true; | 4065 | yield return true; |
3723 | yield break; | 4066 | yield break; |
@@ -3725,9 +4068,9 @@ namespace Temporary { | |||
3725 | } | 4068 | } |
3726 | } | 4069 | } |
3727 | { | 4070 | { |
3728 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"/\"))) | 4071 | foreach (bool l2 in YP.unify(arg1, Atom.a("/\\"))) |
3729 | { | 4072 | { |
3730 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.bitwiseAnd"))) | 4073 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseAnd"))) |
3731 | { | 4074 | { |
3732 | yield return true; | 4075 | yield return true; |
3733 | yield break; | 4076 | yield break; |
@@ -3735,9 +4078,9 @@ namespace Temporary { | |||
3735 | } | 4078 | } |
3736 | } | 4079 | } |
3737 | { | 4080 | { |
3738 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"\/"))) | 4081 | foreach (bool l2 in YP.unify(arg1, Atom.a("\\/"))) |
3739 | { | 4082 | { |
3740 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.bitwiseOr"))) | 4083 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseOr"))) |
3741 | { | 4084 | { |
3742 | yield return true; | 4085 | yield return true; |
3743 | yield break; | 4086 | yield break; |
@@ -3745,9 +4088,9 @@ namespace Temporary { | |||
3745 | } | 4088 | } |
3746 | } | 4089 | } |
3747 | { | 4090 | { |
3748 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"min"))) | 4091 | foreach (bool l2 in YP.unify(arg1, Atom.a("min"))) |
3749 | { | 4092 | { |
3750 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.min"))) | 4093 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.min"))) |
3751 | { | 4094 | { |
3752 | yield return true; | 4095 | yield return true; |
3753 | yield break; | 4096 | yield break; |
@@ -3755,9 +4098,9 @@ namespace Temporary { | |||
3755 | } | 4098 | } |
3756 | } | 4099 | } |
3757 | { | 4100 | { |
3758 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"max"))) | 4101 | foreach (bool l2 in YP.unify(arg1, Atom.a("max"))) |
3759 | { | 4102 | { |
3760 | foreach (bool l3 in YP.unify(arg2, Atom.a(@"YP.max"))) | 4103 | foreach (bool l3 in YP.unify(arg2, Atom.a("YP.max"))) |
3761 | { | 4104 | { |
3762 | yield return true; | 4105 | yield return true; |
3763 | yield break; | 4106 | yield break; |
@@ -3769,11 +4112,11 @@ namespace Temporary { | |||
3769 | public static void convertFunctionCSharp(object arg1) | 4112 | public static void convertFunctionCSharp(object arg1) |
3770 | { | 4113 | { |
3771 | { | 4114 | { |
3772 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"getDeclaringClass"))) | 4115 | foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass"))) |
3773 | { | 4116 | { |
3774 | YP.write(Atom.a(@"public class YPInnerClass {}")); | 4117 | YP.write(Atom.a("public class YPInnerClass {}")); |
3775 | YP.nl(); | 4118 | YP.nl(); |
3776 | YP.write(Atom.a(@"public static System.Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }")); | 4119 | YP.write(Atom.a("public static System.Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }")); |
3777 | YP.nl(); | 4120 | YP.nl(); |
3778 | YP.nl(); | 4121 | YP.nl(); |
3779 | return; | 4122 | return; |
@@ -3785,20 +4128,20 @@ namespace Temporary { | |||
3785 | Variable ArgList = new Variable(); | 4128 | Variable ArgList = new Variable(); |
3786 | Variable Body = new Variable(); | 4129 | Variable Body = new Variable(); |
3787 | Variable Level = new Variable(); | 4130 | Variable Level = new Variable(); |
3788 | foreach (bool l2 in YP.unify(arg1, new Functor(@"function", new object[] { ReturnType, Name, ArgList, Body }))) | 4131 | foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { ReturnType, Name, ArgList, Body }))) |
3789 | { | 4132 | { |
3790 | YP.write(Atom.a(@"public static ")); | 4133 | YP.write(Atom.a("public static ")); |
3791 | YP.write(ReturnType); | 4134 | YP.write(ReturnType); |
3792 | YP.write(Atom.a(@" ")); | 4135 | YP.write(Atom.a(" ")); |
3793 | YP.write(Name); | 4136 | YP.write(Name); |
3794 | YP.write(Atom.a(@"(")); | 4137 | YP.write(Atom.a("(")); |
3795 | convertArgListCSharp(ArgList); | 4138 | convertArgListCSharp(ArgList); |
3796 | YP.write(Atom.a(@") {")); | 4139 | YP.write(Atom.a(") {")); |
3797 | YP.nl(); | 4140 | YP.nl(); |
3798 | foreach (bool l3 in YP.unify(Level, 1)) | 4141 | foreach (bool l3 in YP.unify(Level, 1)) |
3799 | { | 4142 | { |
3800 | convertStatementListCSharp(Body, Level); | 4143 | convertStatementListCSharp(Body, Level); |
3801 | YP.write(Atom.a(@"}")); | 4144 | YP.write(Atom.a("}")); |
3802 | YP.nl(); | 4145 | YP.nl(); |
3803 | YP.nl(); | 4146 | YP.nl(); |
3804 | return; | 4147 | return; |
@@ -3825,9 +4168,9 @@ namespace Temporary { | |||
3825 | Variable Body = new Variable(); | 4168 | Variable Body = new Variable(); |
3826 | Variable RestStatements = new Variable(); | 4169 | Variable RestStatements = new Variable(); |
3827 | Variable NewStatements = new Variable(); | 4170 | Variable NewStatements = new Variable(); |
3828 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"breakableBlock", Name, Body), RestStatements))) | 4171 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements))) |
3829 | { | 4172 | { |
3830 | foreach (bool l3 in append(Body, new ListPair(new Functor1(@"label", Name), RestStatements), NewStatements)) | 4173 | foreach (bool l3 in append(Body, new ListPair(new Functor1("label", Name), RestStatements), NewStatements)) |
3831 | { | 4174 | { |
3832 | convertStatementListCSharp(NewStatements, Level); | 4175 | convertStatementListCSharp(NewStatements, Level); |
3833 | return; | 4176 | return; |
@@ -3839,15 +4182,15 @@ namespace Temporary { | |||
3839 | Variable Name = new Variable(); | 4182 | Variable Name = new Variable(); |
3840 | Variable Expression = new Variable(); | 4183 | Variable Expression = new Variable(); |
3841 | Variable RestStatements = new Variable(); | 4184 | Variable RestStatements = new Variable(); |
3842 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3(@"declare", Type, Name, Expression), RestStatements))) | 4185 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", Type, Name, Expression), RestStatements))) |
3843 | { | 4186 | { |
3844 | convertIndentationCSharp(Level); | 4187 | convertIndentationCSharp(Level); |
3845 | YP.write(Type); | 4188 | YP.write(Type); |
3846 | YP.write(Atom.a(@" ")); | 4189 | YP.write(Atom.a(" ")); |
3847 | YP.write(Name); | 4190 | YP.write(Name); |
3848 | YP.write(Atom.a(@" = ")); | 4191 | YP.write(Atom.a(" = ")); |
3849 | convertExpressionCSharp(Expression); | 4192 | convertExpressionCSharp(Expression); |
3850 | YP.write(Atom.a(@";")); | 4193 | YP.write(Atom.a(";")); |
3851 | YP.nl(); | 4194 | YP.nl(); |
3852 | convertStatementListCSharp(RestStatements, Level); | 4195 | convertStatementListCSharp(RestStatements, Level); |
3853 | return; | 4196 | return; |
@@ -3857,13 +4200,13 @@ namespace Temporary { | |||
3857 | Variable Name = new Variable(); | 4200 | Variable Name = new Variable(); |
3858 | Variable Expression = new Variable(); | 4201 | Variable Expression = new Variable(); |
3859 | Variable RestStatements = new Variable(); | 4202 | Variable RestStatements = new Variable(); |
3860 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"assign", Name, Expression), RestStatements))) | 4203 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements))) |
3861 | { | 4204 | { |
3862 | convertIndentationCSharp(Level); | 4205 | convertIndentationCSharp(Level); |
3863 | YP.write(Name); | 4206 | YP.write(Name); |
3864 | YP.write(Atom.a(@" = ")); | 4207 | YP.write(Atom.a(" = ")); |
3865 | convertExpressionCSharp(Expression); | 4208 | convertExpressionCSharp(Expression); |
3866 | YP.write(Atom.a(@";")); | 4209 | YP.write(Atom.a(";")); |
3867 | YP.nl(); | 4210 | YP.nl(); |
3868 | convertStatementListCSharp(RestStatements, Level); | 4211 | convertStatementListCSharp(RestStatements, Level); |
3869 | return; | 4212 | return; |
@@ -3871,10 +4214,10 @@ namespace Temporary { | |||
3871 | } | 4214 | } |
3872 | { | 4215 | { |
3873 | Variable RestStatements = new Variable(); | 4216 | Variable RestStatements = new Variable(); |
3874 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldtrue"), RestStatements))) | 4217 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements))) |
3875 | { | 4218 | { |
3876 | convertIndentationCSharp(Level); | 4219 | convertIndentationCSharp(Level); |
3877 | YP.write(Atom.a(@"yield return true;")); | 4220 | YP.write(Atom.a("yield return true;")); |
3878 | YP.nl(); | 4221 | YP.nl(); |
3879 | convertStatementListCSharp(RestStatements, Level); | 4222 | convertStatementListCSharp(RestStatements, Level); |
3880 | return; | 4223 | return; |
@@ -3882,10 +4225,10 @@ namespace Temporary { | |||
3882 | } | 4225 | } |
3883 | { | 4226 | { |
3884 | Variable RestStatements = new Variable(); | 4227 | Variable RestStatements = new Variable(); |
3885 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldfalse"), RestStatements))) | 4228 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements))) |
3886 | { | 4229 | { |
3887 | convertIndentationCSharp(Level); | 4230 | convertIndentationCSharp(Level); |
3888 | YP.write(Atom.a(@"yield return false;")); | 4231 | YP.write(Atom.a("yield return false;")); |
3889 | YP.nl(); | 4232 | YP.nl(); |
3890 | convertStatementListCSharp(RestStatements, Level); | 4233 | convertStatementListCSharp(RestStatements, Level); |
3891 | return; | 4234 | return; |
@@ -3893,10 +4236,10 @@ namespace Temporary { | |||
3893 | } | 4236 | } |
3894 | { | 4237 | { |
3895 | Variable RestStatements = new Variable(); | 4238 | Variable RestStatements = new Variable(); |
3896 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldbreak"), RestStatements))) | 4239 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements))) |
3897 | { | 4240 | { |
3898 | convertIndentationCSharp(Level); | 4241 | convertIndentationCSharp(Level); |
3899 | YP.write(Atom.a(@"yield break;")); | 4242 | YP.write(Atom.a("yield break;")); |
3900 | YP.nl(); | 4243 | YP.nl(); |
3901 | convertStatementListCSharp(RestStatements, Level); | 4244 | convertStatementListCSharp(RestStatements, Level); |
3902 | return; | 4245 | return; |
@@ -3904,10 +4247,10 @@ namespace Temporary { | |||
3904 | } | 4247 | } |
3905 | { | 4248 | { |
3906 | Variable RestStatements = new Variable(); | 4249 | Variable RestStatements = new Variable(); |
3907 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"return"), RestStatements))) | 4250 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements))) |
3908 | { | 4251 | { |
3909 | convertIndentationCSharp(Level); | 4252 | convertIndentationCSharp(Level); |
3910 | YP.write(Atom.a(@"return;")); | 4253 | YP.write(Atom.a("return;")); |
3911 | YP.nl(); | 4254 | YP.nl(); |
3912 | convertStatementListCSharp(RestStatements, Level); | 4255 | convertStatementListCSharp(RestStatements, Level); |
3913 | return; | 4256 | return; |
@@ -3915,10 +4258,10 @@ namespace Temporary { | |||
3915 | } | 4258 | } |
3916 | { | 4259 | { |
3917 | Variable RestStatements = new Variable(); | 4260 | Variable RestStatements = new Variable(); |
3918 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"returntrue"), RestStatements))) | 4261 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements))) |
3919 | { | 4262 | { |
3920 | convertIndentationCSharp(Level); | 4263 | convertIndentationCSharp(Level); |
3921 | YP.write(Atom.a(@"return true;")); | 4264 | YP.write(Atom.a("return true;")); |
3922 | YP.nl(); | 4265 | YP.nl(); |
3923 | convertStatementListCSharp(RestStatements, Level); | 4266 | convertStatementListCSharp(RestStatements, Level); |
3924 | return; | 4267 | return; |
@@ -3926,10 +4269,10 @@ namespace Temporary { | |||
3926 | } | 4269 | } |
3927 | { | 4270 | { |
3928 | Variable RestStatements = new Variable(); | 4271 | Variable RestStatements = new Variable(); |
3929 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"returnfalse"), RestStatements))) | 4272 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements))) |
3930 | { | 4273 | { |
3931 | convertIndentationCSharp(Level); | 4274 | convertIndentationCSharp(Level); |
3932 | YP.write(Atom.a(@"return false;")); | 4275 | YP.write(Atom.a("return false;")); |
3933 | YP.nl(); | 4276 | YP.nl(); |
3934 | convertStatementListCSharp(RestStatements, Level); | 4277 | convertStatementListCSharp(RestStatements, Level); |
3935 | return; | 4278 | return; |
@@ -3938,36 +4281,36 @@ namespace Temporary { | |||
3938 | { | 4281 | { |
3939 | Variable Name = new Variable(); | 4282 | Variable Name = new Variable(); |
3940 | Variable RestStatements = new Variable(); | 4283 | Variable RestStatements = new Variable(); |
3941 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"label", Name), RestStatements))) | 4284 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("label", Name), RestStatements))) |
3942 | { | 4285 | { |
3943 | convertIndentationCSharp(Level); | 4286 | convertIndentationCSharp(Level); |
3944 | YP.write(Name); | 4287 | YP.write(Name); |
3945 | YP.write(Atom.a(@":")); | 4288 | YP.write(Atom.a(":")); |
3946 | YP.nl(); | 4289 | YP.nl(); |
3947 | if (YP.termEqual(RestStatements, Atom.NIL)) | 4290 | if (YP.termEqual(RestStatements, Atom.NIL)) |
3948 | { | 4291 | { |
3949 | convertIndentationCSharp(Level); | 4292 | convertIndentationCSharp(Level); |
3950 | YP.write(Atom.a(@"{}")); | 4293 | YP.write(Atom.a("{}")); |
3951 | YP.nl(); | 4294 | YP.nl(); |
3952 | convertStatementListCSharp(RestStatements, Level); | 4295 | convertStatementListCSharp(RestStatements, Level); |
3953 | return; | 4296 | return; |
3954 | // goto cutIf1; | 4297 | goto cutIf1; |
3955 | } | 4298 | } |
3956 | convertStatementListCSharp(RestStatements, Level); | 4299 | convertStatementListCSharp(RestStatements, Level); |
3957 | return; | 4300 | return; |
3958 | // cutIf1: | 4301 | cutIf1: |
3959 | // { } | 4302 | { } |
3960 | } | 4303 | } |
3961 | } | 4304 | } |
3962 | { | 4305 | { |
3963 | Variable Name = new Variable(); | 4306 | Variable Name = new Variable(); |
3964 | Variable RestStatements = new Variable(); | 4307 | Variable RestStatements = new Variable(); |
3965 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"breakBlock", Name), RestStatements))) | 4308 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements))) |
3966 | { | 4309 | { |
3967 | convertIndentationCSharp(Level); | 4310 | convertIndentationCSharp(Level); |
3968 | YP.write(Atom.a(@"goto ")); | 4311 | YP.write(Atom.a("goto ")); |
3969 | YP.write(Name); | 4312 | YP.write(Name); |
3970 | YP.write(Atom.a(@";")); | 4313 | YP.write(Atom.a(";")); |
3971 | YP.nl(); | 4314 | YP.nl(); |
3972 | convertStatementListCSharp(RestStatements, Level); | 4315 | convertStatementListCSharp(RestStatements, Level); |
3973 | return; | 4316 | return; |
@@ -3977,32 +4320,43 @@ namespace Temporary { | |||
3977 | Variable Name = new Variable(); | 4320 | Variable Name = new Variable(); |
3978 | Variable ArgList = new Variable(); | 4321 | Variable ArgList = new Variable(); |
3979 | Variable RestStatements = new Variable(); | 4322 | Variable RestStatements = new Variable(); |
3980 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"call", Name, ArgList), RestStatements))) | 4323 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements))) |
3981 | { | 4324 | { |
3982 | convertIndentationCSharp(Level); | 4325 | convertIndentationCSharp(Level); |
3983 | YP.write(Name); | 4326 | YP.write(Name); |
3984 | YP.write(Atom.a(@"(")); | 4327 | YP.write(Atom.a("(")); |
3985 | convertArgListCSharp(ArgList); | 4328 | convertArgListCSharp(ArgList); |
3986 | YP.write(Atom.a(@");")); | 4329 | YP.write(Atom.a(");")); |
3987 | YP.nl(); | 4330 | YP.nl(); |
3988 | convertStatementListCSharp(RestStatements, Level); | 4331 | convertStatementListCSharp(RestStatements, Level); |
3989 | return; | 4332 | return; |
3990 | } | 4333 | } |
3991 | } | 4334 | } |
3992 | { | 4335 | { |
4336 | Variable Name = new Variable(); | ||
4337 | Variable _FunctorArgs = new Variable(); | ||
4338 | Variable ArgList = new Variable(); | ||
4339 | Variable RestStatements = new Variable(); | ||
4340 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements))) | ||
4341 | { | ||
4342 | convertStatementListCSharp(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level); | ||
4343 | return; | ||
4344 | } | ||
4345 | } | ||
4346 | { | ||
3993 | Variable Obj = new Variable(); | 4347 | Variable Obj = new Variable(); |
3994 | Variable Name = new Variable(); | 4348 | Variable Name = new Variable(); |
3995 | Variable ArgList = new Variable(); | 4349 | Variable ArgList = new Variable(); |
3996 | Variable RestStatements = new Variable(); | 4350 | Variable RestStatements = new Variable(); |
3997 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3(@"callMember", new Functor1(@"var", Obj), Name, ArgList), RestStatements))) | 4351 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements))) |
3998 | { | 4352 | { |
3999 | convertIndentationCSharp(Level); | 4353 | convertIndentationCSharp(Level); |
4000 | YP.write(Obj); | 4354 | YP.write(Obj); |
4001 | YP.write(Atom.a(@".")); | 4355 | YP.write(Atom.a(".")); |
4002 | YP.write(Name); | 4356 | YP.write(Name); |
4003 | YP.write(Atom.a(@"(")); | 4357 | YP.write(Atom.a("(")); |
4004 | convertArgListCSharp(ArgList); | 4358 | convertArgListCSharp(ArgList); |
4005 | YP.write(Atom.a(@");")); | 4359 | YP.write(Atom.a(");")); |
4006 | YP.nl(); | 4360 | YP.nl(); |
4007 | convertStatementListCSharp(RestStatements, Level); | 4361 | convertStatementListCSharp(RestStatements, Level); |
4008 | return; | 4362 | return; |
@@ -4012,16 +4366,16 @@ namespace Temporary { | |||
4012 | Variable Body = new Variable(); | 4366 | Variable Body = new Variable(); |
4013 | Variable RestStatements = new Variable(); | 4367 | Variable RestStatements = new Variable(); |
4014 | Variable NextLevel = new Variable(); | 4368 | Variable NextLevel = new Variable(); |
4015 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"blockScope", Body), RestStatements))) | 4369 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements))) |
4016 | { | 4370 | { |
4017 | convertIndentationCSharp(Level); | 4371 | convertIndentationCSharp(Level); |
4018 | YP.write(Atom.a(@"{")); | 4372 | YP.write(Atom.a("{")); |
4019 | YP.nl(); | 4373 | YP.nl(); |
4020 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4374 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4021 | { | 4375 | { |
4022 | convertStatementListCSharp(Body, NextLevel); | 4376 | convertStatementListCSharp(Body, NextLevel); |
4023 | convertIndentationCSharp(Level); | 4377 | convertIndentationCSharp(Level); |
4024 | YP.write(Atom.a(@"}")); | 4378 | YP.write(Atom.a("}")); |
4025 | YP.nl(); | 4379 | YP.nl(); |
4026 | convertStatementListCSharp(RestStatements, Level); | 4380 | convertStatementListCSharp(RestStatements, Level); |
4027 | return; | 4381 | return; |
@@ -4033,18 +4387,18 @@ namespace Temporary { | |||
4033 | Variable Body = new Variable(); | 4387 | Variable Body = new Variable(); |
4034 | Variable RestStatements = new Variable(); | 4388 | Variable RestStatements = new Variable(); |
4035 | Variable NextLevel = new Variable(); | 4389 | Variable NextLevel = new Variable(); |
4036 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"if", Expression, Body), RestStatements))) | 4390 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements))) |
4037 | { | 4391 | { |
4038 | convertIndentationCSharp(Level); | 4392 | convertIndentationCSharp(Level); |
4039 | YP.write(Atom.a(@"if (")); | 4393 | YP.write(Atom.a("if (")); |
4040 | convertExpressionCSharp(Expression); | 4394 | convertExpressionCSharp(Expression); |
4041 | YP.write(Atom.a(@") {")); | 4395 | YP.write(Atom.a(") {")); |
4042 | YP.nl(); | 4396 | YP.nl(); |
4043 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4397 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4044 | { | 4398 | { |
4045 | convertStatementListCSharp(Body, NextLevel); | 4399 | convertStatementListCSharp(Body, NextLevel); |
4046 | convertIndentationCSharp(Level); | 4400 | convertIndentationCSharp(Level); |
4047 | YP.write(Atom.a(@"}")); | 4401 | YP.write(Atom.a("}")); |
4048 | YP.nl(); | 4402 | YP.nl(); |
4049 | convertStatementListCSharp(RestStatements, Level); | 4403 | convertStatementListCSharp(RestStatements, Level); |
4050 | return; | 4404 | return; |
@@ -4056,20 +4410,20 @@ namespace Temporary { | |||
4056 | Variable Body = new Variable(); | 4410 | Variable Body = new Variable(); |
4057 | Variable RestStatements = new Variable(); | 4411 | Variable RestStatements = new Variable(); |
4058 | Variable NextLevel = new Variable(); | 4412 | Variable NextLevel = new Variable(); |
4059 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"foreach", Expression, Body), RestStatements))) | 4413 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements))) |
4060 | { | 4414 | { |
4061 | convertIndentationCSharp(Level); | 4415 | convertIndentationCSharp(Level); |
4062 | YP.write(Atom.a(@"foreach (bool l")); | 4416 | YP.write(Atom.a("foreach (bool l")); |
4063 | YP.write(Level); | 4417 | YP.write(Level); |
4064 | YP.write(Atom.a(@" in ")); | 4418 | YP.write(Atom.a(" in ")); |
4065 | convertExpressionCSharp(Expression); | 4419 | convertExpressionCSharp(Expression); |
4066 | YP.write(Atom.a(@") {")); | 4420 | YP.write(Atom.a(") {")); |
4067 | YP.nl(); | 4421 | YP.nl(); |
4068 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4422 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4069 | { | 4423 | { |
4070 | convertStatementListCSharp(Body, NextLevel); | 4424 | convertStatementListCSharp(Body, NextLevel); |
4071 | convertIndentationCSharp(Level); | 4425 | convertIndentationCSharp(Level); |
4072 | YP.write(Atom.a(@"}")); | 4426 | YP.write(Atom.a("}")); |
4073 | YP.nl(); | 4427 | YP.nl(); |
4074 | convertStatementListCSharp(RestStatements, Level); | 4428 | convertStatementListCSharp(RestStatements, Level); |
4075 | return; | 4429 | return; |
@@ -4079,12 +4433,12 @@ namespace Temporary { | |||
4079 | { | 4433 | { |
4080 | Variable Expression = new Variable(); | 4434 | Variable Expression = new Variable(); |
4081 | Variable RestStatements = new Variable(); | 4435 | Variable RestStatements = new Variable(); |
4082 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"throw", Expression), RestStatements))) | 4436 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements))) |
4083 | { | 4437 | { |
4084 | convertIndentationCSharp(Level); | 4438 | convertIndentationCSharp(Level); |
4085 | YP.write(Atom.a(@"throw ")); | 4439 | YP.write(Atom.a("throw ")); |
4086 | convertExpressionCSharp(Expression); | 4440 | convertExpressionCSharp(Expression); |
4087 | YP.write(Atom.a(@";")); | 4441 | YP.write(Atom.a(";")); |
4088 | YP.nl(); | 4442 | YP.nl(); |
4089 | convertStatementListCSharp(RestStatements, Level); | 4443 | convertStatementListCSharp(RestStatements, Level); |
4090 | return; | 4444 | return; |
@@ -4098,7 +4452,7 @@ namespace Temporary { | |||
4098 | Variable N = new Variable(); | 4452 | Variable N = new Variable(); |
4099 | foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) | 4453 | foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) |
4100 | { | 4454 | { |
4101 | repeatWrite(Atom.a(@" "), N); | 4455 | repeatWrite(Atom.a(" "), N); |
4102 | return; | 4456 | return; |
4103 | } | 4457 | } |
4104 | } | 4458 | } |
@@ -4120,15 +4474,15 @@ namespace Temporary { | |||
4120 | convertExpressionCSharp(Head); | 4474 | convertExpressionCSharp(Head); |
4121 | if (YP.termNotEqual(Tail, Atom.NIL)) | 4475 | if (YP.termNotEqual(Tail, Atom.NIL)) |
4122 | { | 4476 | { |
4123 | YP.write(Atom.a(@", ")); | 4477 | YP.write(Atom.a(", ")); |
4124 | convertArgListCSharp(Tail); | 4478 | convertArgListCSharp(Tail); |
4125 | return; | 4479 | return; |
4126 | // goto cutIf1; | 4480 | goto cutIf1; |
4127 | } | 4481 | } |
4128 | convertArgListCSharp(Tail); | 4482 | convertArgListCSharp(Tail); |
4129 | return; | 4483 | return; |
4130 | // cutIf1: | 4484 | cutIf1: |
4131 | // { } | 4485 | { } |
4132 | } | 4486 | } |
4133 | } | 4487 | } |
4134 | } | 4488 | } |
@@ -4137,9 +4491,9 @@ namespace Temporary { | |||
4137 | { | 4491 | { |
4138 | { | 4492 | { |
4139 | Variable X = new Variable(); | 4493 | Variable X = new Variable(); |
4140 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"arg", X))) | 4494 | foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X))) |
4141 | { | 4495 | { |
4142 | YP.write(Atom.a(@"object ")); | 4496 | YP.write(Atom.a("object ")); |
4143 | YP.write(X); | 4497 | YP.write(X); |
4144 | return; | 4498 | return; |
4145 | } | 4499 | } |
@@ -4147,12 +4501,22 @@ namespace Temporary { | |||
4147 | { | 4501 | { |
4148 | Variable Name = new Variable(); | 4502 | Variable Name = new Variable(); |
4149 | Variable ArgList = new Variable(); | 4503 | Variable ArgList = new Variable(); |
4150 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"call", Name, ArgList))) | 4504 | foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList))) |
4151 | { | 4505 | { |
4152 | YP.write(Name); | 4506 | YP.write(Name); |
4153 | YP.write(Atom.a(@"(")); | 4507 | YP.write(Atom.a("(")); |
4154 | convertArgListCSharp(ArgList); | 4508 | convertArgListCSharp(ArgList); |
4155 | YP.write(Atom.a(@")")); | 4509 | YP.write(Atom.a(")")); |
4510 | return; | ||
4511 | } | ||
4512 | } | ||
4513 | { | ||
4514 | Variable Name = new Variable(); | ||
4515 | Variable _FunctorArgs = new Variable(); | ||
4516 | Variable ArgList = new Variable(); | ||
4517 | foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList))) | ||
4518 | { | ||
4519 | convertExpressionCSharp(new Functor2("call", Name, ArgList)); | ||
4156 | return; | 4520 | return; |
4157 | } | 4521 | } |
4158 | } | 4522 | } |
@@ -4160,90 +4524,90 @@ namespace Temporary { | |||
4160 | Variable Obj = new Variable(); | 4524 | Variable Obj = new Variable(); |
4161 | Variable Name = new Variable(); | 4525 | Variable Name = new Variable(); |
4162 | Variable ArgList = new Variable(); | 4526 | Variable ArgList = new Variable(); |
4163 | foreach (bool l2 in YP.unify(arg1, new Functor3(@"callMember", new Functor1(@"var", Obj), Name, ArgList))) | 4527 | foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList))) |
4164 | { | 4528 | { |
4165 | YP.write(Obj); | 4529 | YP.write(Obj); |
4166 | YP.write(Atom.a(@".")); | 4530 | YP.write(Atom.a(".")); |
4167 | YP.write(Name); | 4531 | YP.write(Name); |
4168 | YP.write(Atom.a(@"(")); | 4532 | YP.write(Atom.a("(")); |
4169 | convertArgListCSharp(ArgList); | 4533 | convertArgListCSharp(ArgList); |
4170 | YP.write(Atom.a(@")")); | 4534 | YP.write(Atom.a(")")); |
4171 | return; | 4535 | return; |
4172 | } | 4536 | } |
4173 | } | 4537 | } |
4174 | { | 4538 | { |
4175 | Variable Name = new Variable(); | 4539 | Variable Name = new Variable(); |
4176 | Variable ArgList = new Variable(); | 4540 | Variable ArgList = new Variable(); |
4177 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"new", Name, ArgList))) | 4541 | foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList))) |
4178 | { | 4542 | { |
4179 | YP.write(Atom.a(@"new ")); | 4543 | YP.write(Atom.a("new ")); |
4180 | YP.write(Name); | 4544 | YP.write(Name); |
4181 | YP.write(Atom.a(@"(")); | 4545 | YP.write(Atom.a("(")); |
4182 | convertArgListCSharp(ArgList); | 4546 | convertArgListCSharp(ArgList); |
4183 | YP.write(Atom.a(@")")); | 4547 | YP.write(Atom.a(")")); |
4184 | return; | 4548 | return; |
4185 | } | 4549 | } |
4186 | } | 4550 | } |
4187 | { | 4551 | { |
4188 | Variable Name = new Variable(); | 4552 | Variable Name = new Variable(); |
4189 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"var", Name))) | 4553 | foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name))) |
4190 | { | 4554 | { |
4191 | YP.write(Name); | 4555 | YP.write(Name); |
4192 | return; | 4556 | return; |
4193 | } | 4557 | } |
4194 | } | 4558 | } |
4195 | { | 4559 | { |
4196 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"null"))) | 4560 | foreach (bool l2 in YP.unify(arg1, Atom.a("null"))) |
4197 | { | 4561 | { |
4198 | YP.write(Atom.a(@"null")); | 4562 | YP.write(Atom.a("null")); |
4199 | return; | 4563 | return; |
4200 | } | 4564 | } |
4201 | } | 4565 | } |
4202 | { | 4566 | { |
4203 | Variable X = new Variable(); | 4567 | Variable X = new Variable(); |
4204 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"not", X))) | 4568 | foreach (bool l2 in YP.unify(arg1, new Functor1("not", X))) |
4205 | { | 4569 | { |
4206 | YP.write(Atom.a(@"!(")); | 4570 | YP.write(Atom.a("!(")); |
4207 | convertExpressionCSharp(X); | 4571 | convertExpressionCSharp(X); |
4208 | YP.write(Atom.a(@")")); | 4572 | YP.write(Atom.a(")")); |
4209 | return; | 4573 | return; |
4210 | } | 4574 | } |
4211 | } | 4575 | } |
4212 | { | 4576 | { |
4213 | Variable X = new Variable(); | 4577 | Variable X = new Variable(); |
4214 | Variable Y = new Variable(); | 4578 | Variable Y = new Variable(); |
4215 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"and", X, Y))) | 4579 | foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y))) |
4216 | { | 4580 | { |
4217 | YP.write(Atom.a(@"(")); | 4581 | YP.write(Atom.a("(")); |
4218 | convertExpressionCSharp(X); | 4582 | convertExpressionCSharp(X); |
4219 | YP.write(Atom.a(@") && (")); | 4583 | YP.write(Atom.a(") && (")); |
4220 | convertExpressionCSharp(Y); | 4584 | convertExpressionCSharp(Y); |
4221 | YP.write(Atom.a(@")")); | 4585 | YP.write(Atom.a(")")); |
4222 | return; | 4586 | return; |
4223 | } | 4587 | } |
4224 | } | 4588 | } |
4225 | { | 4589 | { |
4226 | Variable ArgList = new Variable(); | 4590 | Variable ArgList = new Variable(); |
4227 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"objectArray", ArgList))) | 4591 | foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList))) |
4228 | { | 4592 | { |
4229 | YP.write(Atom.a(@"new object[] {")); | 4593 | YP.write(Atom.a("new object[] {")); |
4230 | convertArgListCSharp(ArgList); | 4594 | convertArgListCSharp(ArgList); |
4231 | YP.write(Atom.a(@"}")); | 4595 | YP.write(Atom.a("}")); |
4232 | return; | 4596 | return; |
4233 | } | 4597 | } |
4234 | } | 4598 | } |
4235 | { | 4599 | { |
4236 | Variable X = new Variable(); | 4600 | Variable X = new Variable(); |
4237 | Variable Codes = new Variable(); | 4601 | Variable Codes = new Variable(); |
4238 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"object", X))) | 4602 | foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) |
4239 | { | 4603 | { |
4240 | if (YP.atom(X)) | 4604 | if (YP.atom(X)) |
4241 | { | 4605 | { |
4242 | YP.write(Atom.a(@"@""")); | 4606 | YP.write(Atom.a("\"")); |
4243 | foreach (bool l4 in YP.atom_codes(X, Codes)) | 4607 | foreach (bool l4 in YP.atom_codes(X, Codes)) |
4244 | { | 4608 | { |
4245 | convertStringCodesCSharp(Codes); | 4609 | convertStringCodesCSharp(Codes); |
4246 | YP.write(Atom.a(@"""")); | 4610 | YP.write(Atom.a("\"")); |
4247 | return; | 4611 | return; |
4248 | } | 4612 | } |
4249 | } | 4613 | } |
@@ -4251,7 +4615,7 @@ namespace Temporary { | |||
4251 | } | 4615 | } |
4252 | { | 4616 | { |
4253 | Variable X = new Variable(); | 4617 | Variable X = new Variable(); |
4254 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"object", X))) | 4618 | foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) |
4255 | { | 4619 | { |
4256 | YP.write(X); | 4620 | YP.write(X); |
4257 | return; | 4621 | return; |
@@ -4272,19 +4636,11 @@ namespace Temporary { | |||
4272 | Variable RestCodes = new Variable(); | 4636 | Variable RestCodes = new Variable(); |
4273 | foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes))) | 4637 | foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes))) |
4274 | { | 4638 | { |
4275 | if (YP.termEqual(Code, 34)) | 4639 | foreach (bool l3 in putCStringCode(Code)) |
4276 | { | 4640 | { |
4277 | YP.put_code(34); | ||
4278 | YP.put_code(Code); | ||
4279 | convertStringCodesCSharp(RestCodes); | 4641 | convertStringCodesCSharp(RestCodes); |
4280 | return; | 4642 | return; |
4281 | // goto cutIf1; | ||
4282 | } | 4643 | } |
4283 | YP.put_code(Code); | ||
4284 | convertStringCodesCSharp(RestCodes); | ||
4285 | return; | ||
4286 | // cutIf1: | ||
4287 | // { } | ||
4288 | } | 4644 | } |
4289 | } | 4645 | } |
4290 | } | 4646 | } |
@@ -4292,9 +4648,10 @@ namespace Temporary { | |||
4292 | public static void convertFunctionJavascript(object arg1) | 4648 | public static void convertFunctionJavascript(object arg1) |
4293 | { | 4649 | { |
4294 | { | 4650 | { |
4295 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"getDeclaringClass"))) | 4651 | foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass"))) |
4296 | { | 4652 | { |
4297 | YP.write(Atom.a(@"function getDeclaringClass() { return null; }")); | 4653 | YP.write(Atom.a("function getDeclaringClass() { return null; }")); |
4654 | YP.nl(); | ||
4298 | YP.nl(); | 4655 | YP.nl(); |
4299 | return; | 4656 | return; |
4300 | } | 4657 | } |
@@ -4304,16 +4661,16 @@ namespace Temporary { | |||
4304 | Variable Name = new Variable(); | 4661 | Variable Name = new Variable(); |
4305 | Variable ArgList = new Variable(); | 4662 | Variable ArgList = new Variable(); |
4306 | Variable Body = new Variable(); | 4663 | Variable Body = new Variable(); |
4307 | foreach (bool l2 in YP.unify(arg1, new Functor(@"function", new object[] { x1, Name, ArgList, Body }))) | 4664 | foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body }))) |
4308 | { | 4665 | { |
4309 | YP.write(Atom.a(@"function ")); | 4666 | YP.write(Atom.a("function ")); |
4310 | YP.write(Name); | 4667 | YP.write(Name); |
4311 | YP.write(Atom.a(@"(")); | 4668 | YP.write(Atom.a("(")); |
4312 | convertArgListJavascript(ArgList); | 4669 | convertArgListJavascript(ArgList); |
4313 | YP.write(Atom.a(@") {")); | 4670 | YP.write(Atom.a(") {")); |
4314 | YP.nl(); | 4671 | YP.nl(); |
4315 | convertStatementListJavascript(Body, 1); | 4672 | convertStatementListJavascript(Body, 1); |
4316 | YP.write(Atom.a(@"}")); | 4673 | YP.write(Atom.a("}")); |
4317 | YP.nl(); | 4674 | YP.nl(); |
4318 | YP.nl(); | 4675 | YP.nl(); |
4319 | return; | 4676 | return; |
@@ -4336,20 +4693,20 @@ namespace Temporary { | |||
4336 | Variable Body = new Variable(); | 4693 | Variable Body = new Variable(); |
4337 | Variable RestStatements = new Variable(); | 4694 | Variable RestStatements = new Variable(); |
4338 | Variable NextLevel = new Variable(); | 4695 | Variable NextLevel = new Variable(); |
4339 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"breakableBlock", Name, Body), RestStatements))) | 4696 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements))) |
4340 | { | 4697 | { |
4341 | convertIndentationJavascript(Level); | 4698 | convertIndentationJavascript(Level); |
4342 | YP.write(Name); | 4699 | YP.write(Name); |
4343 | YP.write(Atom.a(@":")); | 4700 | YP.write(Atom.a(":")); |
4344 | YP.nl(); | 4701 | YP.nl(); |
4345 | convertIndentationJavascript(Level); | 4702 | convertIndentationJavascript(Level); |
4346 | YP.write(Atom.a(@"{")); | 4703 | YP.write(Atom.a("{")); |
4347 | YP.nl(); | 4704 | YP.nl(); |
4348 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4705 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4349 | { | 4706 | { |
4350 | convertStatementListJavascript(Body, NextLevel); | 4707 | convertStatementListJavascript(Body, NextLevel); |
4351 | convertIndentationJavascript(Level); | 4708 | convertIndentationJavascript(Level); |
4352 | YP.write(Atom.a(@"}")); | 4709 | YP.write(Atom.a("}")); |
4353 | YP.nl(); | 4710 | YP.nl(); |
4354 | convertStatementListJavascript(RestStatements, Level); | 4711 | convertStatementListJavascript(RestStatements, Level); |
4355 | return; | 4712 | return; |
@@ -4362,14 +4719,14 @@ namespace Temporary { | |||
4362 | Variable Name = new Variable(); | 4719 | Variable Name = new Variable(); |
4363 | Variable Expression = new Variable(); | 4720 | Variable Expression = new Variable(); |
4364 | Variable RestStatements = new Variable(); | 4721 | Variable RestStatements = new Variable(); |
4365 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3(@"declare", _Type, Name, Expression), RestStatements))) | 4722 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements))) |
4366 | { | 4723 | { |
4367 | convertIndentationJavascript(Level); | 4724 | convertIndentationJavascript(Level); |
4368 | YP.write(Atom.a(@"var ")); | 4725 | YP.write(Atom.a("var ")); |
4369 | YP.write(Name); | 4726 | YP.write(Name); |
4370 | YP.write(Atom.a(@" = ")); | 4727 | YP.write(Atom.a(" = ")); |
4371 | convertExpressionJavascript(Expression); | 4728 | convertExpressionJavascript(Expression); |
4372 | YP.write(Atom.a(@";")); | 4729 | YP.write(Atom.a(";")); |
4373 | YP.nl(); | 4730 | YP.nl(); |
4374 | convertStatementListJavascript(RestStatements, Level); | 4731 | convertStatementListJavascript(RestStatements, Level); |
4375 | return; | 4732 | return; |
@@ -4380,13 +4737,13 @@ namespace Temporary { | |||
4380 | Variable Name = new Variable(); | 4737 | Variable Name = new Variable(); |
4381 | Variable Expression = new Variable(); | 4738 | Variable Expression = new Variable(); |
4382 | Variable RestStatements = new Variable(); | 4739 | Variable RestStatements = new Variable(); |
4383 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"assign", Name, Expression), RestStatements))) | 4740 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements))) |
4384 | { | 4741 | { |
4385 | convertIndentationJavascript(Level); | 4742 | convertIndentationJavascript(Level); |
4386 | YP.write(Name); | 4743 | YP.write(Name); |
4387 | YP.write(Atom.a(@" = ")); | 4744 | YP.write(Atom.a(" = ")); |
4388 | convertExpressionJavascript(Expression); | 4745 | convertExpressionJavascript(Expression); |
4389 | YP.write(Atom.a(@";")); | 4746 | YP.write(Atom.a(";")); |
4390 | YP.nl(); | 4747 | YP.nl(); |
4391 | convertStatementListJavascript(RestStatements, Level); | 4748 | convertStatementListJavascript(RestStatements, Level); |
4392 | return; | 4749 | return; |
@@ -4395,10 +4752,10 @@ namespace Temporary { | |||
4395 | { | 4752 | { |
4396 | object Level = arg2; | 4753 | object Level = arg2; |
4397 | Variable RestStatements = new Variable(); | 4754 | Variable RestStatements = new Variable(); |
4398 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldtrue"), RestStatements))) | 4755 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements))) |
4399 | { | 4756 | { |
4400 | convertIndentationJavascript(Level); | 4757 | convertIndentationJavascript(Level); |
4401 | YP.write(Atom.a(@"yield true;")); | 4758 | YP.write(Atom.a("yield true;")); |
4402 | YP.nl(); | 4759 | YP.nl(); |
4403 | convertStatementListJavascript(RestStatements, Level); | 4760 | convertStatementListJavascript(RestStatements, Level); |
4404 | return; | 4761 | return; |
@@ -4407,10 +4764,10 @@ namespace Temporary { | |||
4407 | { | 4764 | { |
4408 | object Level = arg2; | 4765 | object Level = arg2; |
4409 | Variable RestStatements = new Variable(); | 4766 | Variable RestStatements = new Variable(); |
4410 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldfalse"), RestStatements))) | 4767 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements))) |
4411 | { | 4768 | { |
4412 | convertIndentationJavascript(Level); | 4769 | convertIndentationJavascript(Level); |
4413 | YP.write(Atom.a(@"yield false;")); | 4770 | YP.write(Atom.a("yield false;")); |
4414 | YP.nl(); | 4771 | YP.nl(); |
4415 | convertStatementListJavascript(RestStatements, Level); | 4772 | convertStatementListJavascript(RestStatements, Level); |
4416 | return; | 4773 | return; |
@@ -4419,10 +4776,10 @@ namespace Temporary { | |||
4419 | { | 4776 | { |
4420 | object Level = arg2; | 4777 | object Level = arg2; |
4421 | Variable RestStatements = new Variable(); | 4778 | Variable RestStatements = new Variable(); |
4422 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldbreak"), RestStatements))) | 4779 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements))) |
4423 | { | 4780 | { |
4424 | convertIndentationJavascript(Level); | 4781 | convertIndentationJavascript(Level); |
4425 | YP.write(Atom.a(@"return;")); | 4782 | YP.write(Atom.a("return;")); |
4426 | YP.nl(); | 4783 | YP.nl(); |
4427 | convertStatementListJavascript(RestStatements, Level); | 4784 | convertStatementListJavascript(RestStatements, Level); |
4428 | return; | 4785 | return; |
@@ -4431,10 +4788,10 @@ namespace Temporary { | |||
4431 | { | 4788 | { |
4432 | object Level = arg2; | 4789 | object Level = arg2; |
4433 | Variable RestStatements = new Variable(); | 4790 | Variable RestStatements = new Variable(); |
4434 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"return"), RestStatements))) | 4791 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements))) |
4435 | { | 4792 | { |
4436 | convertIndentationJavascript(Level); | 4793 | convertIndentationJavascript(Level); |
4437 | YP.write(Atom.a(@"return;")); | 4794 | YP.write(Atom.a("return;")); |
4438 | YP.nl(); | 4795 | YP.nl(); |
4439 | convertStatementListJavascript(RestStatements, Level); | 4796 | convertStatementListJavascript(RestStatements, Level); |
4440 | return; | 4797 | return; |
@@ -4443,10 +4800,10 @@ namespace Temporary { | |||
4443 | { | 4800 | { |
4444 | object Level = arg2; | 4801 | object Level = arg2; |
4445 | Variable RestStatements = new Variable(); | 4802 | Variable RestStatements = new Variable(); |
4446 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"returntrue"), RestStatements))) | 4803 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements))) |
4447 | { | 4804 | { |
4448 | convertIndentationJavascript(Level); | 4805 | convertIndentationJavascript(Level); |
4449 | YP.write(Atom.a(@"return true;")); | 4806 | YP.write(Atom.a("return true;")); |
4450 | YP.nl(); | 4807 | YP.nl(); |
4451 | convertStatementListJavascript(RestStatements, Level); | 4808 | convertStatementListJavascript(RestStatements, Level); |
4452 | return; | 4809 | return; |
@@ -4455,10 +4812,10 @@ namespace Temporary { | |||
4455 | { | 4812 | { |
4456 | object Level = arg2; | 4813 | object Level = arg2; |
4457 | Variable RestStatements = new Variable(); | 4814 | Variable RestStatements = new Variable(); |
4458 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"returnfalse"), RestStatements))) | 4815 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements))) |
4459 | { | 4816 | { |
4460 | convertIndentationJavascript(Level); | 4817 | convertIndentationJavascript(Level); |
4461 | YP.write(Atom.a(@"return false;")); | 4818 | YP.write(Atom.a("return false;")); |
4462 | YP.nl(); | 4819 | YP.nl(); |
4463 | convertStatementListJavascript(RestStatements, Level); | 4820 | convertStatementListJavascript(RestStatements, Level); |
4464 | return; | 4821 | return; |
@@ -4468,12 +4825,12 @@ namespace Temporary { | |||
4468 | object Level = arg2; | 4825 | object Level = arg2; |
4469 | Variable Name = new Variable(); | 4826 | Variable Name = new Variable(); |
4470 | Variable RestStatements = new Variable(); | 4827 | Variable RestStatements = new Variable(); |
4471 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"breakBlock", Name), RestStatements))) | 4828 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements))) |
4472 | { | 4829 | { |
4473 | convertIndentationJavascript(Level); | 4830 | convertIndentationJavascript(Level); |
4474 | YP.write(Atom.a(@"break ")); | 4831 | YP.write(Atom.a("break ")); |
4475 | YP.write(Name); | 4832 | YP.write(Name); |
4476 | YP.write(Atom.a(@";")); | 4833 | YP.write(Atom.a(";")); |
4477 | YP.nl(); | 4834 | YP.nl(); |
4478 | convertStatementListJavascript(RestStatements, Level); | 4835 | convertStatementListJavascript(RestStatements, Level); |
4479 | return; | 4836 | return; |
@@ -4484,13 +4841,13 @@ namespace Temporary { | |||
4484 | Variable Name = new Variable(); | 4841 | Variable Name = new Variable(); |
4485 | Variable ArgList = new Variable(); | 4842 | Variable ArgList = new Variable(); |
4486 | Variable RestStatements = new Variable(); | 4843 | Variable RestStatements = new Variable(); |
4487 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"call", Name, ArgList), RestStatements))) | 4844 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements))) |
4488 | { | 4845 | { |
4489 | convertIndentationJavascript(Level); | 4846 | convertIndentationJavascript(Level); |
4490 | YP.write(Name); | 4847 | YP.write(Name); |
4491 | YP.write(Atom.a(@"(")); | 4848 | YP.write(Atom.a("(")); |
4492 | convertArgListJavascript(ArgList); | 4849 | convertArgListJavascript(ArgList); |
4493 | YP.write(Atom.a(@");")); | 4850 | YP.write(Atom.a(");")); |
4494 | YP.nl(); | 4851 | YP.nl(); |
4495 | convertStatementListJavascript(RestStatements, Level); | 4852 | convertStatementListJavascript(RestStatements, Level); |
4496 | return; | 4853 | return; |
@@ -4498,19 +4855,31 @@ namespace Temporary { | |||
4498 | } | 4855 | } |
4499 | { | 4856 | { |
4500 | object Level = arg2; | 4857 | object Level = arg2; |
4858 | Variable Name = new Variable(); | ||
4859 | Variable _FunctorArgs = new Variable(); | ||
4860 | Variable ArgList = new Variable(); | ||
4861 | Variable RestStatements = new Variable(); | ||
4862 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements))) | ||
4863 | { | ||
4864 | convertStatementListJavascript(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level); | ||
4865 | return; | ||
4866 | } | ||
4867 | } | ||
4868 | { | ||
4869 | object Level = arg2; | ||
4501 | Variable Obj = new Variable(); | 4870 | Variable Obj = new Variable(); |
4502 | Variable Name = new Variable(); | 4871 | Variable Name = new Variable(); |
4503 | Variable ArgList = new Variable(); | 4872 | Variable ArgList = new Variable(); |
4504 | Variable RestStatements = new Variable(); | 4873 | Variable RestStatements = new Variable(); |
4505 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3(@"callMember", new Functor1(@"var", Obj), Name, ArgList), RestStatements))) | 4874 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements))) |
4506 | { | 4875 | { |
4507 | convertIndentationJavascript(Level); | 4876 | convertIndentationJavascript(Level); |
4508 | YP.write(Obj); | 4877 | YP.write(Obj); |
4509 | YP.write(Atom.a(@".")); | 4878 | YP.write(Atom.a(".")); |
4510 | YP.write(Name); | 4879 | YP.write(Name); |
4511 | YP.write(Atom.a(@"(")); | 4880 | YP.write(Atom.a("(")); |
4512 | convertArgListJavascript(ArgList); | 4881 | convertArgListJavascript(ArgList); |
4513 | YP.write(Atom.a(@");")); | 4882 | YP.write(Atom.a(");")); |
4514 | YP.nl(); | 4883 | YP.nl(); |
4515 | convertStatementListJavascript(RestStatements, Level); | 4884 | convertStatementListJavascript(RestStatements, Level); |
4516 | return; | 4885 | return; |
@@ -4521,16 +4890,16 @@ namespace Temporary { | |||
4521 | Variable Body = new Variable(); | 4890 | Variable Body = new Variable(); |
4522 | Variable RestStatements = new Variable(); | 4891 | Variable RestStatements = new Variable(); |
4523 | Variable NextLevel = new Variable(); | 4892 | Variable NextLevel = new Variable(); |
4524 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"blockScope", Body), RestStatements))) | 4893 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements))) |
4525 | { | 4894 | { |
4526 | convertIndentationJavascript(Level); | 4895 | convertIndentationJavascript(Level); |
4527 | YP.write(Atom.a(@"{")); | 4896 | YP.write(Atom.a("{")); |
4528 | YP.nl(); | 4897 | YP.nl(); |
4529 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4898 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4530 | { | 4899 | { |
4531 | convertStatementListJavascript(Body, NextLevel); | 4900 | convertStatementListJavascript(Body, NextLevel); |
4532 | convertIndentationJavascript(Level); | 4901 | convertIndentationJavascript(Level); |
4533 | YP.write(Atom.a(@"}")); | 4902 | YP.write(Atom.a("}")); |
4534 | YP.nl(); | 4903 | YP.nl(); |
4535 | convertStatementListJavascript(RestStatements, Level); | 4904 | convertStatementListJavascript(RestStatements, Level); |
4536 | return; | 4905 | return; |
@@ -4543,18 +4912,18 @@ namespace Temporary { | |||
4543 | Variable Body = new Variable(); | 4912 | Variable Body = new Variable(); |
4544 | Variable RestStatements = new Variable(); | 4913 | Variable RestStatements = new Variable(); |
4545 | Variable NextLevel = new Variable(); | 4914 | Variable NextLevel = new Variable(); |
4546 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"if", Expression, Body), RestStatements))) | 4915 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements))) |
4547 | { | 4916 | { |
4548 | convertIndentationJavascript(Level); | 4917 | convertIndentationJavascript(Level); |
4549 | YP.write(Atom.a(@"if (")); | 4918 | YP.write(Atom.a("if (")); |
4550 | convertExpressionJavascript(Expression); | 4919 | convertExpressionJavascript(Expression); |
4551 | YP.write(Atom.a(@") {")); | 4920 | YP.write(Atom.a(") {")); |
4552 | YP.nl(); | 4921 | YP.nl(); |
4553 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4922 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4554 | { | 4923 | { |
4555 | convertStatementListJavascript(Body, NextLevel); | 4924 | convertStatementListJavascript(Body, NextLevel); |
4556 | convertIndentationJavascript(Level); | 4925 | convertIndentationJavascript(Level); |
4557 | YP.write(Atom.a(@"}")); | 4926 | YP.write(Atom.a("}")); |
4558 | YP.nl(); | 4927 | YP.nl(); |
4559 | convertStatementListJavascript(RestStatements, Level); | 4928 | convertStatementListJavascript(RestStatements, Level); |
4560 | return; | 4929 | return; |
@@ -4567,20 +4936,20 @@ namespace Temporary { | |||
4567 | Variable Body = new Variable(); | 4936 | Variable Body = new Variable(); |
4568 | Variable RestStatements = new Variable(); | 4937 | Variable RestStatements = new Variable(); |
4569 | Variable NextLevel = new Variable(); | 4938 | Variable NextLevel = new Variable(); |
4570 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"foreach", Expression, Body), RestStatements))) | 4939 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements))) |
4571 | { | 4940 | { |
4572 | convertIndentationJavascript(Level); | 4941 | convertIndentationJavascript(Level); |
4573 | YP.write(Atom.a(@"for each (var l")); | 4942 | YP.write(Atom.a("for each (var l")); |
4574 | YP.write(Level); | 4943 | YP.write(Level); |
4575 | YP.write(Atom.a(@" in ")); | 4944 | YP.write(Atom.a(" in ")); |
4576 | convertExpressionJavascript(Expression); | 4945 | convertExpressionJavascript(Expression); |
4577 | YP.write(Atom.a(@") {")); | 4946 | YP.write(Atom.a(") {")); |
4578 | YP.nl(); | 4947 | YP.nl(); |
4579 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 4948 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4580 | { | 4949 | { |
4581 | convertStatementListJavascript(Body, NextLevel); | 4950 | convertStatementListJavascript(Body, NextLevel); |
4582 | convertIndentationJavascript(Level); | 4951 | convertIndentationJavascript(Level); |
4583 | YP.write(Atom.a(@"}")); | 4952 | YP.write(Atom.a("}")); |
4584 | YP.nl(); | 4953 | YP.nl(); |
4585 | convertStatementListJavascript(RestStatements, Level); | 4954 | convertStatementListJavascript(RestStatements, Level); |
4586 | return; | 4955 | return; |
@@ -4591,12 +4960,12 @@ namespace Temporary { | |||
4591 | object Level = arg2; | 4960 | object Level = arg2; |
4592 | Variable Expression = new Variable(); | 4961 | Variable Expression = new Variable(); |
4593 | Variable RestStatements = new Variable(); | 4962 | Variable RestStatements = new Variable(); |
4594 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"throw", Expression), RestStatements))) | 4963 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements))) |
4595 | { | 4964 | { |
4596 | convertIndentationJavascript(Level); | 4965 | convertIndentationJavascript(Level); |
4597 | YP.write(Atom.a(@"throw ")); | 4966 | YP.write(Atom.a("throw ")); |
4598 | convertExpressionJavascript(Expression); | 4967 | convertExpressionJavascript(Expression); |
4599 | YP.write(Atom.a(@";")); | 4968 | YP.write(Atom.a(";")); |
4600 | YP.nl(); | 4969 | YP.nl(); |
4601 | convertStatementListJavascript(RestStatements, Level); | 4970 | convertStatementListJavascript(RestStatements, Level); |
4602 | return; | 4971 | return; |
@@ -4610,7 +4979,7 @@ namespace Temporary { | |||
4610 | Variable N = new Variable(); | 4979 | Variable N = new Variable(); |
4611 | foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) | 4980 | foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) |
4612 | { | 4981 | { |
4613 | repeatWrite(Atom.a(@" "), N); | 4982 | repeatWrite(Atom.a(" "), N); |
4614 | return; | 4983 | return; |
4615 | } | 4984 | } |
4616 | } | 4985 | } |
@@ -4632,15 +5001,15 @@ namespace Temporary { | |||
4632 | convertExpressionJavascript(Head); | 5001 | convertExpressionJavascript(Head); |
4633 | if (YP.termNotEqual(Tail, Atom.NIL)) | 5002 | if (YP.termNotEqual(Tail, Atom.NIL)) |
4634 | { | 5003 | { |
4635 | YP.write(Atom.a(@", ")); | 5004 | YP.write(Atom.a(", ")); |
4636 | convertArgListJavascript(Tail); | 5005 | convertArgListJavascript(Tail); |
4637 | return; | 5006 | return; |
4638 | // goto cutIf1; | 5007 | goto cutIf1; |
4639 | } | 5008 | } |
4640 | convertArgListJavascript(Tail); | 5009 | convertArgListJavascript(Tail); |
4641 | return; | 5010 | return; |
4642 | // cutIf1: | 5011 | cutIf1: |
4643 | // { } | 5012 | { } |
4644 | } | 5013 | } |
4645 | } | 5014 | } |
4646 | } | 5015 | } |
@@ -4649,7 +5018,7 @@ namespace Temporary { | |||
4649 | { | 5018 | { |
4650 | { | 5019 | { |
4651 | Variable X = new Variable(); | 5020 | Variable X = new Variable(); |
4652 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"arg", X))) | 5021 | foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X))) |
4653 | { | 5022 | { |
4654 | YP.write(X); | 5023 | YP.write(X); |
4655 | return; | 5024 | return; |
@@ -4658,12 +5027,22 @@ namespace Temporary { | |||
4658 | { | 5027 | { |
4659 | Variable Name = new Variable(); | 5028 | Variable Name = new Variable(); |
4660 | Variable ArgList = new Variable(); | 5029 | Variable ArgList = new Variable(); |
4661 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"call", Name, ArgList))) | 5030 | foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList))) |
4662 | { | 5031 | { |
4663 | YP.write(Name); | 5032 | YP.write(Name); |
4664 | YP.write(Atom.a(@"(")); | 5033 | YP.write(Atom.a("(")); |
4665 | convertArgListJavascript(ArgList); | 5034 | convertArgListJavascript(ArgList); |
4666 | YP.write(Atom.a(@")")); | 5035 | YP.write(Atom.a(")")); |
5036 | return; | ||
5037 | } | ||
5038 | } | ||
5039 | { | ||
5040 | Variable Name = new Variable(); | ||
5041 | Variable _FunctorArgs = new Variable(); | ||
5042 | Variable ArgList = new Variable(); | ||
5043 | foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList))) | ||
5044 | { | ||
5045 | convertExpressionJavascript(new Functor2("call", Name, ArgList)); | ||
4667 | return; | 5046 | return; |
4668 | } | 5047 | } |
4669 | } | 5048 | } |
@@ -4671,90 +5050,90 @@ namespace Temporary { | |||
4671 | Variable Obj = new Variable(); | 5050 | Variable Obj = new Variable(); |
4672 | Variable Name = new Variable(); | 5051 | Variable Name = new Variable(); |
4673 | Variable ArgList = new Variable(); | 5052 | Variable ArgList = new Variable(); |
4674 | foreach (bool l2 in YP.unify(arg1, new Functor3(@"callMember", new Functor1(@"var", Obj), Name, ArgList))) | 5053 | foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList))) |
4675 | { | 5054 | { |
4676 | YP.write(Obj); | 5055 | YP.write(Obj); |
4677 | YP.write(Atom.a(@".")); | 5056 | YP.write(Atom.a(".")); |
4678 | YP.write(Name); | 5057 | YP.write(Name); |
4679 | YP.write(Atom.a(@"(")); | 5058 | YP.write(Atom.a("(")); |
4680 | convertArgListJavascript(ArgList); | 5059 | convertArgListJavascript(ArgList); |
4681 | YP.write(Atom.a(@")")); | 5060 | YP.write(Atom.a(")")); |
4682 | return; | 5061 | return; |
4683 | } | 5062 | } |
4684 | } | 5063 | } |
4685 | { | 5064 | { |
4686 | Variable Name = new Variable(); | 5065 | Variable Name = new Variable(); |
4687 | Variable ArgList = new Variable(); | 5066 | Variable ArgList = new Variable(); |
4688 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"new", Name, ArgList))) | 5067 | foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList))) |
4689 | { | 5068 | { |
4690 | YP.write(Atom.a(@"new ")); | 5069 | YP.write(Atom.a("new ")); |
4691 | YP.write(Name); | 5070 | YP.write(Name); |
4692 | YP.write(Atom.a(@"(")); | 5071 | YP.write(Atom.a("(")); |
4693 | convertArgListJavascript(ArgList); | 5072 | convertArgListJavascript(ArgList); |
4694 | YP.write(Atom.a(@")")); | 5073 | YP.write(Atom.a(")")); |
4695 | return; | 5074 | return; |
4696 | } | 5075 | } |
4697 | } | 5076 | } |
4698 | { | 5077 | { |
4699 | Variable Name = new Variable(); | 5078 | Variable Name = new Variable(); |
4700 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"var", Name))) | 5079 | foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name))) |
4701 | { | 5080 | { |
4702 | YP.write(Name); | 5081 | YP.write(Name); |
4703 | return; | 5082 | return; |
4704 | } | 5083 | } |
4705 | } | 5084 | } |
4706 | { | 5085 | { |
4707 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"null"))) | 5086 | foreach (bool l2 in YP.unify(arg1, Atom.a("null"))) |
4708 | { | 5087 | { |
4709 | YP.write(Atom.a(@"null")); | 5088 | YP.write(Atom.a("null")); |
4710 | return; | 5089 | return; |
4711 | } | 5090 | } |
4712 | } | 5091 | } |
4713 | { | 5092 | { |
4714 | Variable X = new Variable(); | 5093 | Variable X = new Variable(); |
4715 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"not", X))) | 5094 | foreach (bool l2 in YP.unify(arg1, new Functor1("not", X))) |
4716 | { | 5095 | { |
4717 | YP.write(Atom.a(@"!(")); | 5096 | YP.write(Atom.a("!(")); |
4718 | convertExpressionJavascript(X); | 5097 | convertExpressionJavascript(X); |
4719 | YP.write(Atom.a(@")")); | 5098 | YP.write(Atom.a(")")); |
4720 | return; | 5099 | return; |
4721 | } | 5100 | } |
4722 | } | 5101 | } |
4723 | { | 5102 | { |
4724 | Variable X = new Variable(); | 5103 | Variable X = new Variable(); |
4725 | Variable Y = new Variable(); | 5104 | Variable Y = new Variable(); |
4726 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"and", X, Y))) | 5105 | foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y))) |
4727 | { | 5106 | { |
4728 | YP.write(Atom.a(@"(")); | 5107 | YP.write(Atom.a("(")); |
4729 | convertExpressionJavascript(X); | 5108 | convertExpressionJavascript(X); |
4730 | YP.write(Atom.a(@") && (")); | 5109 | YP.write(Atom.a(") && (")); |
4731 | convertExpressionJavascript(Y); | 5110 | convertExpressionJavascript(Y); |
4732 | YP.write(Atom.a(@")")); | 5111 | YP.write(Atom.a(")")); |
4733 | return; | 5112 | return; |
4734 | } | 5113 | } |
4735 | } | 5114 | } |
4736 | { | 5115 | { |
4737 | Variable ArgList = new Variable(); | 5116 | Variable ArgList = new Variable(); |
4738 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"objectArray", ArgList))) | 5117 | foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList))) |
4739 | { | 5118 | { |
4740 | YP.write(Atom.a(@"[")); | 5119 | YP.write(Atom.a("[")); |
4741 | convertArgListJavascript(ArgList); | 5120 | convertArgListJavascript(ArgList); |
4742 | YP.write(Atom.a(@"]")); | 5121 | YP.write(Atom.a("]")); |
4743 | return; | 5122 | return; |
4744 | } | 5123 | } |
4745 | } | 5124 | } |
4746 | { | 5125 | { |
4747 | Variable X = new Variable(); | 5126 | Variable X = new Variable(); |
4748 | Variable Codes = new Variable(); | 5127 | Variable Codes = new Variable(); |
4749 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"object", X))) | 5128 | foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) |
4750 | { | 5129 | { |
4751 | if (YP.atom(X)) | 5130 | if (YP.atom(X)) |
4752 | { | 5131 | { |
4753 | YP.write(Atom.a(@"""")); | 5132 | YP.write(Atom.a("\"")); |
4754 | foreach (bool l4 in YP.atom_codes(X, Codes)) | 5133 | foreach (bool l4 in YP.atom_codes(X, Codes)) |
4755 | { | 5134 | { |
4756 | convertStringCodesJavascript(Codes); | 5135 | convertStringCodesJavascript(Codes); |
4757 | YP.write(Atom.a(@"""")); | 5136 | YP.write(Atom.a("\"")); |
4758 | return; | 5137 | return; |
4759 | } | 5138 | } |
4760 | } | 5139 | } |
@@ -4762,7 +5141,7 @@ namespace Temporary { | |||
4762 | } | 5141 | } |
4763 | { | 5142 | { |
4764 | Variable X = new Variable(); | 5143 | Variable X = new Variable(); |
4765 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"object", X))) | 5144 | foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) |
4766 | { | 5145 | { |
4767 | YP.write(X); | 5146 | YP.write(X); |
4768 | return; | 5147 | return; |
@@ -4783,27 +5162,11 @@ namespace Temporary { | |||
4783 | Variable RestCodes = new Variable(); | 5162 | Variable RestCodes = new Variable(); |
4784 | foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes))) | 5163 | foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes))) |
4785 | { | 5164 | { |
4786 | if (YP.termEqual(Code, 34)) | 5165 | foreach (bool l3 in putCStringCode(Code)) |
4787 | { | 5166 | { |
4788 | YP.put_code(92); | ||
4789 | YP.put_code(Code); | ||
4790 | convertStringCodesJavascript(RestCodes); | 5167 | convertStringCodesJavascript(RestCodes); |
4791 | return; | 5168 | return; |
4792 | // goto cutIf1; | ||
4793 | } | 5169 | } |
4794 | if (YP.termEqual(Code, 92)) | ||
4795 | { | ||
4796 | YP.put_code(92); | ||
4797 | YP.put_code(Code); | ||
4798 | convertStringCodesJavascript(RestCodes); | ||
4799 | return; | ||
4800 | // goto cutIf1; | ||
4801 | } | ||
4802 | YP.put_code(Code); | ||
4803 | convertStringCodesJavascript(RestCodes); | ||
4804 | return; | ||
4805 | // cutIf1: | ||
4806 | // { } | ||
4807 | } | 5170 | } |
4808 | } | 5171 | } |
4809 | } | 5172 | } |
@@ -4811,11 +5174,11 @@ namespace Temporary { | |||
4811 | public static void convertFunctionPython(object arg1) | 5174 | public static void convertFunctionPython(object arg1) |
4812 | { | 5175 | { |
4813 | { | 5176 | { |
4814 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"getDeclaringClass"))) | 5177 | foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass"))) |
4815 | { | 5178 | { |
4816 | YP.write(Atom.a(@"def getDeclaringClass():")); | 5179 | YP.write(Atom.a("def getDeclaringClass():")); |
4817 | YP.nl(); | 5180 | YP.nl(); |
4818 | YP.write(Atom.a(@" return None")); | 5181 | YP.write(Atom.a(" return None")); |
4819 | YP.nl(); | 5182 | YP.nl(); |
4820 | YP.nl(); | 5183 | YP.nl(); |
4821 | return; | 5184 | return; |
@@ -4828,13 +5191,13 @@ namespace Temporary { | |||
4828 | Variable Body = new Variable(); | 5191 | Variable Body = new Variable(); |
4829 | Variable Level = new Variable(); | 5192 | Variable Level = new Variable(); |
4830 | Variable HasBreakableBlock = new Variable(); | 5193 | Variable HasBreakableBlock = new Variable(); |
4831 | foreach (bool l2 in YP.unify(arg1, new Functor(@"function", new object[] { x1, Name, ArgList, Body }))) | 5194 | foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body }))) |
4832 | { | 5195 | { |
4833 | YP.write(Atom.a(@"def ")); | 5196 | YP.write(Atom.a("def ")); |
4834 | YP.write(Name); | 5197 | YP.write(Name); |
4835 | YP.write(Atom.a(@"(")); | 5198 | YP.write(Atom.a("(")); |
4836 | convertArgListPython(ArgList); | 5199 | convertArgListPython(ArgList); |
4837 | YP.write(Atom.a(@"):")); | 5200 | YP.write(Atom.a("):")); |
4838 | YP.nl(); | 5201 | YP.nl(); |
4839 | foreach (bool l3 in YP.unify(Level, 1)) | 5202 | foreach (bool l3 in YP.unify(Level, 1)) |
4840 | { | 5203 | { |
@@ -4845,7 +5208,7 @@ namespace Temporary { | |||
4845 | if (YP.termEqual(HasBreakableBlock, 1)) | 5208 | if (YP.termEqual(HasBreakableBlock, 1)) |
4846 | { | 5209 | { |
4847 | convertIndentationPython(Level); | 5210 | convertIndentationPython(Level); |
4848 | YP.write(Atom.a(@"doBreak = False")); | 5211 | YP.write(Atom.a("doBreak = False")); |
4849 | YP.nl(); | 5212 | YP.nl(); |
4850 | foreach (bool l7 in convertStatementListPython(Body, Level, HasBreakableBlock)) | 5213 | foreach (bool l7 in convertStatementListPython(Body, Level, HasBreakableBlock)) |
4851 | { | 5214 | { |
@@ -4869,7 +5232,7 @@ namespace Temporary { | |||
4869 | if (YP.termEqual(HasBreakableBlock, 1)) | 5232 | if (YP.termEqual(HasBreakableBlock, 1)) |
4870 | { | 5233 | { |
4871 | convertIndentationPython(Level); | 5234 | convertIndentationPython(Level); |
4872 | YP.write(Atom.a(@"doBreak = False")); | 5235 | YP.write(Atom.a("doBreak = False")); |
4873 | YP.nl(); | 5236 | YP.nl(); |
4874 | foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock)) | 5237 | foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock)) |
4875 | { | 5238 | { |
@@ -4899,7 +5262,7 @@ namespace Temporary { | |||
4899 | Variable _Name = new Variable(); | 5262 | Variable _Name = new Variable(); |
4900 | Variable _Body = new Variable(); | 5263 | Variable _Body = new Variable(); |
4901 | Variable _RestStatements = new Variable(); | 5264 | Variable _RestStatements = new Variable(); |
4902 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"breakableBlock", _Name, _Body), _RestStatements))) | 5265 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", _Name, _Body), _RestStatements))) |
4903 | { | 5266 | { |
4904 | return true; | 5267 | return true; |
4905 | } | 5268 | } |
@@ -4907,7 +5270,7 @@ namespace Temporary { | |||
4907 | { | 5270 | { |
4908 | Variable Body = new Variable(); | 5271 | Variable Body = new Variable(); |
4909 | Variable _RestStatements = new Variable(); | 5272 | Variable _RestStatements = new Variable(); |
4910 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"blockScope", Body), _RestStatements))) | 5273 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), _RestStatements))) |
4911 | { | 5274 | { |
4912 | if (hasBreakableBlockPython(Body)) | 5275 | if (hasBreakableBlockPython(Body)) |
4913 | { | 5276 | { |
@@ -4919,7 +5282,7 @@ namespace Temporary { | |||
4919 | Variable _Expression = new Variable(); | 5282 | Variable _Expression = new Variable(); |
4920 | Variable Body = new Variable(); | 5283 | Variable Body = new Variable(); |
4921 | Variable _RestStatements = new Variable(); | 5284 | Variable _RestStatements = new Variable(); |
4922 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"if", _Expression, Body), _RestStatements))) | 5285 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", _Expression, Body), _RestStatements))) |
4923 | { | 5286 | { |
4924 | if (hasBreakableBlockPython(Body)) | 5287 | if (hasBreakableBlockPython(Body)) |
4925 | { | 5288 | { |
@@ -4931,7 +5294,7 @@ namespace Temporary { | |||
4931 | Variable _Expression = new Variable(); | 5294 | Variable _Expression = new Variable(); |
4932 | Variable Body = new Variable(); | 5295 | Variable Body = new Variable(); |
4933 | Variable _RestStatements = new Variable(); | 5296 | Variable _RestStatements = new Variable(); |
4934 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"foreach", _Expression, Body), _RestStatements))) | 5297 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", _Expression, Body), _RestStatements))) |
4935 | { | 5298 | { |
4936 | if (hasBreakableBlockPython(Body)) | 5299 | if (hasBreakableBlockPython(Body)) |
4937 | { | 5300 | { |
@@ -4971,32 +5334,32 @@ namespace Temporary { | |||
4971 | Variable Body = new Variable(); | 5334 | Variable Body = new Variable(); |
4972 | Variable RestStatements = new Variable(); | 5335 | Variable RestStatements = new Variable(); |
4973 | Variable NextLevel = new Variable(); | 5336 | Variable NextLevel = new Variable(); |
4974 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"breakableBlock", Name, Body), RestStatements))) | 5337 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements))) |
4975 | { | 5338 | { |
4976 | convertIndentationPython(Level); | 5339 | convertIndentationPython(Level); |
4977 | YP.write(Name); | 5340 | YP.write(Name); |
4978 | YP.write(Atom.a(@" = False")); | 5341 | YP.write(Atom.a(" = False")); |
4979 | YP.nl(); | 5342 | YP.nl(); |
4980 | convertIndentationPython(Level); | 5343 | convertIndentationPython(Level); |
4981 | YP.write(Atom.a(@"for _ in [1]:")); | 5344 | YP.write(Atom.a("for _ in [1]:")); |
4982 | YP.nl(); | 5345 | YP.nl(); |
4983 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 5346 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
4984 | { | 5347 | { |
4985 | foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) | 5348 | foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock)) |
4986 | { | 5349 | { |
4987 | convertIndentationPython(Level); | 5350 | convertIndentationPython(Level); |
4988 | YP.write(Atom.a(@"if ")); | 5351 | YP.write(Atom.a("if ")); |
4989 | YP.write(Name); | 5352 | YP.write(Name); |
4990 | YP.write(Atom.a(@":")); | 5353 | YP.write(Atom.a(":")); |
4991 | YP.nl(); | 5354 | YP.nl(); |
4992 | convertIndentationPython(NextLevel); | 5355 | convertIndentationPython(NextLevel); |
4993 | YP.write(Atom.a(@"doBreak = False")); | 5356 | YP.write(Atom.a("doBreak = False")); |
4994 | YP.nl(); | 5357 | YP.nl(); |
4995 | convertIndentationPython(Level); | 5358 | convertIndentationPython(Level); |
4996 | YP.write(Atom.a(@"if doBreak:")); | 5359 | YP.write(Atom.a("if doBreak:")); |
4997 | YP.nl(); | 5360 | YP.nl(); |
4998 | convertIndentationPython(NextLevel); | 5361 | convertIndentationPython(NextLevel); |
4999 | YP.write(Atom.a(@"break")); | 5362 | YP.write(Atom.a("break")); |
5000 | YP.nl(); | 5363 | YP.nl(); |
5001 | foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5364 | foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5002 | { | 5365 | { |
@@ -5014,11 +5377,11 @@ namespace Temporary { | |||
5014 | Variable Name = new Variable(); | 5377 | Variable Name = new Variable(); |
5015 | Variable Expression = new Variable(); | 5378 | Variable Expression = new Variable(); |
5016 | Variable RestStatements = new Variable(); | 5379 | Variable RestStatements = new Variable(); |
5017 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3(@"declare", _Type, Name, Expression), RestStatements))) | 5380 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements))) |
5018 | { | 5381 | { |
5019 | convertIndentationPython(Level); | 5382 | convertIndentationPython(Level); |
5020 | YP.write(Name); | 5383 | YP.write(Name); |
5021 | YP.write(Atom.a(@" = ")); | 5384 | YP.write(Atom.a(" = ")); |
5022 | convertExpressionPython(Expression); | 5385 | convertExpressionPython(Expression); |
5023 | YP.nl(); | 5386 | YP.nl(); |
5024 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5387 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
@@ -5034,11 +5397,11 @@ namespace Temporary { | |||
5034 | Variable Name = new Variable(); | 5397 | Variable Name = new Variable(); |
5035 | Variable Expression = new Variable(); | 5398 | Variable Expression = new Variable(); |
5036 | Variable RestStatements = new Variable(); | 5399 | Variable RestStatements = new Variable(); |
5037 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"assign", Name, Expression), RestStatements))) | 5400 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements))) |
5038 | { | 5401 | { |
5039 | convertIndentationPython(Level); | 5402 | convertIndentationPython(Level); |
5040 | YP.write(Name); | 5403 | YP.write(Name); |
5041 | YP.write(Atom.a(@" = ")); | 5404 | YP.write(Atom.a(" = ")); |
5042 | convertExpressionPython(Expression); | 5405 | convertExpressionPython(Expression); |
5043 | YP.nl(); | 5406 | YP.nl(); |
5044 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5407 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
@@ -5052,10 +5415,10 @@ namespace Temporary { | |||
5052 | object Level = arg2; | 5415 | object Level = arg2; |
5053 | object HasBreakableBlock = arg3; | 5416 | object HasBreakableBlock = arg3; |
5054 | Variable RestStatements = new Variable(); | 5417 | Variable RestStatements = new Variable(); |
5055 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldtrue"), RestStatements))) | 5418 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements))) |
5056 | { | 5419 | { |
5057 | convertIndentationPython(Level); | 5420 | convertIndentationPython(Level); |
5058 | YP.write(Atom.a(@"yield True")); | 5421 | YP.write(Atom.a("yield True")); |
5059 | YP.nl(); | 5422 | YP.nl(); |
5060 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5423 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5061 | { | 5424 | { |
@@ -5068,10 +5431,10 @@ namespace Temporary { | |||
5068 | object Level = arg2; | 5431 | object Level = arg2; |
5069 | object HasBreakableBlock = arg3; | 5432 | object HasBreakableBlock = arg3; |
5070 | Variable RestStatements = new Variable(); | 5433 | Variable RestStatements = new Variable(); |
5071 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldfalse"), RestStatements))) | 5434 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements))) |
5072 | { | 5435 | { |
5073 | convertIndentationPython(Level); | 5436 | convertIndentationPython(Level); |
5074 | YP.write(Atom.a(@"yield False")); | 5437 | YP.write(Atom.a("yield False")); |
5075 | YP.nl(); | 5438 | YP.nl(); |
5076 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5439 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5077 | { | 5440 | { |
@@ -5084,10 +5447,10 @@ namespace Temporary { | |||
5084 | object Level = arg2; | 5447 | object Level = arg2; |
5085 | object HasBreakableBlock = arg3; | 5448 | object HasBreakableBlock = arg3; |
5086 | Variable RestStatements = new Variable(); | 5449 | Variable RestStatements = new Variable(); |
5087 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"yieldbreak"), RestStatements))) | 5450 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements))) |
5088 | { | 5451 | { |
5089 | convertIndentationPython(Level); | 5452 | convertIndentationPython(Level); |
5090 | YP.write(Atom.a(@"return")); | 5453 | YP.write(Atom.a("return")); |
5091 | YP.nl(); | 5454 | YP.nl(); |
5092 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5455 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5093 | { | 5456 | { |
@@ -5100,10 +5463,10 @@ namespace Temporary { | |||
5100 | object Level = arg2; | 5463 | object Level = arg2; |
5101 | object HasBreakableBlock = arg3; | 5464 | object HasBreakableBlock = arg3; |
5102 | Variable RestStatements = new Variable(); | 5465 | Variable RestStatements = new Variable(); |
5103 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"return"), RestStatements))) | 5466 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements))) |
5104 | { | 5467 | { |
5105 | convertIndentationPython(Level); | 5468 | convertIndentationPython(Level); |
5106 | YP.write(Atom.a(@"return")); | 5469 | YP.write(Atom.a("return")); |
5107 | YP.nl(); | 5470 | YP.nl(); |
5108 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5471 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5109 | { | 5472 | { |
@@ -5116,10 +5479,10 @@ namespace Temporary { | |||
5116 | object Level = arg2; | 5479 | object Level = arg2; |
5117 | object HasBreakableBlock = arg3; | 5480 | object HasBreakableBlock = arg3; |
5118 | Variable RestStatements = new Variable(); | 5481 | Variable RestStatements = new Variable(); |
5119 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"returntrue"), RestStatements))) | 5482 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements))) |
5120 | { | 5483 | { |
5121 | convertIndentationPython(Level); | 5484 | convertIndentationPython(Level); |
5122 | YP.write(Atom.a(@"return True")); | 5485 | YP.write(Atom.a("return True")); |
5123 | YP.nl(); | 5486 | YP.nl(); |
5124 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5487 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5125 | { | 5488 | { |
@@ -5132,10 +5495,10 @@ namespace Temporary { | |||
5132 | object Level = arg2; | 5495 | object Level = arg2; |
5133 | object HasBreakableBlock = arg3; | 5496 | object HasBreakableBlock = arg3; |
5134 | Variable RestStatements = new Variable(); | 5497 | Variable RestStatements = new Variable(); |
5135 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@"returnfalse"), RestStatements))) | 5498 | foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements))) |
5136 | { | 5499 | { |
5137 | convertIndentationPython(Level); | 5500 | convertIndentationPython(Level); |
5138 | YP.write(Atom.a(@"return False")); | 5501 | YP.write(Atom.a("return False")); |
5139 | YP.nl(); | 5502 | YP.nl(); |
5140 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5503 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5141 | { | 5504 | { |
@@ -5149,17 +5512,17 @@ namespace Temporary { | |||
5149 | object HasBreakableBlock = arg3; | 5512 | object HasBreakableBlock = arg3; |
5150 | Variable Name = new Variable(); | 5513 | Variable Name = new Variable(); |
5151 | Variable RestStatements = new Variable(); | 5514 | Variable RestStatements = new Variable(); |
5152 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"breakBlock", Name), RestStatements))) | 5515 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements))) |
5153 | { | 5516 | { |
5154 | convertIndentationPython(Level); | 5517 | convertIndentationPython(Level); |
5155 | YP.write(Name); | 5518 | YP.write(Name); |
5156 | YP.write(Atom.a(@" = True")); | 5519 | YP.write(Atom.a(" = True")); |
5157 | YP.nl(); | 5520 | YP.nl(); |
5158 | convertIndentationPython(Level); | 5521 | convertIndentationPython(Level); |
5159 | YP.write(Atom.a(@"doBreak = True")); | 5522 | YP.write(Atom.a("doBreak = True")); |
5160 | YP.nl(); | 5523 | YP.nl(); |
5161 | convertIndentationPython(Level); | 5524 | convertIndentationPython(Level); |
5162 | YP.write(Atom.a(@"break")); | 5525 | YP.write(Atom.a("break")); |
5163 | YP.nl(); | 5526 | YP.nl(); |
5164 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5527 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5165 | { | 5528 | { |
@@ -5174,13 +5537,13 @@ namespace Temporary { | |||
5174 | Variable Name = new Variable(); | 5537 | Variable Name = new Variable(); |
5175 | Variable ArgList = new Variable(); | 5538 | Variable ArgList = new Variable(); |
5176 | Variable RestStatements = new Variable(); | 5539 | Variable RestStatements = new Variable(); |
5177 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"call", Name, ArgList), RestStatements))) | 5540 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements))) |
5178 | { | 5541 | { |
5179 | convertIndentationPython(Level); | 5542 | convertIndentationPython(Level); |
5180 | YP.write(Name); | 5543 | YP.write(Name); |
5181 | YP.write(Atom.a(@"(")); | 5544 | YP.write(Atom.a("(")); |
5182 | convertArgListPython(ArgList); | 5545 | convertArgListPython(ArgList); |
5183 | YP.write(Atom.a(@")")); | 5546 | YP.write(Atom.a(")")); |
5184 | YP.nl(); | 5547 | YP.nl(); |
5185 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5548 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5186 | { | 5549 | { |
@@ -5192,19 +5555,35 @@ namespace Temporary { | |||
5192 | { | 5555 | { |
5193 | object Level = arg2; | 5556 | object Level = arg2; |
5194 | object HasBreakableBlock = arg3; | 5557 | object HasBreakableBlock = arg3; |
5558 | Variable Name = new Variable(); | ||
5559 | Variable _FunctorArgs = new Variable(); | ||
5560 | Variable ArgList = new Variable(); | ||
5561 | Variable RestStatements = new Variable(); | ||
5562 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements))) | ||
5563 | { | ||
5564 | foreach (bool l3 in convertStatementListPython(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level, HasBreakableBlock)) | ||
5565 | { | ||
5566 | yield return true; | ||
5567 | yield break; | ||
5568 | } | ||
5569 | } | ||
5570 | } | ||
5571 | { | ||
5572 | object Level = arg2; | ||
5573 | object HasBreakableBlock = arg3; | ||
5195 | Variable Obj = new Variable(); | 5574 | Variable Obj = new Variable(); |
5196 | Variable Name = new Variable(); | 5575 | Variable Name = new Variable(); |
5197 | Variable ArgList = new Variable(); | 5576 | Variable ArgList = new Variable(); |
5198 | Variable RestStatements = new Variable(); | 5577 | Variable RestStatements = new Variable(); |
5199 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3(@"callMember", new Functor1(@"var", Obj), Name, ArgList), RestStatements))) | 5578 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements))) |
5200 | { | 5579 | { |
5201 | convertIndentationPython(Level); | 5580 | convertIndentationPython(Level); |
5202 | YP.write(Obj); | 5581 | YP.write(Obj); |
5203 | YP.write(Atom.a(@".")); | 5582 | YP.write(Atom.a(".")); |
5204 | YP.write(Name); | 5583 | YP.write(Name); |
5205 | YP.write(Atom.a(@"(")); | 5584 | YP.write(Atom.a("(")); |
5206 | convertArgListPython(ArgList); | 5585 | convertArgListPython(ArgList); |
5207 | YP.write(Atom.a(@")")); | 5586 | YP.write(Atom.a(")")); |
5208 | YP.nl(); | 5587 | YP.nl(); |
5209 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5588 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5210 | { | 5589 | { |
@@ -5219,12 +5598,12 @@ namespace Temporary { | |||
5219 | Variable Body = new Variable(); | 5598 | Variable Body = new Variable(); |
5220 | Variable RestStatements = new Variable(); | 5599 | Variable RestStatements = new Variable(); |
5221 | Variable NextLevel = new Variable(); | 5600 | Variable NextLevel = new Variable(); |
5222 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"blockScope", Body), RestStatements))) | 5601 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements))) |
5223 | { | 5602 | { |
5224 | if (YP.termEqual(HasBreakableBlock, 1)) | 5603 | if (YP.termEqual(HasBreakableBlock, 1)) |
5225 | { | 5604 | { |
5226 | convertIndentationPython(Level); | 5605 | convertIndentationPython(Level); |
5227 | YP.write(Atom.a(@"for _ in [1]:")); | 5606 | YP.write(Atom.a("for _ in [1]:")); |
5228 | YP.nl(); | 5607 | YP.nl(); |
5229 | foreach (bool l4 in YP.unify(NextLevel, YP.add(Level, 1))) | 5608 | foreach (bool l4 in YP.unify(NextLevel, YP.add(Level, 1))) |
5230 | { | 5609 | { |
@@ -5235,10 +5614,10 @@ namespace Temporary { | |||
5235 | if (YP.greaterThan(Level, 1)) | 5614 | if (YP.greaterThan(Level, 1)) |
5236 | { | 5615 | { |
5237 | convertIndentationPython(Level); | 5616 | convertIndentationPython(Level); |
5238 | YP.write(Atom.a(@"if doBreak:")); | 5617 | YP.write(Atom.a("if doBreak:")); |
5239 | YP.nl(); | 5618 | YP.nl(); |
5240 | convertIndentationPython(NextLevel); | 5619 | convertIndentationPython(NextLevel); |
5241 | YP.write(Atom.a(@"break")); | 5620 | YP.write(Atom.a("break")); |
5242 | YP.nl(); | 5621 | YP.nl(); |
5243 | foreach (bool l8 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5622 | foreach (bool l8 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5244 | { | 5623 | { |
@@ -5275,10 +5654,10 @@ namespace Temporary { | |||
5275 | if (YP.greaterThan(Level, 1)) | 5654 | if (YP.greaterThan(Level, 1)) |
5276 | { | 5655 | { |
5277 | convertIndentationPython(Level); | 5656 | convertIndentationPython(Level); |
5278 | YP.write(Atom.a(@"if doBreak:")); | 5657 | YP.write(Atom.a("if doBreak:")); |
5279 | YP.nl(); | 5658 | YP.nl(); |
5280 | convertIndentationPython(NextLevel); | 5659 | convertIndentationPython(NextLevel); |
5281 | YP.write(Atom.a(@"break")); | 5660 | YP.write(Atom.a("break")); |
5282 | YP.nl(); | 5661 | YP.nl(); |
5283 | foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5662 | foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5284 | { | 5663 | { |
@@ -5315,12 +5694,12 @@ namespace Temporary { | |||
5315 | Variable Body = new Variable(); | 5694 | Variable Body = new Variable(); |
5316 | Variable RestStatements = new Variable(); | 5695 | Variable RestStatements = new Variable(); |
5317 | Variable NextLevel = new Variable(); | 5696 | Variable NextLevel = new Variable(); |
5318 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"if", Expression, Body), RestStatements))) | 5697 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements))) |
5319 | { | 5698 | { |
5320 | convertIndentationPython(Level); | 5699 | convertIndentationPython(Level); |
5321 | YP.write(Atom.a(@"if ")); | 5700 | YP.write(Atom.a("if ")); |
5322 | convertExpressionPython(Expression); | 5701 | convertExpressionPython(Expression); |
5323 | YP.write(Atom.a(@":")); | 5702 | YP.write(Atom.a(":")); |
5324 | YP.nl(); | 5703 | YP.nl(); |
5325 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 5704 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
5326 | { | 5705 | { |
@@ -5342,14 +5721,14 @@ namespace Temporary { | |||
5342 | Variable Body = new Variable(); | 5721 | Variable Body = new Variable(); |
5343 | Variable RestStatements = new Variable(); | 5722 | Variable RestStatements = new Variable(); |
5344 | Variable NextLevel = new Variable(); | 5723 | Variable NextLevel = new Variable(); |
5345 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"foreach", Expression, Body), RestStatements))) | 5724 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements))) |
5346 | { | 5725 | { |
5347 | convertIndentationPython(Level); | 5726 | convertIndentationPython(Level); |
5348 | YP.write(Atom.a(@"for l")); | 5727 | YP.write(Atom.a("for l")); |
5349 | YP.write(Level); | 5728 | YP.write(Level); |
5350 | YP.write(Atom.a(@" in ")); | 5729 | YP.write(Atom.a(" in ")); |
5351 | convertExpressionPython(Expression); | 5730 | convertExpressionPython(Expression); |
5352 | YP.write(Atom.a(@":")); | 5731 | YP.write(Atom.a(":")); |
5353 | YP.nl(); | 5732 | YP.nl(); |
5354 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) | 5733 | foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1))) |
5355 | { | 5734 | { |
@@ -5358,10 +5737,10 @@ namespace Temporary { | |||
5358 | if (YP.termEqual(HasBreakableBlock, 1)) | 5737 | if (YP.termEqual(HasBreakableBlock, 1)) |
5359 | { | 5738 | { |
5360 | convertIndentationPython(Level); | 5739 | convertIndentationPython(Level); |
5361 | YP.write(Atom.a(@"if doBreak:")); | 5740 | YP.write(Atom.a("if doBreak:")); |
5362 | YP.nl(); | 5741 | YP.nl(); |
5363 | convertIndentationPython(NextLevel); | 5742 | convertIndentationPython(NextLevel); |
5364 | YP.write(Atom.a(@"break")); | 5743 | YP.write(Atom.a("break")); |
5365 | YP.nl(); | 5744 | YP.nl(); |
5366 | foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5745 | foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
5367 | { | 5746 | { |
@@ -5386,10 +5765,10 @@ namespace Temporary { | |||
5386 | object HasBreakableBlock = arg3; | 5765 | object HasBreakableBlock = arg3; |
5387 | Variable Expression = new Variable(); | 5766 | Variable Expression = new Variable(); |
5388 | Variable RestStatements = new Variable(); | 5767 | Variable RestStatements = new Variable(); |
5389 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1(@"throw", Expression), RestStatements))) | 5768 | foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements))) |
5390 | { | 5769 | { |
5391 | convertIndentationPython(Level); | 5770 | convertIndentationPython(Level); |
5392 | YP.write(Atom.a(@"raise ")); | 5771 | YP.write(Atom.a("raise ")); |
5393 | convertExpressionPython(Expression); | 5772 | convertExpressionPython(Expression); |
5394 | YP.nl(); | 5773 | YP.nl(); |
5395 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) | 5774 | foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock)) |
@@ -5407,7 +5786,7 @@ namespace Temporary { | |||
5407 | Variable N = new Variable(); | 5786 | Variable N = new Variable(); |
5408 | foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) | 5787 | foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2))) |
5409 | { | 5788 | { |
5410 | repeatWrite(Atom.a(@" "), N); | 5789 | repeatWrite(Atom.a(" "), N); |
5411 | return; | 5790 | return; |
5412 | } | 5791 | } |
5413 | } | 5792 | } |
@@ -5429,15 +5808,15 @@ namespace Temporary { | |||
5429 | convertExpressionPython(Head); | 5808 | convertExpressionPython(Head); |
5430 | if (YP.termNotEqual(Tail, Atom.NIL)) | 5809 | if (YP.termNotEqual(Tail, Atom.NIL)) |
5431 | { | 5810 | { |
5432 | YP.write(Atom.a(@", ")); | 5811 | YP.write(Atom.a(", ")); |
5433 | convertArgListPython(Tail); | 5812 | convertArgListPython(Tail); |
5434 | return; | 5813 | return; |
5435 | // goto cutIf1; | 5814 | goto cutIf1; |
5436 | } | 5815 | } |
5437 | convertArgListPython(Tail); | 5816 | convertArgListPython(Tail); |
5438 | return; | 5817 | return; |
5439 | // cutIf1: | 5818 | cutIf1: |
5440 | // { } | 5819 | { } |
5441 | } | 5820 | } |
5442 | } | 5821 | } |
5443 | } | 5822 | } |
@@ -5446,7 +5825,7 @@ namespace Temporary { | |||
5446 | { | 5825 | { |
5447 | { | 5826 | { |
5448 | Variable X = new Variable(); | 5827 | Variable X = new Variable(); |
5449 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"arg", X))) | 5828 | foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X))) |
5450 | { | 5829 | { |
5451 | YP.write(X); | 5830 | YP.write(X); |
5452 | return; | 5831 | return; |
@@ -5455,12 +5834,22 @@ namespace Temporary { | |||
5455 | { | 5834 | { |
5456 | Variable Name = new Variable(); | 5835 | Variable Name = new Variable(); |
5457 | Variable ArgList = new Variable(); | 5836 | Variable ArgList = new Variable(); |
5458 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"call", Name, ArgList))) | 5837 | foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList))) |
5459 | { | 5838 | { |
5460 | YP.write(Name); | 5839 | YP.write(Name); |
5461 | YP.write(Atom.a(@"(")); | 5840 | YP.write(Atom.a("(")); |
5462 | convertArgListPython(ArgList); | 5841 | convertArgListPython(ArgList); |
5463 | YP.write(Atom.a(@")")); | 5842 | YP.write(Atom.a(")")); |
5843 | return; | ||
5844 | } | ||
5845 | } | ||
5846 | { | ||
5847 | Variable Name = new Variable(); | ||
5848 | Variable _FunctorArgs = new Variable(); | ||
5849 | Variable ArgList = new Variable(); | ||
5850 | foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList))) | ||
5851 | { | ||
5852 | convertExpressionPython(new Functor2("call", Name, ArgList)); | ||
5464 | return; | 5853 | return; |
5465 | } | 5854 | } |
5466 | } | 5855 | } |
@@ -5468,89 +5857,89 @@ namespace Temporary { | |||
5468 | Variable Obj = new Variable(); | 5857 | Variable Obj = new Variable(); |
5469 | Variable Name = new Variable(); | 5858 | Variable Name = new Variable(); |
5470 | Variable ArgList = new Variable(); | 5859 | Variable ArgList = new Variable(); |
5471 | foreach (bool l2 in YP.unify(arg1, new Functor3(@"callMember", new Functor1(@"var", Obj), Name, ArgList))) | 5860 | foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList))) |
5472 | { | 5861 | { |
5473 | YP.write(Obj); | 5862 | YP.write(Obj); |
5474 | YP.write(Atom.a(@".")); | 5863 | YP.write(Atom.a(".")); |
5475 | YP.write(Name); | 5864 | YP.write(Name); |
5476 | YP.write(Atom.a(@"(")); | 5865 | YP.write(Atom.a("(")); |
5477 | convertArgListPython(ArgList); | 5866 | convertArgListPython(ArgList); |
5478 | YP.write(Atom.a(@")")); | 5867 | YP.write(Atom.a(")")); |
5479 | return; | 5868 | return; |
5480 | } | 5869 | } |
5481 | } | 5870 | } |
5482 | { | 5871 | { |
5483 | Variable Name = new Variable(); | 5872 | Variable Name = new Variable(); |
5484 | Variable ArgList = new Variable(); | 5873 | Variable ArgList = new Variable(); |
5485 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"new", Name, ArgList))) | 5874 | foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList))) |
5486 | { | 5875 | { |
5487 | YP.write(Name); | 5876 | YP.write(Name); |
5488 | YP.write(Atom.a(@"(")); | 5877 | YP.write(Atom.a("(")); |
5489 | convertArgListPython(ArgList); | 5878 | convertArgListPython(ArgList); |
5490 | YP.write(Atom.a(@")")); | 5879 | YP.write(Atom.a(")")); |
5491 | return; | 5880 | return; |
5492 | } | 5881 | } |
5493 | } | 5882 | } |
5494 | { | 5883 | { |
5495 | Variable Name = new Variable(); | 5884 | Variable Name = new Variable(); |
5496 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"var", Name))) | 5885 | foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name))) |
5497 | { | 5886 | { |
5498 | YP.write(Name); | 5887 | YP.write(Name); |
5499 | return; | 5888 | return; |
5500 | } | 5889 | } |
5501 | } | 5890 | } |
5502 | { | 5891 | { |
5503 | foreach (bool l2 in YP.unify(arg1, Atom.a(@"null"))) | 5892 | foreach (bool l2 in YP.unify(arg1, Atom.a("null"))) |
5504 | { | 5893 | { |
5505 | YP.write(Atom.a(@"None")); | 5894 | YP.write(Atom.a("None")); |
5506 | return; | 5895 | return; |
5507 | } | 5896 | } |
5508 | } | 5897 | } |
5509 | { | 5898 | { |
5510 | Variable X = new Variable(); | 5899 | Variable X = new Variable(); |
5511 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"not", X))) | 5900 | foreach (bool l2 in YP.unify(arg1, new Functor1("not", X))) |
5512 | { | 5901 | { |
5513 | YP.write(Atom.a(@"not (")); | 5902 | YP.write(Atom.a("not (")); |
5514 | convertExpressionPython(X); | 5903 | convertExpressionPython(X); |
5515 | YP.write(Atom.a(@")")); | 5904 | YP.write(Atom.a(")")); |
5516 | return; | 5905 | return; |
5517 | } | 5906 | } |
5518 | } | 5907 | } |
5519 | { | 5908 | { |
5520 | Variable X = new Variable(); | 5909 | Variable X = new Variable(); |
5521 | Variable Y = new Variable(); | 5910 | Variable Y = new Variable(); |
5522 | foreach (bool l2 in YP.unify(arg1, new Functor2(@"and", X, Y))) | 5911 | foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y))) |
5523 | { | 5912 | { |
5524 | YP.write(Atom.a(@"(")); | 5913 | YP.write(Atom.a("(")); |
5525 | convertExpressionPython(X); | 5914 | convertExpressionPython(X); |
5526 | YP.write(Atom.a(@") and (")); | 5915 | YP.write(Atom.a(") and (")); |
5527 | convertExpressionPython(Y); | 5916 | convertExpressionPython(Y); |
5528 | YP.write(Atom.a(@")")); | 5917 | YP.write(Atom.a(")")); |
5529 | return; | 5918 | return; |
5530 | } | 5919 | } |
5531 | } | 5920 | } |
5532 | { | 5921 | { |
5533 | Variable ArgList = new Variable(); | 5922 | Variable ArgList = new Variable(); |
5534 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"objectArray", ArgList))) | 5923 | foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList))) |
5535 | { | 5924 | { |
5536 | YP.write(Atom.a(@"[")); | 5925 | YP.write(Atom.a("[")); |
5537 | convertArgListPython(ArgList); | 5926 | convertArgListPython(ArgList); |
5538 | YP.write(Atom.a(@"]")); | 5927 | YP.write(Atom.a("]")); |
5539 | return; | 5928 | return; |
5540 | } | 5929 | } |
5541 | } | 5930 | } |
5542 | { | 5931 | { |
5543 | Variable X = new Variable(); | 5932 | Variable X = new Variable(); |
5544 | Variable Codes = new Variable(); | 5933 | Variable Codes = new Variable(); |
5545 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"object", X))) | 5934 | foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) |
5546 | { | 5935 | { |
5547 | if (YP.atom(X)) | 5936 | if (YP.atom(X)) |
5548 | { | 5937 | { |
5549 | YP.write(Atom.a(@"""")); | 5938 | YP.write(Atom.a("\"")); |
5550 | foreach (bool l4 in YP.atom_codes(X, Codes)) | 5939 | foreach (bool l4 in YP.atom_codes(X, Codes)) |
5551 | { | 5940 | { |
5552 | convertStringCodesPython(Codes); | 5941 | convertStringCodesPython(Codes); |
5553 | YP.write(Atom.a(@"""")); | 5942 | YP.write(Atom.a("\"")); |
5554 | return; | 5943 | return; |
5555 | } | 5944 | } |
5556 | } | 5945 | } |
@@ -5558,7 +5947,7 @@ namespace Temporary { | |||
5558 | } | 5947 | } |
5559 | { | 5948 | { |
5560 | Variable X = new Variable(); | 5949 | Variable X = new Variable(); |
5561 | foreach (bool l2 in YP.unify(arg1, new Functor1(@"object", X))) | 5950 | foreach (bool l2 in YP.unify(arg1, new Functor1("object", X))) |
5562 | { | 5951 | { |
5563 | YP.write(X); | 5952 | YP.write(X); |
5564 | return; | 5953 | return; |
@@ -5585,7 +5974,7 @@ namespace Temporary { | |||
5585 | YP.put_code(Code); | 5974 | YP.put_code(Code); |
5586 | convertStringCodesPython(RestCodes); | 5975 | convertStringCodesPython(RestCodes); |
5587 | return; | 5976 | return; |
5588 | // goto cutIf1; | 5977 | goto cutIf1; |
5589 | } | 5978 | } |
5590 | if (YP.termEqual(Code, 92)) | 5979 | if (YP.termEqual(Code, 92)) |
5591 | { | 5980 | { |
@@ -5593,15 +5982,99 @@ namespace Temporary { | |||
5593 | YP.put_code(Code); | 5982 | YP.put_code(Code); |
5594 | convertStringCodesPython(RestCodes); | 5983 | convertStringCodesPython(RestCodes); |
5595 | return; | 5984 | return; |
5596 | // goto cutIf1; | 5985 | goto cutIf1; |
5597 | } | 5986 | } |
5598 | YP.put_code(Code); | 5987 | YP.put_code(Code); |
5599 | convertStringCodesPython(RestCodes); | 5988 | convertStringCodesPython(RestCodes); |
5600 | return; | 5989 | return; |
5601 | // cutIf1: | 5990 | cutIf1: |
5602 | // { } | 5991 | { } |
5992 | } | ||
5993 | } | ||
5994 | } | ||
5995 | |||
5996 | public static IEnumerable<bool> putCStringCode(object Code) | ||
5997 | { | ||
5998 | { | ||
5999 | Variable HexDigit = new Variable(); | ||
6000 | Variable HexChar = new Variable(); | ||
6001 | if (YP.lessThanOrEqual(Code, 31)) | ||
6002 | { | ||
6003 | if (YP.lessThanOrEqual(Code, 15)) | ||
6004 | { | ||
6005 | YP.write(Atom.a("\\u000")); | ||
6006 | foreach (bool l4 in YP.unify(HexDigit, Code)) | ||
6007 | { | ||
6008 | if (YP.lessThanOrEqual(HexDigit, 9)) | ||
6009 | { | ||
6010 | foreach (bool l6 in YP.unify(HexChar, YP.add(HexDigit, 48))) | ||
6011 | { | ||
6012 | YP.put_code(HexChar); | ||
6013 | yield return true; | ||
6014 | yield break; | ||
6015 | } | ||
6016 | goto cutIf2; | ||
6017 | } | ||
6018 | foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 55))) | ||
6019 | { | ||
6020 | YP.put_code(HexChar); | ||
6021 | yield return true; | ||
6022 | yield break; | ||
6023 | } | ||
6024 | cutIf2: | ||
6025 | { } | ||
6026 | } | ||
6027 | goto cutIf1; | ||
6028 | } | ||
6029 | YP.write(Atom.a("\\u001")); | ||
6030 | foreach (bool l3 in YP.unify(HexDigit, YP.subtract(Code, 16))) | ||
6031 | { | ||
6032 | if (YP.lessThanOrEqual(HexDigit, 9)) | ||
6033 | { | ||
6034 | foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 48))) | ||
6035 | { | ||
6036 | YP.put_code(HexChar); | ||
6037 | yield return true; | ||
6038 | yield break; | ||
6039 | } | ||
6040 | goto cutIf3; | ||
6041 | } | ||
6042 | foreach (bool l4 in YP.unify(HexChar, YP.add(HexDigit, 55))) | ||
6043 | { | ||
6044 | YP.put_code(HexChar); | ||
6045 | yield return true; | ||
6046 | yield break; | ||
6047 | } | ||
6048 | cutIf3: | ||
6049 | { } | ||
6050 | } | ||
6051 | cutIf1: | ||
6052 | { } | ||
6053 | } | ||
6054 | } | ||
6055 | { | ||
6056 | if (YP.termEqual(Code, 34)) | ||
6057 | { | ||
6058 | YP.put_code(92); | ||
6059 | YP.put_code(34); | ||
6060 | yield return true; | ||
6061 | yield break; | ||
5603 | } | 6062 | } |
5604 | } | 6063 | } |
6064 | { | ||
6065 | if (YP.termEqual(Code, 92)) | ||
6066 | { | ||
6067 | YP.put_code(92); | ||
6068 | YP.put_code(92); | ||
6069 | yield return true; | ||
6070 | yield break; | ||
6071 | } | ||
6072 | } | ||
6073 | { | ||
6074 | YP.put_code(Code); | ||
6075 | yield return true; | ||
6076 | yield break; | ||
6077 | } | ||
5605 | } | 6078 | } |
5606 | 6079 | ||
5607 | public static IEnumerable<bool> member(object X, object arg2) | 6080 | public static IEnumerable<bool> member(object X, object arg2) |
@@ -5658,7 +6131,6 @@ namespace Temporary { | |||
5658 | } | 6131 | } |
5659 | } | 6132 | } |
5660 | } | 6133 | } |
5661 | #pragma warning restore 0168 | 6134 | #pragma warning restore 0168, 0219, 0164, 0162 |
5662 | |||
5663 | } | 6135 | } |
5664 | } | 6136 | } |