Next Previous Contents

2. Invocation

asdlGen --command [ command options ] files ...

Where command is one of


c
Output ANSI C
sml Output Standard ML
haskell Output Haskell
java Output Java
cxx Output C++
doc Output doc directory with HTML descriptions
typ Output a machine readable type description of the inputs
check Check correctness of inputs
all Do all of the above
pp_pkl Pretty Print an ASDL pickle see section Pickles

The command options are specific to each command. For a complete list of options examine the output files produced by a given command. Each file should include a comment of all the available options and the values used to produce the output.

asdlGen reads the set of files which contain ASDL module declarations and view declarations. The module declarations must be complete and not refer to any other modules or types not defined in one of the input files. The order of the input files is unimportant. This closed set of files is referred to as a type environment.

2.1 Common Options

Options common to all the commands include

--no_action={true| false} or -n

Do not write any output files. Instead output the list of files that would have been written to standard out.

--line_width=width

Set the maximum line width for pretty printing code. The default value is 72 characters.

--output_directory=dir or -d dir

By default the output will be placed in the same directory as the input file from which it was produced. Some commands like --java will create their own subdirectory to place their output. The --output_directory option overrides the default output directory.

--view=name or -V name

Sets the default view to name. The default view name is by convention the command name with the first character capitalized. See the section Views in the user guide for a more detailed description.

2.2 Language Specific Options

All the commands that produce source code as output offer a different command option to select the default base environment. The base environment is the set of the initial definitions available to the code. It defines the set of primitive types and functions used by the generated code. For example using the option --base_include=my_base.h when generating C code will insert

#include "my_base.h"
in the appropriate place so the resulting code will use the definitions found in my_base.h rather than the default set of primitive types. Unless there is a need to globally redefine the primitive types changing the base environment should be avoided. The actual option names vary depending on the output language.

See the section on Support Code for a more detailed description about the interfaces to the default set of primitive types and functions provided with the current release.

C

--base_include=file.h

The default value is cii_base.h. Name of the C header file to include that define the primitive types and functions for all the generated code.

--mono_types={true| false}

The default value is false. If true expand sequence and option types into new distinct types for each different qualified type.

--attribs_default={true|false}

The default value is true. Controls whether attributes fields are included in the argument to the default constructor generated by asdlGen for sum types. If true then attributes are include as argument to the default constructors. If false the attributes are not included in the argument for the constructors.

--default_only={true|false}

The default value is true. Controls whether or not to generate two constructors for sum types that have attributes. One constructor includes attributes as arguments the other does not. If this value is false then the attribs_default argument toggles between whether the default constructor contains attributes in the argument or the non-default constructor does. The default constructor is a function whose name is the same as the constructor in the sum type declaration. The non-default constructor is a function whose name is prefixed with either with_attribs or no_attribs depending on the value of --attribs_default. This functionality will probably get moved into the view framework rather than being a command line switch.

C++

--base_include=file.hxx

The default value is asdl_base.hxx. Name of the C++ header file to include that defines the primitive types and functions for all the generated code.

--simple_sequences={true| false}

The default value is true. Use a simple linked list representation for sequences. Set to false to use a template based sequence representation. See asdl_base.hxx for a default sequence template example.

Java

--base_import=package_spec

The default value is asdl_base.*. The package import specification to define the primitive types and functions for all the generated code.

--simple_sequences={true| false}

The default value is true. Use a simple linked list representation for sequences. Set to false to use java.util.Vector instead.

Standard ML

--base_signature=signature_name

The default value is BASE. The signature to include in all signatures generated that define the primitive types.

--base_structure=structure_name

The default value is Base. The structure to open in all structures generated that define the primitive types and functions.

Haskell

--base_import=module

The default value is HaskellBase. The module to import unqualified that define the primitive types and functions for all the generated code.


Next Previous Contents