Name

strc — compiles Stratego programs to C or executable code

Synopsis

strc [-i file | --input file] [-o file | --output file] [-I dir | --Include dir] [-m name | --main name] [--lib | --library] [-C-include file] [-CI dir] [-CD name=def] [-CL dir] [-Cl file] [-la name] [-Xlinker arg] [--xtc-repo file] [-c] [--ast] [-F] [--keep level] [--format-check level] [-O level] [--fusion] [--choice-lib file] [-S | --silent] [--verbose level] [--man] [-v | --version] [-W | --warning category] [--asfix] [-h | -? | --help] [--about] [--version]

Description

Stratego is a language for program transformation based on the paradigm of rewriting strategies. The Stratego compiler strc translates a Stratego program to a C program then uses gcc to compile the C file into an executable binary. Stratego modules have the file extension .str.

strc is nominally a whole program compiler. This means that in its normal mode of operation, it completely reads all imported modules and then compiles this collection in its entirety to one C program. This compilation scheme is used because the current Stratego language design does not permit separate compilation. Whole program compilation allows aggressive optimization of programs.

There is some rudimentary support for separate compilation of modules using the -lib option. For non-trivial applications, separate compilation speeds up compilation time drastically, but prevents some language features to be used.

The Stratego language definition is provided in the Stratego Language chapter. For up to date information, refer to the stratego-language.org website.

Options

Common Options

-i file, --input file

Main module to compile (required)

-o file, --output file

Write output to file

-I dir, --Include dir

Include modules from directory dir

-m s, --main s

Use the strategy s as main strategy instead of main.

--lib, --library

Build a library instead of an application.

--C-Include file

Include C header file ("foo.h" or <foo.h>)

-CI dir

Include C header files from directory dir

-CD name=def

Predefine name as macro, with definition def.

-CL dir

Include binary libraries from directory dir

-Cl file

Search the library named file when linking.

-la name

Search the libtool library libname.la when linking.

-Xlinker arg

Pass the argument arg to the linker.

--xtc-repo file

Set the default XTC repository in the compiled output program to file. The default is to not set any XTC repository.

-c

Produce C code only, i.e. don't invoke gcc to compile to binary executable.

--ast

Produce Stratego abstract syntax tree

-F

Produce normalized specification

--keep level

Keep intermediate results (0 = keep nothing).

--format-check level

Format check intermediate results (0 = basic checking).

-O level

Set optimization level level (0 = no optimization).

--fusion

Toggle specialize applications of innermost. The default is on.

-S, --silent

Silent execution (same as --verbose 0)

--verbose level

Verbosity level level. The default is 1.

-W category, --warning category

Report warnings failling into category category, which must be either of the following:

  1. all - all categories (this is default)

  2. no-CC - no warnings in category C

  3. debug-arguments - missing build operator

  4. obsolete-strategy-calls - obsolete strategies

  5. maybe-unbound-variables - unbound variables

  6. lower-case-constructors - warn when finding lower case constructors

--asfix

Concrete syntax parts are not imploded

--help, -h, -?

Display usage version

--about

Display information about this program.

-v, --version

Same as --about

Examples

Compile module M.str to an executable M

$ strc -i M

Use the strategy foo as main strategy instead of main.

$ strc -i M --main foo

Compile module M.str to C code in file M.c

$ strc -i M -c

Include modules from directory ../sig

$ strc -i M -I ../sig

Reporting Bugs

Please report bugs to

Copyright

Copyright (C) 2002-2005 Eelco Visser

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.