Skip to content

Using the console controller

Frank Zechert edited this page Jun 4, 2013 · 5 revisions

The console controller links all compiler components together and executes them in a toolchain to generate target code from a source code file. The console controller is found inside the package FUC-Controller.jar created when the FUC project is distributed (How to build and distribute fuc compiler).

Contents
  1. Compiler Components
  2. Visualization
  3. Command Line Arguments
  4. Run The Controller

Compiler Components

The controller searches its classpath for compiler Components using Java's ServiceLoader framework. To add a compiler component to the console controller just place it into the classpath.

If more than one component is found for the same Compiler Component (e.g. two Lexer implementations) the first one found is used by default. You can change this by applying command line arguments.

Visualization

The controller can visualize the compilation steps. To enable visualization add one or more of FUC-VISU*.jar to the classpath. The controller will search for them using Java's ServiceLoader framework.

Every Visualization found on the classpath will be used unless you switch off visualization by applying command line arguments.

Command Line Arguments

The following command line arguments are supported by the console controller:

SWP Compiler v0.0

Usage: java -cp plugun1.jar:plugin2.jar:...:Controller.jar [options] [--] [input-filename]

  input-filename may be '-' for stdin or a relative or absolute path to a file.

  '--' is an optional separator between options and the input-file, useful if path to the input file begins with character '-'.


  arguments may be any of:
     -h/-?/--help            emits this help message
     -o <output>             output filename, only used by llvm
     -j --jit                just in time compile (not yet supported)
     -l --loglevel <level>   set the loglevel. allowed values are:
                               ALL DEBUG ERROR FATAL INFO OFF TRACE WARN
     -V --no-visualization   disables the automatic visualization pass if visualization plugins are found

Run the Controller

Two shorthands are provided to run the controller with default FUC Compiler Components and Visualization. You can use ant run -Dsource.file=<path to source code file> to run the controller from ant. ant run does not support any of the above command line arguments. If FUC Compiler is already built use ant run-without-build to skip the build process and save some time.

Alternatively you can use the fuc.sh bash script to run the controller. You can pass any of above command line arguments.

Both of the above shorthands will use all JAR files located in the dist directory.

If you want to run the controller with your own components consider starting the controller by yourself using java -cp Component_1.jar Component_2.jar ... FUC-Controller.jar controller.Controller <command line options>