The LMNtal system first compiles LMNtal source files into
intermediate code.  It then translates the intermediate code
into Java programs,
which is then compiled into Java bytecode and packaged into an
.jar (Java archive) file.  How to run the .jar file will be
described below.

The LMNtal system can also execute the intermediate code
interpretively (rather than translating them into Java) 
by giving the ''--interpret'' option.

When invoked without a source filename, the LMNtal system
enters the REPL (read-eval-print loop) mode in which expressions
are executed interpretively.

The system comes with a library API.  By default, the compiled version
of the API (that works also under the --interpret option) is used.
In this case, the .jar files of the library
should be prepared beforehand and added to the classpath.
By using shellscripts in the ''bin'' directory, you can invoke LMNtal
after adding all .jar files located in the ''lib'' directory to the

Alternatively, you can use the source code of the library by giving
the ''--use-source-library'' option, in which case the .lmn files
in the ''lib/src'' directory will be read and compiled on demand.

LMNtal programs transtaled into Java bytecode run an order of
magnitude faster than the interpreted intermediate code.

*How to Use

('''Note to Cygwin users''': The command names (''lmnc'', ''lmnr'',
''lmntal'') shown below works on UNIX/Linux and Windows.
On Cygwin, please use ''lmnc_cyg'', ''lmnr_cyg'', and ''lmntal_cyg''

**Using shellscripts (Windows 2000/XP, Cygwin and UNIX/Linux)

On Windows NT/2000/XP, Cygwin and UNIX/Linux, shellscripts in
the ''bin'' directory facilitates compilation and execution.

***Preparing libraries

(''Note'': Skip this step unless you have your own library.)

Prepare compiled libraries (how to make lirary .jar files will be
explained below) and put them in the ''lib'' directory.


 $lmnc foo.lmn
--Compiler options can be specified either before or after the filename.
 $ lmnc -O2 fool.lmn
 $ lmnc foo.lmn -d
 $ lmnr foo.jar
--Runtime options should be specified '''after''' the .jar filename.
 (ok) $ lmnr foo.jar -g
 (no) $ lmnr -t foo.jar
***Interactive execution (Read-Eval-Print loop)
 $ lmntal
--(lmntal is just an alias of lmnc.)

The system enters the interactive when a filename is not specified
in the command line.
Type in an LMNtal expression (that can spread over multiple lines)
and hit the return key twice to execute it.
Alternatively, you can start execution with one newline by
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.70.20060105
 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) ) [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) ) [PRESS ENTER]
 g(f(f(f(g(_24)))),_24), @604

**Doing manually (Windows 9x etc.)

++When standard or user-defined libraries are used, add their
 .jar files into the classpath.
++Compile the source file:
 $ java runtime.FrontEnd foo.lmn
++foo.jar will be created.
++Add foo.jar into the classpath.
++When standard or user-defined libraries are used, add their
 .jar files into the classpath.
++Invoke the Main class (in foo.jar) as:
 java Main

*Command-line options

 -t            - trace mode
 -v[0-9]       - set verbosity level ( -v = -v5 )
 -s[0-3]       - set shuffle level ( -s = -s3 )
 -g            - graphical mode (experimental)

There are many more options for compilation and execution.
To see what options are available, do:
  lmntal --help

***Verbosity Level

Expresses how verbosely an LMNtal process is displayed.

   0: silence
   2: default
   3: print `proxy atoms' and contents of rulesets
   4: expand operators
   5: expand atoms (default)
   6: expand rulesets

***Shuffle Level

Expresses how randomly the execution goes on.

   0: (default) use an atom stack for each membrane
      (atoms are selected in LIFO manner)
   1: atoms are selected in some arbitrary manner
      (but not randomly nor in LIFO)
   2: select atoms and membranes randomly from a membrane
   3: select atoms, membranes and rules randomly from a membrane

***Graphical Mode (experimental)

In the graphical mode, a window is displayed that visualizes
the content of the atoms and links at the root (top-level) membrane.
Pressing space bar or clicking on 'Go ahead' button
will proceed the computation step by step.
Atoms can be dragged to arbitrary positions so that the graph
can be viewed better.
To terminate the execution, please close the window manually.

*How to create libraries

To create your own program library, compile the program
with the ''--library'' option:

 java runtime.FrontEnd --library libhoge.lmn
 lmnc --library libhoge.lmn

Then, put the .jar file just created in the ''$LMNTAL_HOME/lib''

*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 membrane
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 in the
''ranslated'' package. 
---The class has a static method ''getRulesets()'' that
returns a list of rulesets contained in that module.

-Rules for non-libraries
--The ruleset classes belong to the package ''translated''.
--The class ''Main'' will be generated in the default package.

-Rules for libraries 
--The ruleset classes belong to the package

*System rulesets

-A '''system ruleset''' means a set of global rules, namely
rules applicable to every place in the membrane structure.
For instance, built-in arithmetics is an example of system rulesets.

-A programmer can define his/her own system ruleset by
defining rules in the ''system_ruleset'' module.

//-There are three kinds of system rulesets:
// ++Built-in system rulesets that cannot be modified by users
// ---Proxies for trans-membrane links fall into this category.
//---Currently, they are processed in InterpretedRuleset
//even when the translator is used.
//++Built-in system rulesets that are described in LMNtal and
//can be modified
//---Arithmetics falls in this category, but the current implementation
//handles arithetics much like i.
//++LMNtal ?v???O??????????W???[???????????????isystem_ruleset?j

//i. ? ii. ??ATranslator ?????R???p?C????? runtiem.GlobalSystemRuleset
//??? iii. ??Aruntime.SystemRulesets ?N???X?????????B


-A large LMNtal program may create a Java class definition
that is too large to be compiled by your Java compiler.

-Shuffle levels 0-2 can specified as a runtime option, but 
shuffle level 3 must be specified also at compile time.

Front page List of pages Search Recent changes Backup   Help   RSS of recent changes