SYNOPSIS

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

DESCRIPTION

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 \(file.cc 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 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 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.

OPTIONS

KIMWITU++ FEATURES

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

--operator-cast

generate operatork.h for operator_cast<>

C++ COMPILER OPTIONS

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

--stdafx[=FILE]

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

OPTIONS FOR FILE GENERATION

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

-b,

--yystype[=FILE] generates \(file (default yystype.h) containg YYSTYPE for yacc(1) or bison(1).

-y,--yxx-union

generates \(file yxx_union.h for yacc++.

ADVANCED OPTIONS

-l, --no-linedirec

does not emit line directives (`#line'). This is sometimes handy when you need to debug your program.

--comment-line

prints line comments (`//line') instead of line directives. This may aid debugging when the bugs are not in your code but in Kimwitu++.

--dir-line

prepends the current working directory to the \(file name in line directives.

--rw-loop

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.

GENERAL OPTIONS

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

-W[what]

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.

GENERATED FILES

k.{h,cc}

the grammar and default functions

rk.{h,cc}

the rewrite view declarations and rewrite functions

csgiok.{h,cc}

the CSGIO functions

unpk.{h,cc}

the unparse view declarations and unparsing functions

\(file.{h,cc}

translation of user-provided Kimwitu++ functions.

stdin.{h,cc}

translation of user-provided Kimwitu++ functions if no command line \(file arguments were given.

yystype.h

(or any other name you specify) the YYSTYPE union.

yxx_union.h

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

Kimwitu was written by

Axel Belinfante, University of Twente, the Netherlands.

Kimwitu++ was written by

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

REPORTING BUGS

Report bugs to <[email protected]>; 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.