Using the JMPL Compiler
Compiler Version: 2.0
Andrew Bachmann
May 23, 2001
Introduction to the JMPL
Compiler
The JMPL Compiler is used
to convert JMPL into a format suitable for loading into the Livingstone
Engine. For more information about
JMPL, read the Introduction to JMPL.
The compiler works in three steps.
The first step is to load the files that contain the source objects that
are to be instantiated. The second step
is to fully instantiate a class. The
compiler instantiates the specified top-level class, and its subcomponents, and
their subcomponents, etc. As part of
this instantiation, the compiler performs a logical transform on the
constraints, reducing them to CNF form.
The third step is writing the files out in XMPL format. XMPL is the XML-based Model-based Programming
Language.
Using the JMPL Compiler
through Stanley
When using Stanley, the JMPL
Compiler is automatically invoked.
Error messages from the compiler will be shown in a window.
Using the JMPL Compiler
with JDK 1.2
The JMPL Compiler is
available independent of Stanley in a Java Archive File. (JAR)
The JMPL Compiler is available through the cvs repository for Code IC at
NASA Ames Research Center. If you don't
have access, please email someone on the project to request the compiler. An executable jar is available in the cvs
subdirectory "skunkworks/java/jars" with the name "SkunkWorksFull-bin.jar". This jar includes all third-party
libraries. A jar with sources is
available with the name "SkunkWorksFull-src.jar".
The JmplCompiler can be
found at:
gov.nasa.arc.skunkworks.io.jmpl.JmplCompiler
Run the compiler like this:
Supply a component type, component name, and at least one file
name:
java gov.nasa.arc.skunkworks.io.jmpl.JmplCompiler <component
type>
<component name> <filename1> <filename2> ...
Example:
java gov.nasa.arc.skunkworks.io.jmpl.JmplCompiler sensor sensor1
"c:\\directory\\filename.jmpl"
Both the component type and
component name are mandatory. At least
one
filename must be
specified. The output of the compiler
will be stored
in a file called
<component name>.xmpl, which should be saved in the
current directory. (YMMV?)
By the way, since I am on
windows, the example shows a windows pathname.
On unix, the slashes are
the opposite direction, and, of course, there
is no such thing as
"c:".
Compiler Messages
The compiler currently
gives some basic feedback on what file it is currently loading, and how it is
progressing in the compilation. The
most helpful feedback is in the error messages.
Error Messages
The compiler or the parser
may run into an error. If the parser
runs into an error, you should see the error below the prompt showing the file
loading. It will likely give a line
number, and some basic explanation of what the error is. Usually this error will be of the form:
"expecting xxx, found yyy".
If the compiler runs into an error, you will hopefully see something a
little more helpful. The compiler tries
to convey as much context as possible.
This section will be expanded in the future to show some sample error
messages and explanations.
User Feedback
Especially since we are in
the preliminary stages of the JMPL compiler, and the new Skunk Works debugging
tools, user feedback is very important to us.
Here are some categories of feedback that we are looking for in
particular.
Bug Reports
This is a preliminary
release. Although most everything you
want works, certain things may not work exactly right. If you think something isn't working right,
please check your code, then please send the following to Andrew Bachmann.
(mailto:abachmann@mail.arc.nasa.gov)
1. your code - please attempt
to reduce the size of the code to as small as will exhibit the problem
2. what it does - what
happened when you tried to compile/use your code?
3. what you think it should
do - what did you expect to happen?
Usage Comments
If you spent a half an hour
figuring out how to do something, let us know. Especially if you have an idea on how it could work better or be
more transparent. If you got back some
error message and couldn't understand it, and eventually figured it out, send
us an email about the message, and what you finally figured out.
Feature Requests
If you think that something
is missing, don't hesitate to put it in as a feature request. Especially if you really need a particular
feature. If it is something of particular
urgence, please emphasize that fact, so we can prioritize it over things of
less concern.
Usage Questions
If you are not sure about
how to do something, ask us a question.
Your question could become a new helpful section in this or another
piece of documentation.