From Tom

Revision as of 08:13, 13 December 2011 by Jcb (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
Doc : Tools

Installation  > Compiling from sources  > Using Tom  > Using Gom  > Configuring your environment  > Tom Server  > EMF Mapping Generator


Installing Tom


Tom is a Java application written with JDK 1.5. Tom is platform independent and runs on various systems. It has been used successfully on many platforms, including GNU/Linux distributions (Debian, Gentoo, Mandrake, Ubuntu), MacOS X, FreeBSD, NetBSD, Windows XP, Windows Vista and Windows 7.

The only requirement to run and compile Tom programs is to have a recent Java Development Kit installed (version 1.5 or newer):

Windows (simple install)

For a painless process, run the tom-2.9_setup.exe kit provided (downloads). This will automatically update the environment as needed.

Windows (manual install)

If for any reason you prefer to install Tom manually, here is the procedure to follow:

We assume that Tom is installed in C:\tom (any other directory may be chosen). The following steps are needed for setting up the user variables of your environment:

  • set JAVA_HOME to where Java JDK is installed (for instance: C:\Program Files\Java\jdk1.6.0_13)
  • set TOM_HOME to C:\tom
  • set CLASSPATH to .;%TOM_HOME%\lib\tom-runtime-full.jar
  • set PATH to %Path%;%TOM_HOME%\bin;%JAVA_HOME%\bin

For a detailed description of setting environment variables in Windows, please refer to Windows documentation. For Windows XP, some information can be found here

Windows (with Cygwin)

We assume that Tom is installed in c:\tom. Please issue the following for setting up Tom:

  export TOM_HOME=/cygdrive/c/tom
  export PATH=${PATH}:${TOM_HOME}/bin
  export CLASSPATH=${TOM_HOME}/lib/tom-runtime-full.jar:${CLASSPATH}

Note: we recommend to add current directory . in your CLASSPATH.


To install Tom, choose a directory (${HOME}/tom for instance) and copy the distribution files there. This directory will be called TOM_HOME in the following.

The following sets up the environment, for Bourne shell (sh) and C shell (csh) families:

  export TOM_HOME=${HOME}/tom
  export PATH=${TOM_HOME}/bin:${PATH}
  export CLASSPATH=${TOM_HOME}/lib/tom-runtime-full.jar:${CLASSPATH}
  setenv TOM_HOME ${HOME}/tom
  set path=( ${TOM_HOME}/bin $path )
  setenv CLASSPATH ${TOM_HOME}/lib/tom-runtime-full.jar:${CLASSPATH}

Note: we recommend to add current directory . in your CLASSPATH.

Getting some examples

Many examples have been written to test or illustrate some particular behaviors. This collection of examples is available: (see also downloads).

Unzip the archive and use the tool Ant to compile the examples:

Note: for Debian users, the ant package does not include the ant-optional java package, Debian (and Debian-based distributions like Ubuntu) users also need to install the ant-optional Debian package.

Using Eclipse IDE

The Eclipse platform (tested with versions 3.4 and 3.5) can be used to edit, compile, and run with Tom program. Eclipse is available for download at


Tom has to be installed using one of the previously described methods:

  • simple Windows install: run tom-2.9_setup.exe
  • manual install (Windows or Unix)

Use Ant to compile an example

  • import the examples as a project (create a Java projet and use the File->Import->General->Archive File)
  • Window->Open Perspective->Other->Java (default)
  • expand examples/addressbook
  • Window->Show View->Other->Ant
  • move the build.xml file to the Ant view
  • click on the build target

To run an example

  • in the package explorer: right-click->refresh (or press F5)
  • open the "Run Dialog" box (Run->Run Configurations)
  • select Java Application
  • enter addressbook.AddressBookGom as Main class
  • in the "Classpath" tab, select "User Entries"
    • click Add External JARs, and select the JAR <TOM_HOME>/lib/tom-runtime-full
    • click on the Advanced button, add examples/build using Add Folder

Configure the editor

  • use Windows->Preferences->General->Editors->File Associations to associate a Java Editor to *.t files

Eclipse Plugin

In parallel to Tom, we also develop an Eclipse Plugin (for Eclipse 3.4 only) that integrates an editor and a compiler for Tom.

The plugin is available directly from the Eclipse platform via the update link:

  • Help->Software Updates or Help->Install New Software
  • select Available Software, Add Site
  • enter:
  • select Tom plugin and click Install

Note: if the plugin doesn't appear in list, uncheck "Group items by category"

To use the plugin:

  • create a Tom projet (New->Project->Tom->Tom Project)
  • in src, create a Tom file (New->Other->Tom->Tom File)

For more information, we invite the reader to use the integrated help (Help->Help Contents->Tom Online Help)

Warning: the Tom Eclipse Plugin is less stable than the main distribution. It is perfect for developping small projects, for teaching, etc. But we do not recommend to use it for large developments


The binary distribution of Tom consists of one of the following directory layout:

  +--- bin (BSD Licence)
  +--- lib 
  |     +--- tom-runtime-full (BSD Licence)
  |     |
  |     +--- tom-compiler-full (GPL Licence)                                                                                  
  +--- share (BSD Licence)
        +--- contrib
        +--- man
        +--- tom 
              +--- adt
              +--- c
              +--- caml
              +--- java

or (version with separate jars):

  +--- bin (BSD Licence)
  +--- lib 
  |     +--- compiletime (not developed by the Tom project)
  |     |     +--- ant-antlr          // ant task for antlr
  |     |     +--- ant-contrib        // ant task for running regress tests
  |     |     +--- ant-junit          
  |     |     +--- ant-launcher
  |     |     +--- ant                // to compile the project
  |     |     +--- antlr3             // ant plugin for v3
  |     |     +--- junit              // to test the system
  |     |
  |     +--- runtime (BSD Licence)
  |     |     +--- shared-objects     // Factory of shared objects
  |     |     +--- jjtraveler         // Visitable interface
  |     |     +--- aterm              // ATerm library
  |     |     +--- tom-library        // support for strategies, bytecode, viewer, and xml 
  |     |     +--- emf                // support for Eclipse Modelling Framework
  |     |     +--- Bytecode           // ADT for ASM Bytecode library
  |     |     +--- TNode              // ADT for XML
  |     |
  |     +--- tom (GPL Licence)
  |     |     +--- tom                // Tom compiler
  |     |     +--- gom                // Gom compiler
  |     |     +--- GomADT             // ADT for Gom 
  |     |     +--- TomSignature       // ADT for Tom
  |     |     +--- plugin-platform    // plugin platform
  |     |     +--- PlatformAlert      // platform error messages
  |     |     +--- PlatformOption     // platform options
  |     |
  |     +--- tools (not needed by the runtime, unless you use bytecode, term viewer, or xml supports)
  |     |     +--- antlr-2.7.7        // to compile the Tom parser
  |     |     +--- antlr-3.2          // to compile the Gom parser
  |     |     +--- asm-3.0            // to manipulate bytecode
  |     |     +--- grappa1_2          // to visualize terms
  |     |     +--- xercesImpl         // for XML
  |     |     +--- xml-apis           // for XML
  |     |     +--- args4j-2.0.10      // for command line parsing
  |     |     +--- commons-lang-2.4
  +--- share (BSD Licence)
        +--- contrib
        +--- man
        +--- tom 
              +--- adt
              +--- c
              +--- caml
              +--- java


Installation  > Compiling from sources  > Using Tom  > Using Gom  > Configuring your environment  > Tom Server  > EMF Mapping Generator

Tom Documentation
Guided Tour :: Tutorial :: Language Reference :: Tools
Personal tools
Create a book