Foreign-Language Interface in LMNtal Java
[
Front page
|
List of pages
|
Search
|
Recent changes
|
Backup
|
Help
]
Start:
//[[Documentation]]
''NOTE:'' LMNtal Java runtime is no longer supported but ...
LMNtal Java allows inline code written in Java.
*Foreign-Language Interface in LMNtal Java
**Syntax
An '''inline_define atom''' is an atom of the form
>[:/*inline_define*/ '''inline_define_code_in_Java''' :] .
An '''inline atom''' is an atom of the form
>[:/*inline*/ '''inline_code_in_Java''' :](X1,...,Xn) .
**Specification
The execution of inline code takes place
immediately after the rewriting task of the rule
that creates the inline atom is finished.
Two defined variables can be used in the Java code in an ...
>''me'' ... the inline atom itself;~
>''mem'' ... me.getMem().
**Examples
[:/*inline_define*/class Foo { static int counter = 0; }...
[:/*inline*/System.out.println(me.nthAtom(0).getName());
me.remove();
me.nthAtom(0).remove();:]("LMNtal\n")
% ==> prints LMNtal
hello(X) :- [:/*inline*/
Atom a = mem.newAtom(new Functor("ok",1));
me.remove();
mem.relink(a,0,me,0);:](X).
hello(there).
% ==> ok(there)
End:
//[[Documentation]]
''NOTE:'' LMNtal Java runtime is no longer supported but ...
LMNtal Java allows inline code written in Java.
*Foreign-Language Interface in LMNtal Java
**Syntax
An '''inline_define atom''' is an atom of the form
>[:/*inline_define*/ '''inline_define_code_in_Java''' :] .
An '''inline atom''' is an atom of the form
>[:/*inline*/ '''inline_code_in_Java''' :](X1,...,Xn) .
**Specification
The execution of inline code takes place
immediately after the rewriting task of the rule
that creates the inline atom is finished.
Two defined variables can be used in the Java code in an ...
>''me'' ... the inline atom itself;~
>''mem'' ... me.getMem().
**Examples
[:/*inline_define*/class Foo { static int counter = 0; }...
[:/*inline*/System.out.println(me.nthAtom(0).getName());
me.remove();
me.nthAtom(0).remove();:]("LMNtal\n")
% ==> prints LMNtal
hello(X) :- [:/*inline*/
Atom a = mem.newAtom(new Functor("ok",1));
me.remove();
mem.relink(a,0,me,0);:](X).
hello(there).
% ==> ok(there)
Page: