gen-renamed-sdf-module — generates an SDF module that renames all SDF sorts in a given SDF definition.
gen-renamed-sdf-module
[-m mod
| --main mod
]
[--name mod
]
[--prefix id
]
[--scheme [...]
]
[-i file
| --input file
]
[-o file
| --output file
]
[-b]
[-S | --silent]
[--verbose level
]
[-k level
| --keep level
]
[-h | -? | --help]
[--about]
[--version]
The gen-renamed-sdf-module utility is used to generate modules where sorts are either
prefixed (with the --prefix
option) or renamed (using the
--scheme
option).
This tool is useful for concrete object syntax embeddings, where the sorts in
the embedded language syntax definitions must be renamed before being imported into
the host language, so as to avoid name space conflicts between the two syntax
declarations. For example, both the embedded and the host language may declare
an Exp
sort.
Grammar Options
-m mod
, --main mod
Use mod
as the main module in the SDF definition. By default,
this is Main
.
--name mod
Name of the resulting module. This option is mandatory.
--prefix id
Prefix all sort names with id
.
--scheme [...]
Rename the sorts according to the scheme in [...]
.
Common Input/Output Options
-i file
The input term given by the file name
.
file
In the absence of the -i
option, input
will be read from stdin
.
-o file
The output will be written to the file given by the file name
.
file
In the absence of the -o
option,
output will be written to stdout
.
-b
The output will be written in the binary (BAF) ATerm format.
ATerms in the BAF format require a lot less space than ones in the TAF format, but the Java ATerm library does not currently support baf ATerms. ATerms in the baf format is the preferred format of exchange between Stratego tools.
Common Debugging Options
--about
See --version
.
-h
, -?
, --help
Display usage information.
--keep int
Keep intermediate results produced by the internal stages in the
pretty-printing process. This is only useful for debugging. A high
value of int
indicates increased eagerness
for keeping intermediate results.
Default setting is 0, indicating that no intermediates will be kept.
-S
, --silent
Silent execution. Same as --verbose
.
0
--verbose int
Set verbosity level to numerical value int
. The
higher the number, the more information about pp-aterm's inner workings are
printed.
Alternatively, int
can be set to either of the
following verbosity levels, given in increasing order of verbosity:
emergency
, alert
, critical
,
error
, warning
, notice
,
info
, debug
, vomit
.
--version
Displays the tool name and version.
Consider the following syntax definition.
definition module Expressions imports Identifiers [Id => MyId] exports sorts Exp context-free syntax Id -> Exp {cons("Var")} IntConst -> Exp {cons("Int")} Exp "+" Exp -> Exp {left, cons("Plus")} module Identifiers exports sorts Id lexical syntax [a-zA-Z]+ -> Id
By applying gen-renamed-sdf-module as follows, all sorts will
be prefixed by Exp
.
$
gen-renamed-sdf-module -i Exp.def -m Expressions --name Exp-Prefixed --prefix Exp
The generated definition is:
module Exp-Prefixed imports Expressions [ IntConst => ExpIntConst MyId => ExpMyId Exp => ExpExp ]
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.