strc — compiles Stratego programs to C or executable code
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]
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.
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
as main strategy instead of s
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
when linking.
file
-la name
Search the libtool library lib
when linking.
name
.la
-Xlinker arg
Pass the argument arg
to the linker.
--xtc-repo file
Set the default XTC repository in the compiled output program to
. The default is
to not set any XTC repository.
file
-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:
all
- all categories (this is default)
no-
- no warnings in category C
CC
debug-arguments
- missing build operator
obsolete-strategy-calls
- obsolete strategies
maybe-unbound-variables
- unbound variables
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
Compile module
to
an executable M
.strM
$
strc -i M
Use the strategy foo
as main strategy instead of
main
.
$
strc -i M --main foo
Compile module
to
C code in file M
.strM
.c
$
strc -i M -c
Include modules from directory ../sig
$
strc -i M -I ../sig
Copyright (C) 2002-2005 Eelco Visser <visser@acm.org>
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.