How to Use LMNtal Java
[
Front page
|
List of pages
|
Search
|
Recent changes
|
Backup
|
Help
]
Start:
//[[Documentation]]
Note: This page is no longer maintained. To use LMNtal a...
*LMNtal Java System Overview
The LMNtal compiler (''lmnc'') first compiles LMNtal sour...
intermediate code. The intermediate code is then transla...
which is in turn compiled into Java bytecode and packaged...
.jar (Java archive) file.
The created .jar file can be executed using the ''lmnr'' ...
Alternatively, you can use the ''lmntal'' command to comp...
programs into intermediate code and execute it
interpretively (rather than translating them into Java).
When invoked without a source filename, both ''lmnc'' and...
enter the read-eval-print loop (REPL) mode in which expre...
are executed interpretively.
The system comes with a library API.
In addition, you can define your own libraries to be
used with your programs.
See '''How to create libraries''' (below) for details abo...
LMNtal programs transtaled into Java bytecode run an orde...
magnitude faster than the interpreted intermediate code.
*How to Use
// ('''Note to Cygwin users''': When you run LMNtal (vers...
// instead of ''lmnc'', ''lmnr'', and ''lmntal''. The ''...
**Using shellscripts (Windows, Cygwin and UNIX/Linux)
On Windows, Cygwin and UNIX/Linux, shellscripts in
the ''bin'' directory facilitate compilation and execution.
We suggest you add the path of the ''bin'' directory to t...
environment variable of the underlying operating system s...
''lmntal'', ''lmnc'' and ''lmnr'' commands are searched a...
automatically. Otherwise you must explicitly specify the...
these commands.
***Preparing libraries (Skip this step unless you have yo...
Prepare compiled libraries (how to make lirary .jar files...
explained below) and put them in the ''lib'' directory.
***Compilation
$ lmnc foo.lmn
Compiler options can be specified either before or after ...
$ lmnc -O2 foo.lmn
$ lmnc foo.lmn -d
The following commands execute the intermediate code inte...
than creating a .jar file.
$ lmntal foo.lmn
$ lmnc foo.lmn --interpret
***Execution of the .jar file
$ lmnr foo.jar
Runtime options must be specified '''after''' the .jar fi...
(ok) $ lmnr foo.jar -g
(no) $ lmnr -t foo.jar
***Interactive execution (Read-Eval-Print loop)
$ lmntal
The system enters the interactive when a filename is not ...
in the command line.
Enter an LMNtal expression (that can spread over multiple...
and hit the return key twice to execute it.
you can also tell the system to start execution with one ...
giving the ''--immediate'' option.
The following list shows some interactive-mode commands:
:q - quit
:h - see help
:trace | :notrace - set trace mode
:verbose [0-9] - set verbosity level
:shuffle [0-3] - set shuffle level
Here is an example of an interactive mode session:
% lmntal [PRESS ENTER]
LMNtal version 0.83.20061129
Type :h to see help.
Type :q to quit.
Enter an empty line to run the input.
# A=f(f(f(f(f(A))))), c,c, ( c, X=f(Y) :- X=g(Y) ) [PRES...
[PRESS ENTER]
f(g(g(f(f(_4)))),_4), @601
# A=f(f(f(f(f(A))))), c,c, ( c, X=f(Y) :- X=g(Y) ) [PRES...
[PRESS ENTER]
g(f(f(f(g(_24)))),_24), @604
# :q [PRESS ENTER]
%
**Doing manually (Windows 9x etc.)
***Compilation
++When standard or user-defined libraries are used, add t...
.jar files into the classpath.
++Compile the source file:
$ java runtime.FrontEnd foo.lmn
++foo.jar will be created.
***Execution
++Add foo.jar into the classpath.
++When standard or user-defined libraries are used, add t...
.jar files into the classpath.
++Invoke the Main class (in foo.jar) as:
java Main
*Command-line options
There are many options for compilation and execution.
Popular options include:
-t - trace mode
-v[0-9] - set verbosity level ( -v = -v5 )
-s[0-3] - set shuffle level ( -s = -s3 )
-g - graphical (visualizer) mode
To see the list of all available options, do:
lmntal --help
A Verbosity Level
expresses how verbosely an LMNtal process is displayed.
0: silence
1: default
2: expand link names
3: shows the contents of rulesets just compiled
4: expand operators
5: expand atoms
6: expand rulesets
A shuffle Level
expresses how randomly the execution goes on.
0: (default) use an atom stack for each membrane
(atoms are selected in a LIFO manner)
1: atoms are selected in a system-defined order
(which is not random or LIFO)
2: select atoms and membranes randomly from a membrane
3: select atoms, membranes and rules randomly from a m...
The graphical Mode (experimental) visualizes program exec...
A graphical window will be displayed that visualizes the
evolution of hierarchical graph structure.
Computation proceeds step by step by pressing the space b...
clicking on the 'Go ahead' button.
Atoms can be dragged to arbitrary positions so that the g...
may look better.
To terminate the execution, close the window manually.
*How to create libraries
A library is a program that is prepared (compiled) separa...
and added to the classpath. A library can be used also
with a program running under the --interpret option.
By using shellscripts in the ''bin'' directory, you can i...
after adding all .jar files located in the ''lib'' direct...
classpath.
You can also use the source code of the library by giving
the ''--use-source-library'' option, in which case the .l...
in the ''lib/src'' directory will be read and compiled on...
To create your own program library, compile the program
with the ''--library'' option:
lmnc --library libhoge.lmn
java runtime.FrontEnd --library libhoge.lmn (Windows 9x)
Then, move the .jar file to the ''$LMNTAL_HOME/lib'' dire...
*Classes built by the translator
-General rules
--One Java class will be created for each ruleset
(= a set of rules located in the same 'place' of the memb...
structure in the source program).
--The class name will be ''Ruleset''('''rule_set_ID''')'.
--When the compiled program contains a module definition,
a class ''Module_''('''module_name''')' will be created i...
''translated'' package.
---The class has a static method ''getRulesets()'' that
returns a list of rulesets contained in that module.
-For non-libraries:
--The ruleset classes belong to the package ''translated''.
--The class ''Main'' will be generated in the default pac...
-For libraries:
--The ruleset classes belong to the package
''translated.module_''('''library_name''').
*Bugs
-A large LMNtal program may create a Java class definition
that is too large to be compiled by your Java compiler.
-The ''aggregate'' construct have not yet been implemente...
you can use the [[standard library module ''nlmem''>Libra...
cells with an indefinite number of free links.
-Shuffle levels 0-2 can be specified as a runtime option,...
shuffle level 3 must be specified also at compile time.
End:
//[[Documentation]]
Note: This page is no longer maintained. To use LMNtal a...
*LMNtal Java System Overview
The LMNtal compiler (''lmnc'') first compiles LMNtal sour...
intermediate code. The intermediate code is then transla...
which is in turn compiled into Java bytecode and packaged...
.jar (Java archive) file.
The created .jar file can be executed using the ''lmnr'' ...
Alternatively, you can use the ''lmntal'' command to comp...
programs into intermediate code and execute it
interpretively (rather than translating them into Java).
When invoked without a source filename, both ''lmnc'' and...
enter the read-eval-print loop (REPL) mode in which expre...
are executed interpretively.
The system comes with a library API.
In addition, you can define your own libraries to be
used with your programs.
See '''How to create libraries''' (below) for details abo...
LMNtal programs transtaled into Java bytecode run an orde...
magnitude faster than the interpreted intermediate code.
*How to Use
// ('''Note to Cygwin users''': When you run LMNtal (vers...
// instead of ''lmnc'', ''lmnr'', and ''lmntal''. The ''...
**Using shellscripts (Windows, Cygwin and UNIX/Linux)
On Windows, Cygwin and UNIX/Linux, shellscripts in
the ''bin'' directory facilitate compilation and execution.
We suggest you add the path of the ''bin'' directory to t...
environment variable of the underlying operating system s...
''lmntal'', ''lmnc'' and ''lmnr'' commands are searched a...
automatically. Otherwise you must explicitly specify the...
these commands.
***Preparing libraries (Skip this step unless you have yo...
Prepare compiled libraries (how to make lirary .jar files...
explained below) and put them in the ''lib'' directory.
***Compilation
$ lmnc foo.lmn
Compiler options can be specified either before or after ...
$ lmnc -O2 foo.lmn
$ lmnc foo.lmn -d
The following commands execute the intermediate code inte...
than creating a .jar file.
$ lmntal foo.lmn
$ lmnc foo.lmn --interpret
***Execution of the .jar file
$ lmnr foo.jar
Runtime options must be specified '''after''' the .jar fi...
(ok) $ lmnr foo.jar -g
(no) $ lmnr -t foo.jar
***Interactive execution (Read-Eval-Print loop)
$ lmntal
The system enters the interactive when a filename is not ...
in the command line.
Enter an LMNtal expression (that can spread over multiple...
and hit the return key twice to execute it.
you can also tell the system to start execution with one ...
giving the ''--immediate'' option.
The following list shows some interactive-mode commands:
:q - quit
:h - see help
:trace | :notrace - set trace mode
:verbose [0-9] - set verbosity level
:shuffle [0-3] - set shuffle level
Here is an example of an interactive mode session:
% lmntal [PRESS ENTER]
LMNtal version 0.83.20061129
Type :h to see help.
Type :q to quit.
Enter an empty line to run the input.
# A=f(f(f(f(f(A))))), c,c, ( c, X=f(Y) :- X=g(Y) ) [PRES...
[PRESS ENTER]
f(g(g(f(f(_4)))),_4), @601
# A=f(f(f(f(f(A))))), c,c, ( c, X=f(Y) :- X=g(Y) ) [PRES...
[PRESS ENTER]
g(f(f(f(g(_24)))),_24), @604
# :q [PRESS ENTER]
%
**Doing manually (Windows 9x etc.)
***Compilation
++When standard or user-defined libraries are used, add t...
.jar files into the classpath.
++Compile the source file:
$ java runtime.FrontEnd foo.lmn
++foo.jar will be created.
***Execution
++Add foo.jar into the classpath.
++When standard or user-defined libraries are used, add t...
.jar files into the classpath.
++Invoke the Main class (in foo.jar) as:
java Main
*Command-line options
There are many options for compilation and execution.
Popular options include:
-t - trace mode
-v[0-9] - set verbosity level ( -v = -v5 )
-s[0-3] - set shuffle level ( -s = -s3 )
-g - graphical (visualizer) mode
To see the list of all available options, do:
lmntal --help
A Verbosity Level
expresses how verbosely an LMNtal process is displayed.
0: silence
1: default
2: expand link names
3: shows the contents of rulesets just compiled
4: expand operators
5: expand atoms
6: expand rulesets
A shuffle Level
expresses how randomly the execution goes on.
0: (default) use an atom stack for each membrane
(atoms are selected in a LIFO manner)
1: atoms are selected in a system-defined order
(which is not random or LIFO)
2: select atoms and membranes randomly from a membrane
3: select atoms, membranes and rules randomly from a m...
The graphical Mode (experimental) visualizes program exec...
A graphical window will be displayed that visualizes the
evolution of hierarchical graph structure.
Computation proceeds step by step by pressing the space b...
clicking on the 'Go ahead' button.
Atoms can be dragged to arbitrary positions so that the g...
may look better.
To terminate the execution, close the window manually.
*How to create libraries
A library is a program that is prepared (compiled) separa...
and added to the classpath. A library can be used also
with a program running under the --interpret option.
By using shellscripts in the ''bin'' directory, you can i...
after adding all .jar files located in the ''lib'' direct...
classpath.
You can also use the source code of the library by giving
the ''--use-source-library'' option, in which case the .l...
in the ''lib/src'' directory will be read and compiled on...
To create your own program library, compile the program
with the ''--library'' option:
lmnc --library libhoge.lmn
java runtime.FrontEnd --library libhoge.lmn (Windows 9x)
Then, move the .jar file to the ''$LMNTAL_HOME/lib'' dire...
*Classes built by the translator
-General rules
--One Java class will be created for each ruleset
(= a set of rules located in the same 'place' of the memb...
structure in the source program).
--The class name will be ''Ruleset''('''rule_set_ID''')'.
--When the compiled program contains a module definition,
a class ''Module_''('''module_name''')' will be created i...
''translated'' package.
---The class has a static method ''getRulesets()'' that
returns a list of rulesets contained in that module.
-For non-libraries:
--The ruleset classes belong to the package ''translated''.
--The class ''Main'' will be generated in the default pac...
-For libraries:
--The ruleset classes belong to the package
''translated.module_''('''library_name''').
*Bugs
-A large LMNtal program may create a Java class definition
that is too large to be compiled by your Java compiler.
-The ''aggregate'' construct have not yet been implemente...
you can use the [[standard library module ''nlmem''>Libra...
cells with an indefinite number of free links.
-Shuffle levels 0-2 can be specified as a runtime option,...
shuffle level 3 must be specified also at compile time.
Page: