Scroll to navigation

KC++(1) General Commands Manual KC++(1)

NAME

Kimwitu++ - generate C++ code from Kimwitu++ input

SYNOPSIS

kc++ [options] file...

DESCRIPTION

kc++ reads the abstract syntax definition, function definitions, rewrite rules and unparse rules from the files given on the command line, or from the standard input if no file arguments were given. It generates for each file.k input file a pair of file.cc and file.h files that contain the translation of the functions defined in the corresponding file.k.

Additionally the following files are generated: csgiok.{h,cc}, rk.{h,cc} and unpk.{h,cc}, that contain the CSGIO-, the rewrite- and the unparse-functions, respectively, and the k.cc and k.h files that contain the grammar tables and the remaining `default' functions as well as the declaration of the classes for each phylum in the definition of the abstract syntax.

If no command line file arguments are given, the translation of the user-defined functions will be generated in stdin.{h,cc} files.

kc++ does not unnecessarily overwrite a file: if a file would be overwritten with its own (identical) contents, it will not be touched. This makes it easy to write an efficient Makefile.

OPTIONS

KIMWITU++ FEATURES

no read/write functions (csgio.{h,cc}) are generated.
no code for rewrite rules (rk.{h,cc}) is generated.
no code for unparse rules (unpk.{h,cc}) is generated.
no printdot functions for printing dot-files (input for the graphviz package) are generated.
no code for hastables is generated (works only when both --no-csgio and --no-printdot are specified).
generate operatork.h for operator_cast<>

C++ COMPILER OPTIONS

use covariant return types; options are yes (use them), no (don't use them, requires explicit casting), or pre (use preprocessor symbol NO_COVARIANT_RETURN to guard the definitions).
include for Microsoft precompiled header files is generated (default stdafx.h).
generates string between keyword class and the class name of all operators and phyla (used eg. for DLL export definitions for Windows).
generates code for smart pointers (does reference counting).
generates code for weak pointers (implies --smart-pointer).

OPTIONS FOR FILE GENERATION

extension for generated source files (default cc).
prefix for generated files.
always write generated files even if not changed.
--yystype[=FILE] generates file (default yystype.h) containg YYSTYPE for yacc(1) or bison(1).
generates file yxx_union.h for yacc++.

ADVANCED OPTIONS

does not emit line directives (`#line'). This is sometimes handy when you need to debug your program.
prints line comments (`//line') instead of line directives. This may aid debugging when the bugs are not in your code but in Kimwitu++.
prepends the current working directory to the file name in line directives.
generates a non recursive rewrite function.
filter every input file through CMD. The programm will be called as CMD file.k and must deliver its output to standard output.

GENERAL OPTIONS

specifies format of (error) messages. The actual message is appended. PATTERN can contain:

%p (program name)
%s (severity)
%f (file name)
%d (current working directory)
%l (line number)
%c (column)
be quite quiet about warnings etc., give only return status (not implemented).
print additional status information while processing.
enable all warnings; use comma-seperated list for detailed control (can be prefixed with `no')

drop – dropped rule bodies (no code generated)
equiv – equivalent patterns (cannot match)
overlap – possibly overlapping patterns
give a short help message.
print the version number of kc++ and exit.

GENERATED FILES

the grammar and default functions
the rewrite view declarations and rewrite functions
the CSGIO functions
the unparse view declarations and unparsing functions
file.{h,cc}
translation of user-provided Kimwitu++ functions.
translation of user-provided Kimwitu++ functions if no command line file arguments were given.
(or any other name you specify) the YYSTYPE union.
the (anonymous?) union (for yacc++, apparently).

DIAGNOSTICS

If an error is encountered in the Kimwitu++ input, an appropriate error message will be written on standard error, code generation will be suppressed and a non-zero exit value will be returned. The error messages should be self-explanatory.

BUGS

The error messages are not always very self-explanatory. Sometimes kc++ gets confused by parse errors.
The option -p is a hack. Not much checking is done, no fault recovery. Don't interrupt kc++ when piping, you will regret it.

AUTHOR

Axel Belinfante, University of Twente, the Netherlands.
Michael Piefel, Humboldt-Universität zu Berlin, Germany.

REPORTING BUGS

Report bugs to <piefel@informatik.hu-berlin.de>; we'd also like to hear from you when you successfully use Kimwitu++ for your projects.

COPYRIGHT

Copyright © 1998-2008 Michael Piefel, Humboldt-Universität zu Berlin
Kimwitu++ comes with no warranty; for details see GPL.
This is free software, and you are welcome to redistribute it under certain conditions; for details see GPL.

February 2008 Kimwitu++