kc++ [options] \(file...


kc++ reads the abstract syntax de\(finition, function de\(finitions, 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 \( and \(file.h \(files that contain the translation of the functions de\(fined 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 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 de\(finition of the abstract syntax.

If no command line \(file arguments are given, the translation of the user-de\(fined 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 e\(Ficient Make\(file.



-c, --no-csgio

no read/write functions (csgio.{h,cc}) are generated.

-r, --no-rewrite

no code for rewrite rules (rk.{h,cc}) is generated.

-u, --no-unparse

no code for unparse rules (unpk.{h,cc}) is generated.

-d, -no-printdot

no printdot functions for printing dot-\(files (input for the graphviz package) are generated.

-t, -no-hashtables

no code for hastables is generated (works only when both --no-csgio and --no-printdot are speci\(fied).


generate operatork.h for operator_cast<>


-n, --covariant=C

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 de\(finitions).


include for Microsoft precompiled header \(files is generated (default stdafx.h).

-e, --dllexport=STRING

generates string between keyword class and the class name of all operators and phyla (used eg. for DLL export de\(finitions for Windows).

-m, --smart-pointer

generates code for smart pointers (does reference counting).

-w, --weak-pointer

generates code for weak pointers (implies --smart-pointer).


-s, --suffix=EXT

extension for generated source \(files (default cc).

-f, --file-prefix=PREF

pre\(fix for generated \(files.

-o, --overwrite

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++.


-l, --no-linedirec

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.

-p, --pipe=CMD

\(filter every input \(file through CMD. The programm will be called as CMD \(file.k and must deliver its output to standard output.


-M, --msg-format=PATTERN

speci\(fies 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)

-q, --quiet

be quite quiet about warnings etc., give only return status (not implemented).

-v, --verbose

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

-h, --help

give a short help message.

-V, --version

print the version number of kc++ and exit.



the grammar and default functions


the rewrite view declarations and rewrite functions


the CSGIO functions


the unparse view declarations and unparsing functions


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).


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.


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.


Kimwitu was written by

Axel Belinfante, University of Twente, the Netherlands.

Kimwitu++ was written by

Michael Piefel, Humboldt-Universität zu Berlin, Germany.


Report bugs to <[email protected]>; we'd also like to hear from you when you successfully use Kimwitu++ for your projects.


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.