Getting started with the oasys tool

The oasys tool is an alternative to the ocs command. It provides particularly useful functionality for interactive program development. Its interpreter-debugger allows to expressions to be evaluated `on the fly' or the execution of functions to be monitored.

In contrast to ocs, oasys is not batch-oriented, but has its own command line interpreter (which is effectively a Tcl interpreter). The most important commands have one-letter abbreviations; some of these are:

a STRUCTURE
add STRUCTURE (and its dependent structures) to the set of known structures
f UNIT
define UNIT (a structure's signature or implementation part) as focus (context) for the evaluation of expressions
e EXPR
evaluate EXPR
h CMD
give help on oasys command CMD
i
print a short introduction to oasys commands
q
quit oasys

Example

For demonstration we use the structure Rational:

   $ cd examples/Rational
   $ oasys
-> oasys version 1.1b (ocs version 2.3g), (c) 1989-1998 The OPAL Group, TU-Berlin
-> >

Firstly, we have to add the structure Rational to the set of known structures:

   >a Rational
-> loading Rational.sign
-> loading Rational.impl
-> >

Secondly, we choose one of the loaded units as the focus, that is, the context for the evaluation of expressions. The signature part imports integers to allow basic evaluations:

   >f Rational.sign
-> Rational.sign>

The prompt changes and indicates the current focus. Now we can evaluate Opal expressions. Before every evaluation, the structures are checked and recompiled, if necessary:

   Rational.sign>e 6 / 8 + 5 / 4
-> checking Rational.sign
-> checking Rational.impl
-> compiling Rational.impl
-> starting evaluator process
-> 2/1
-> Rational.sign>

Subsequent evaluations are quicker:

   Rational.sign>e 3 / 5 * 5 / 4
-> 3/4
-> Rational.sign>

Spaces or quotes may require expressions to be enclosed in curly brackets:

   Rational.sign>e {("4711"!) / 12 + 5 / 3}
-> 1577/4
-> Rational.sign>

Errors in the evaluated expression are reported at line 0:

   Rational.sign>e a + b
-> ERROR [at 0.1]: no matching operation for a
-> ERROR [at 0.5]: no matching operation for b
-> ERROR [check]: language error
-> aborted
-> Rational.sign>

Further Topics

For further documentation of the following topics we refer to the Oasys Manual.


The Opal Group
Last modified: Thu Sep 16 21:32:04 MEST 1999