Precondition: You must already set up a proper TeamWare environment. You should also bringover and bringoverx (if not already done):
The first time you start TooL, you must create a store and initialize the system by loading the file $TYCOON_ROOT/TooL/boot.tyc. You should also commit the changes:
cd $TYCOON_ROOT/bootlib tycoon -store TooL -bootFile tool.x -create DO load "../TooL/boot.tyc"; DO saveSystem;Once you have successfully created and initialized your TooL system store, you can quickly re-start the system with the flag '-restart':
tycoon -store TooL -restartAt the TooL toplevel, you can do the following:
class A public a :Int;This code sample defines a class named 'A' with a single slot named 'a' having type 'Int', implicitely defining access methods for the slot.
define x :A;This code defines a global ('pool') variable named 'x' of type 'A'. Global variables are initialized with nil.
1 + 2;This TooL code sends a message with the selector '+' to the object '1', passing the '2' as an argument. This can be interpreted as a request for the receiver to add the given argument to itself. Another, presumably more interesting example is:
x := A.new, x.a := 13, x;This code creates a new instance of class A and initializes the 'a' slot. Note that the pool variable 'x' must have been defined previously (see above).
DO help;for a list of available commands.
DO check;This command triggers the TooL type checker. The system maintains an agenda of classes that should be type checked. You must explicitely trigger the type checker with the above command (the command also accepts a list of classes that should be checked, default is all classes on the agenda). You might also want to take a glance at the current agenda:
DO printAgenda;Triggering the type checker is optional (you can run TooL programs without any type check at all) but advisable: the type checker will catch type errors that would otherwise be tedious to find by reporting errors at the place they are made (e.g. by passing a parameter of the wrong type) rather than at the place they emerge (by sending a message to an object that does not support it).
Note: the following commands can be found within the file $TYCOON_ROOT/bootlib/tool0/script.tyc. Use your favorite text editor (presumably Emacs) and copy-paste 'em into the shell.
First, cd into the Tycoon root directory and start your TL toplevel:
cd $TYCOON_ROOT/bootlib tycoonTo build the TooL compiler, type the following:
do makeLibraries tool0; do make tool; import tool; tool.generateBootFile("tool.x");