Back

Linguist Reference

Running Linguist

Command syntax:

  java -cp linguist.jar net.eclecity.linguist.LS

Opens the Help browser at this index page.

  java -cp linguist.jar net.eclecity.linguist.LS help <keyword>

Opens the Help browser at the page for <keyword>.

  java -cp linguist.jar net.eclecity.linguist.LS <script>.ls

Compiles the script, checking for syntax errors.

  java -cp linguist.jar net.eclecity.linguist.LS <script>.ls -o

Compiles the script to <script>.lrun.

  java -cp linguist.jar net.eclecity.linguist.LS <script>.ls -r

Compiles the script and runs the result.

  java -cp linguist.jar net.eclecity.linguist.LS <script>.lrun

Runs a precompiled script.

Language reference

At the heart of Linguist are a compiler and a runtime interpreter for a high-level scripting language. But instead of the language being a fixed entity it's completely customizable to do whatever you need, provided you keep to a general overall syntax structure. More on this later.

Before you get the impression we're trying to tempt you away from Java, we hasten to stress that most of the work you do with Linguist is in fact pure, unadulterated Java. But your customers may prefer to work with a simpler language. Linguist is the bridge that enables them to describe the features they want by scripting, while you code the engine underneath in Java, the way you prefer.

Linguist as supplied includes a core set of classes and a set of packages that together comprise a sample scripting language. The full source is supplied for you to use as a starting point for your own custom language. Or you can add classes (handlers) to the ones we supply.

The standard classes are in the following packages. See also the note below about Repackage.

Each of these is documented in the following pages.

The basic package supports two variable types: 64-bit integers and strings. It has a full set of arithmetic, logical and control operators, including keywords to launch concurrent scripts and enable communication between multiple compiled scripts. In here too is support for vectors, hashtables and files.

The comms package is a small addition that provides support for serial ports. It is separate from the basic package because it requires the javax.comm extension classes that are not available for all platforms.

The data package manages databases using JDBC. It also includes a small 'middle tier' persistence framework to decouple your application from the database and to provide somewhere to place business logic.

The graphics package encapsulates functionality from the JFC Swing classes. When complete, this package will provide wrappers round many of the components provided by Swing, along with the means to use these components easily and flexibly.

The media package uses the Java Media Framework to handle audio and video in a flexible and easy-to-use manner. To use this package you must obtain and install a copy of the Java Media Framework from Sun or another appropriate source.

The network package manages IP networking and provides commands that enable you to use point-to-point and multipoint sockets and HTTP connections in a straightforward and simple manner.

The servlet package provides variables and commands for implementing scripted servlets, including high-level constructs for generating HTML.

Built-in commands

Additionally, there are some commands built into the compiler core. The names themselves are defined in one of the compiler modules, where they can be changed easily. Here are the commands:

compile <name>

When the compiler encounters a run command it saves the name of the script in a table. At the end of compilation it then compiles all the scripts it found. This can cause an unnecessary and time-consuming amount of extra compiling work so you can specifiy which files should be recompiled. Once the first compile command has been found, only files listed in compile commands will be recompiled.

include <name>

Use this command to take text from another file for compiling. A source-level library, in effect.

begin ... end

Makes a single command comprising several other commands, which may also include begin ... end blocks and so on.


The Repackage class

Occasionally you may have the need to change the name of package. The Repackage class will do this for you, including the changes needed inside the documentation files. You will probably still have some minor changes to make yourself, but it saves you most of the work. See the source.


Back cursor