pack-sdf — packs a set of SDF modules into a single definition


pack-sdf [-I dir | --include dir] [-Idef lang] [--dep file] [-of format] [-i file | --input file] [-o file | --output file] [-b] [-S | --silent] [--verbose level] [-k level | --keep level] [-h | -? | --help] [--about] [--version]


An SDF syntax definition consists of a set of modules. pack-sdf collects all modules imported by module m in file m.sdf and creates a combined syntax definition in file m.def.

The search order for SDF modules is:

  1. The directory of the main module specified with the -i option

  2. The specified include options (-I), in the order they are given on the command-line.

  3. The XTC repository

Error Reporting

pack-sdf checks if the module name specified in an SDF module file, corresponds to the actual filename. Having different names can lead to subtle errors which are difficult to find.

Missing modules will be reported by pack-sdf. Usually, the module is not really missing, but the name of this import is incorrect. Therefore, pack-sdf reports the module(s) from where the 'missing' module is imported. pack-sdf prints a detailed report of all missing modules and the module where these are imported.

Generation of Dependency Files

pack-sdf supports the creation of a dependency file suitable for inclusion in a Makefile. AutoXT's Makefile.xt will instruct pack-sdf to do this, so there is no need to specify dependencies of SDF files by hand.


File Options

--dep file.dep

Write make dependencies to file.dep

-I dir

Include modules from directory dir. pack-sdf will give a warning if the directory does not exist.

-Idef file.def

Include modules from SDF definition in file file.def. pack-sdf will give a warning if the file does not exist.

-of format

Use output format format, which must be either of txt, asfix or ast.

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.


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


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.


Displays the tool name and version.


Issuing the following command will collapse all external SDF modules references found in the lang.sdf file into one single definition, by searching the local directory, then the lang/. The result is written to lang.def. All file dependencies will be computed and placed in a make-compatible file, called lang.dep:

$ pack-sdf -I lang --dep lang.dep -i lang.sdf -o lang.def

Reporting Bugs

Please report bugs to


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.