TRex Standalone Usage

It is possible to use the TRex core (i.e. parser, symbol table, pretty printer, etc.) in a standalone application without the Eclipse IDE. This makes it possible to exploit the TRex core for other TTCN-3 based tools that are not based on Eclipse. For this purpose, there is a project in the Subversion Repository called parserDemo. You can check out this demo and use it as a starting point. It currently directly depends on three other TRex plugins:

  • de.ugoe.cs.swe.trex.antlr,
  • de.ugoe.cs.swe.trex.core,
  • com.yourkit.profiler.controller.

Thus, these need to be checked out as well and added as dependencies (if checkout these plugins using Eclipse, the .classpath already takes care that these dependencies are correctly set). The parserDemo contains a few comments that should explain the basic things. Otherwise, the parserDemo example is very minimalistic: it basically only analyzes the included .ttcn3 files (i.e. parses and builds a symbol table) and outputs one file using the included pretty printer.

You may run the main method of the class Tool from within Eclipse without problems. However, since you are interested in standalone usage, the description how to run this from command-line follows below:

Execution on the command-line

The following call should execute the parserDemo on the command line (you may have to adjust the version numbers of the Eclipes jars accordingly):

java -cp org.eclipse.core.resources_3.2.0.v20060603.jar;org.eclipse.core.runtime_3.2.0.v20060603.jar;org.eclipse.equinox.common_3.2.0.v20060603.jar;com.yourkit.profiler.controller.jar;de.ugoe.cs.swe.trex.antlr.jar;de.ugoe.cs.swe.trex.core.jar;parserDemo.jar;org.eclipse.osgi_3.2.0.v20060601.jar Tool

If you use Eclipse 3.4, you need the following jars in your classpath (version numbers may differ):

  • org.eclipse.core.resources_3.4.0.v20080604-1400.jar
  • org.eclipse.core.runtime_3.4.0.v20080512.jar
  • org.eclipse.equinox.common_3.4.0.v20080421-2006.jar
  • org.eclipse.osgi_3.4.0.v20080605-1900.jar
  • de.ugoe.cs.swe.trex.antlr_2.7.6.jar
  • de.ugoe.cs.swe.trex.core_0.6.0.200808131007.jar
  • com.yourkit.javaprofiler.controller_7.0.4.jar

As you can see, there are a few more Eclipse dependencies that cannot be avoided currently. The other jar files are located in the Eclipse/plugins directory of your Eclipse installation. You can simply use them or copy them to your distribution directory.

The End

This description is brief. Don't hesitate to contact if there are any more questions!