aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT
diff options
context:
space:
mode:
authorCharles Krinke2008-08-13 14:13:49 +0000
committerCharles Krinke2008-08-13 14:13:49 +0000
commit323ada012d3bed0c6f7a6d5d0ee14b409b7457c7 (patch)
treed5a2e30707baba7804aefb341774d6d51ca7b439 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT
parentThank you, tyre, for a patch that fixes a null reference in LSL (diff)
downloadopensim-SC_OLD-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.zip
opensim-SC_OLD-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.tar.gz
opensim-SC_OLD-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.tar.bz2
opensim-SC_OLD-323ada012d3bed0c6f7a6d5d0ee14b409b7457c7.tar.xz
Mantis#1931. Thank you kindly, Kinoc for a patch that:
* Yield Prolog 1.0.1 Released : it passes all but 9 of the 421 tests in the ISO Prolog test suite (97.8%) . * support dynamic predicates and rules. * support 'import' to use external static functions improves connection to C# functions * Matches Yield Prolog r831
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT109
1 files changed, 109 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT
index a1beeb6..5e0863f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/YieldProlog/README.TXT
@@ -29,6 +29,7 @@ FEATURES
29* Compiler is generated by compiling the Prolog descrition of itself into C# 29* Compiler is generated by compiling the Prolog descrition of itself into C#
30* Same script entry interface as LSL 30* Same script entry interface as LSL
31 31
32* Yield Prolog 1.0.1 Released : it passes all but 9 of the 421 tests in the ISO Prolog test suite (97.8%).
32 33
33TODO 34TODO
34* Utilize ability to generate Javascript and Python code 35* Utilize ability to generate Javascript and Python code
@@ -117,6 +118,113 @@ void retractdb2(string predicate, string arg1, string arg2)
117 YP.retractFact(name, new object[] { arg1, arg2 }); 118 YP.retractFact(name, new object[] { arg1, arg2 });
118} 119}
119 120
121----------- IMPORT EXTERNAL FUNCTIONS ----------
122Using 'import' to call a static function
123
124Taken mostly from http://yieldprolog.sourceforge.net/tutorial4.html
125
126If we want to call a static function but it is not defined in the Prolog code, we can simply add an import directive.
127(In Prolog, if you start a line with :- it is a directive to the compiler. Don't forget to end with a period.):
128
129:- import('', [parent/2]).
130uncle(Person, Uncle):- parent(Person, Parent), brother(Parent, Uncle).
131
132The import directive has two arguments.
133The first argument is the module where the imported function is found, which is always ''.
134For C#, this means the imported function is in the same class as the calling function.
135For Javascript and Python, this means the imported function is in the global scope.
136The second argument to import is the comma-separated list of imported functions, where each member of the list is 'name/n', where 'name' is the name of the function and 'n' is the number of arguments.
137In this example, parent has two arguments, so we use parent/2.
138
139Note: you can use an imported function in a dynamically defined goal, or a function in another class.
140
141:- import('', [parent/2]).
142uncle(Person, Uncle) :- Goal = parent(Person, Parent), Goal, brother(Parent, Uncle).
143
144:- import('', ['OtherClass.parent'/2]).
145uncle(Person, Uncle) :- 'OtherClass.parent'(Person, Parent), brother(Parent, Uncle).
146
147--------- Round-about Hello Wonderful world ----------
148//yp
149:-import('',[sayit/1]).
150sayhello(X):-sayit(X).
151
152//cs
153public void default_event_state_entry()
154 {
155 llSay(0,"prolog hello.");
156 foreach( bool ans in sayhello(Atom.a(@"wonderful world") )){};
157 }
158
159PrologCallback sayit(object ans)
160 {
161 llSay(0,"sayit1");
162 string msg = "one answer is :"+((Variable)ans).getValue();
163 llSay(0,msg);
164 yield return false;
165 }
166
167------------------ UPDATES -----------------
168Yield Prolog 1.0 Released : It passes all but 15 of the 421 tests in the ISO Prolog test suite.
169
170New Features:
171* Added support for Prolog predicates read and read_term.
172* In see, Added support for a char code list as the input.
173Using this as the input for "fred" makes
174set_prolog_flag(double_quotes, atom) and
175set_prolog_flag(double_quotes, chars) pass the ISO test suite.
176
177Fixed Bugs:
178* In atom_chars, check for unbound tail in the char list.
179This makes atom_chars pass the ISO test suite.
180* In current_predicate, also check for static functions.
181This makes current_predicate pass the ISO test suite.
182
183Known Issues:
184
185Here are the 9 errors of the 421 tests in the ISO test suite in
186YieldProlog\source\prolog\isoTestSuite.P .
187Some of these have a good excuse for why Yield Prolog produces the error. The rest will be addressed in a future maintenance release.
188
189Goal: call((fail, 1))
190Expected: type_error(callable, (fail, 1))
191Extra Solutions found: failure
192
193Goal: call((write(3), 1))
194Expected: type_error(callable, (write(3), 1))
195Extra Solutions found: type_error(callable, 1)
196
197Goal: call((1; true))
198Expected: type_error(callable, (1 ; true))
199Extra Solutions found: type_error(callable, 1)
200
201Goal: (catch(true, C, write('something')), throw(blabla))
202Expected: system_error
203Extra Solutions found: unexpected_ball(blabla)
204
205Goal: catch(number_chars(A,L), error(instantiation_error, _), fail)
206Expected: failure
207Extra Solutions found: instantiation_error
208
209Goal: Goal: (X = 1 + 2, 'is'(Y, X * 3))
210Expected: [[X <-- (1 + 2), Y <-- 9]]
211Extra Solutions found: type_error(evaluable, /(+, 2))
212
213Goal: 'is'(77, N)
214Expected: instantiation_error
215Extra Solutions found: N <-- 77)
216
217Goal: \+(!, fail)
218Expected: success
219Extra Solutions found: failure
220
221((X=1;X=2), \+((!,fail)))
222Expected: [[X <-- 1],[X <-- 2]]
223Extra Solutions found: failure
224
225
226
227
120 228
121========================= APPENDIX A: touch test ================================ 229========================= APPENDIX A: touch test ================================
122 230
@@ -403,3 +511,4 @@ public IEnumerable<bool> prolog_notify(object X) {
403 511
404} } 512} }
405 513
514