Changes from V4_6 to V4_6_1: (2000/04/14) New license: This version of Kimwitu is distributed under the GNU Public License. This gives you the freedom to hack on the source, and redistribute it, without contacting us first. However, this does _not_ imply that we are no longer interested in your hacks/comments/feedback! In contrast, we are still very much interested in whatever you do with Kimwitu, and in particular, if you hack/change/extend Kimwitu, we are very interested in knowing about it, to see if your work can be integrated in this distribution. Contact: or . Apart from the new license, this version is identical to version V4_6. In particular, ``kc --version'' will return ``V4_6''. Changes from V4_5P5 to V4_6: (1998/03/18) New feature: added a --overwrite flag, that forces kc to always write the generated files, even if the contents of the files are not changed. IMPORTANT Bugfix in the code generation part: one routine in the code generation part depended on the order in which the C compiler evaluates the function arguments :-( (also, an attribute was not initialized properly) By accident, this has not caused problems until now, when kc was compiled with visual c++ 5.0 (windows nt). Minor cleanup in the Makefile. Added target for purify in the Makefile Minor cleanup in the code (which may make it hard use an very old kc to bootstrap, because we now use the %uview statement) Changes from V4_5P4 to V4_5P5: (1998/02/05) Incompatible change: renamed the fprintdotheader and fprintdotfooter routines into resp. fprintdotprologue and fprintdotepilogue, because these names better reflect their use (and they do _not_ print headers or footers in the usual (page header/footer) sense). Changes from V4_5P3 to V4_5P4: (1998/01/29) Porting improvement: with the check for _WIN32 we likely broke compilation by gcc on windows (via the cygnus kit). So, we refined the check for 'win32' system call use: we now use 'normal' system/library call names on windows if __GNUC__ is defined. (we probably should do this in better way, like we do KC_STDC) Changes from V4_5P2 to V4_5P3: (1998/01/29) Minor cleanup in the generated code (to get rid of some warnings) WARNING: one change involves casting a double to float, which may cause loss of data (but then again, we lost it anyway, probably...) Changes from V4_5P1 to V4_5P2: (1998/01/29) Minor change in the source code: we now use (and depend on) the macro KC_STDC being defined when we have an Ansi-C (like) compiler. This macro was introduced in version V4_5P1. Changes from V4_5 to V4_5P1: (1998/01/28) New feature: kc can now be compiled as 'console application' on windows nt by visual c++ 5.0 (by simply compiling all *.c files in the distribution) (see below for what we change to make this possible) Improved on the support for compilation of kc and -generated code as C++ code, and made it compile under windows (visual C++ 5.0) -- it compiles cleanly as a 'windows console application', when compiled as C code, but there is one minor problem when you use visual C++ 5.0 and compile it as C++ code (/TP flag): the flex skeleton file that we use (and that is 'present' in the generated (bootstrap) kimwl.c file) tries, only when compiled as c++ code(!!), to include a unistd.h file which is not avaikable in visual c++ 5.0. However, you can simply remove that include line from kimwl.c, if necessary, and then it compiles cleanly. The current .k source code now contains some more extensive checks to set 'ansi C mode' -- in the next version we can use the support that this version adds to the generated code: each generated file defines at the start of the file the macro KC_STDC if we can (should) use ansi-c 'mode'. You can set this macro as a -D flag for the compiler if necessary (if the current check doesn't detect _your_ ansi-c (like) compiler. If, however, the code _erroneously_ tries to use ansi-c mode, (while your compiler works better in K&R mode) then you can prevent KC_STDC being set, by defining the macro KC_NO_STDC in your Makefile as compiler -D flag, which overrules the above mentioned check. The current source and generated code now looks at the _WIN32 macro to see if 'windows' names (that start with an underscore _) should be used for a small number of system calls. Minor cleanup in generated code: silenced a (visual c++ 5.0) wanning about a couple of signed/unsigned int comparisons. New porting feature: It should now be easy to compile kc on a platform where the Makefile cannot be used! This is the result of a small change in the way we 'bootstrap' kc: we copy/link now all source files into the gen (compilation) directory, and therefore no longer need a -I flag to refer to the source directory, and therefore no longer have to worry about clashes between distributed source files and locally regenerated ones, so we can drop the 'bs' prefix of the 'bootstrap' source files. As a result, it should be possible to simply take all *.[ch] files from the distribution, put them in a directory, and compile the whole lot, to get a working kc!!! Changes from V4_4P1 to V4_5: (1998/01/27) Added support for compilation of kc and kc-generated code as C++ code. kc now compiles under g++ (sunos 5.5.1, gcc 2.7.2.2; linux 2.0.29, gcc 2.7.2.1) it should now be easier to compile kc-generated code as C++ code, because we now (in more places) look if __cplusplus is defined, instead of only looking if __STDC__ is defined (and, as it seems, at least one version of Visual C++ defines by default only __cplusplus and not __STDC__ . I still have to try to compile this version of kc with visual c(++)) Changes from V4_4 to V4_4P1: (1997/05/26) Bugfix in the kc input checker of the patterns in the .k input files: fixed a bug in the pattern compilation code, where the type of outermost pattern variables was lost (we need them sometimes for non-left-lineair patterns), and added the feature that we now can use the type of a non-left-lineair outermost pattern variable to set the type (phylum) of an outmost_pattern (if the type of the pattern variable was set earlier, in an earlier pattern. We now can use 'parameterized patterns' by writing something like: MyReturnType myRoutine(attrs $a, myType $st) { Nilattrs() & *: { return Nilids(); } Consattrs(Attr(a_tp = MyType(tp), a_id, tail), tail) & tp = *: { /* code which is executed if the 'tp' subtree in/below MyType * is equal to the 'st' argument given to the routine. * in this code we can 'read' variables a, st, a_tp, tp, a_id */ } Consattrs(*,tail) & *: { /* code which is executed if the 'tp' subtree in/below MyType * is NOT equal to the 'st' argument given to the routine. */ } } Minor cleanup in the (generated) code, to make it easier to port: we now do only something with SIGIOT if it has been defined. added code for SIGABRT, which is only enabled if SIGABRT is defined Changes from V4_4_H to V4_4: (1997/05/13) Minor cleanup in the generated code, mostly for the fprintdot functions. Changes from V4_4_G to V4_4_H: (1997/04/28) (internal, not distributed) Important fix: Fixed a very old bug in the pattern compiler that caused problems if we grouped multiple patterns with the same body (using separating comma's), and the patterns were non-left-lineair (ie. the same pattern variable occurred more than once in a pattern). For such patterns the generated code _should_ contain eq_... calls that check for the equality of the subterms that correspond with the non-left-lineair variables, but: this equality test was only generated for the last pattern in the comma-separated group.... fixed problems with 'base_view' (introduced withe the uview type): - in the generated code, it could happen that base_view occured twice in the view enum type - in the kc input checker, it could happen that :base_view was not recognized in the unparse rules. New features: updated the fprintdot code (now includes hashing to find duplicate edges between nodes ) changed fprintdot_ interface: added a whole list of parameters: (void) fprintdot_( FILE *kc_f, /* pointer to output file kc_p, /* phylum */ char *kc_root, /* string printed in for 'root' node */ char *kc_edge_prefix, /* string prefix of edge lables */ char *kc_edge_attributes, /* can contain 'dot' edge attributes */ boolean kc_phy_labels, /* do/don't print node labels */ boolean kc_use_ctxt, /* do/don't use the context when sharing */ boolean kc_prt_head_foot /* call the header/footer fns */ ); Important: the string arguments are not checked for 'funny' characters, so you have to escape them yourself, if you want to use them. - The edge_prefix argument can be used when you want to print multiple trees (dags) in one picture, and still be able to see which edges belong to which dag. - The edge_attributes argument can be used to specify edge attributes (for example, colors, fonts, font sizes etc). - The context usage is important to be able to distinguish multiple edges from the same (shared) 'sub-root' node to its sons. - If prt_head_foot is True, you don't have to call fprintdotheader and fprintdotfooter yourself, so instead of doing (void) fprintdotheader(FILE*); /* to start dot file */ (void) fprintdot_phylum(FILE*, phylum, ...., False); (void) fprintdotfooter(FILE*); /* to end this dot file */ you can now do (void) fprintdot_phylum(FILE*, phylum, ...., True); It only need to be set to False if you want to print multiple trees in one picture. - example of usage: fprintdot_expr( stdout, the_expr, "root node", 0, 0, True, True, True ); Other changes: Cleaned up our 'act' after we got a parse error. We now try to always cleanup the generated intermediate files if we get an error (previously there might remain a .kc.* file behind) added forgotten changes to the changes report for V4_4_E (see below) Changes from V4_4_F to V4_4_G: (1997/03/19) (internal, locally distributed) added very first version of functions that print 'dot'(*) output. can be called as: (void) fprintdotheader(FILE*); /* to start dot file */ (void) fprintdot_phylum(FILE*, phylum); (void) fprintdot_phylum2(FILE*, phylum2); ... (void) fprintdotfooter(FILE*); /* to end this dot file */ NB: This interface will most surely change. (*)dot is a tool that takes an input file that contains a textual description of a graph, (ie. nodes and edges), and draws it (outputs a.o. postscript, gif, ...) Changes from V4_4_E to V4_4_F: (1997/03/05) (internal, not distributed) replaced a variable name in the kc source that clashed with C++ keyword operator Changes from V4_4_C to V4_4_E: (1997/03/05) (internal, not distributed) minor change in the generated C code, to get rid of a (C++) compiler warning fixed a buggy bug which caused kc to allow redefinition of operators (ie: no complaint for: aap: Aap() | Noot( aap mies ); mies: Aap() | Noot( aap mies ); This bug seems to have been present for a very long time... Changes from V4_4_B to V4_4_C: (1997/03/05) (internal, not distributed) We now generate C code that can be compiled by a C++ compiler. Changes from V4_4_A to V4_4_B: (1997/03/05) (internal, not distributed) Experimental adittion: clause that will be executed after the end of the foreach body, in which variables are bound to the remaing elements in the lists: foreach( var1 & var2 ; listtype Cons(a,Cons(b,Nil)), listtype Cons(b,Nil) ){ C Code that will be execute only once, with var1 bound to a, and var2 bound to b } afterforeach(lvar1 & lvar2) { C code in which lvar1 is bound to Cons(b,Nil) and lvar2 bound to Nil } Changes from V4_3_1 to V4_4_A: (1997/02/24) (internal, not distributed) Introced more powerful pattern matching code: we now allow things like: with( exp1, exp2 ) { pattern1 & pattern2 : { C code, but no $0 allowed } ( pattern3, pattern4 ) & pattern5 : { C code, but no $0 allowed } } combined with foreach clauses that loop over several variables at the same time (as long as none of the lists is empty) foreach( var1 & var2 ; listtype exp1, listtype exp2 ) { C code (no $0) } foreach( var1 & var1 ; listtype exp1, listtype exp2 ) { C code (no $0) (only executed if both list elements identical (?)) } foreach( pattern1 & var2 ; listtype exp1, listtype exp2 ) { C code with $0 refering to the root of pattern1 (only executed if pattern1 holds) } foreach( pattern1 & $var2 ; listtype exp1, listtype exp2 ) { pattern3 : { C code with $0 refering to var2 } pattern4 : { C code with $0 refering to var2 } } foreach( pattern1 & $var2 & var3 ; listtype e1, listtype e2, listtype e3 ) { pattern2 & pattern3 & pattern4 : { C code but no $0 allowed } ( pattern5, pattern6 ) & pattern7 : { C code but no $0 allowed } } Changes from V4_3 to V4_3_1: (1996/12/10) Small bugfix in the generated rewrite code (problem introduced in V4_1), to get rk.c to compile, and to not generate dead code :-) Changes from V4_2_1 to V4_3: (1996/12/06) WARNING: ONE INCOMPATIBLE change back to V4_0 behaviour: once again, the print_ functions have only one (phylum) argument. This change undoes the incompatibility introduced with the two-argument print_ functions. We now generate separate fprint_ functions that take two arguments: void fprint_( FILE* f, p ) Other changes: integrated supplied code that gives bettor error messages if bison is used as parser generator. To use this, you need perl in your path. The (Unix, sunos) bison output is part of the distribution, so you don't need bison nor perl to use this, until you decide to change kimwy.y. By default it is enabled. It can be disabled by commenting out a few lines in the Makefile. Changed the syntax for Cexpression: we now no longer allow it to contain a 'bare' comma ','. Comma's are now only allowed if they appear between () or [] inside a Cexpression (or inside a quoted string) (questions: should we also take {} into account?) This change is made because, sometime in the future, we want to use comma-separated lists of Cexpressions. So, not allowed is: a,b,c Allowed is eg.: a(b,c) (a,b,c) Fixed a small font-changes problem in the man page. Changes from V4_2 to V4_2_1: (1996/11/08) Minor bugfix: added a missing prototype to the generated csgiok.c file: int kc_set_csgio_hashtablesize(int kc_i); Changes from V4_1 to V4_2: (1996/10/29) (internal, not distributed) New parser error recovery feature (by default disabled, use very strongly DIScouraged): tried to integrate a parser error recovery feature in the Kimwitu parser. As a side effect, we give now slightly better syntax error messages. The error recovery can be enabled by commenting out two(?) lines in the Makefile to use bison as parser generator, and use the supplied bisonsim.rec parser skeleton. However, take care, because it is not too well integrated, and likely gives core-dumps when the recovery algorithm combines already created abstract syntax trees in unexpected ways (ie. causes an Operator to be called with subtree arguments that have the wrong type (phylum). Changes from V4_0 to V4_1: (1996/10/29) (internal, not distributed) WARNING: TWO (2) INCOMPATIBLE new features that break your existing code!! INCOMPATIBLE new feature: you can now use views in rewrite rules. However, this means that you have to update existing code to keep it working: you have to replace all rewrite_(p) calls by rewrite_' term ';' /* backwards compatibility */ | pattern '->' rwclauses ';' rwclauses: rwclause | rwclause [rwclauses] rwclause : '<' rviews ':' term '>' rviews : rview rviews | /*empty*/ The rviews ars simple identifiers, just like the views in unparse rules. However, the rewrite-views and unparse-views are different name-spaces, ie. an identifier can not be used as both a rewrite-view and an unparse-view. Because of this, the 'view' type (from the unparse views) is 'obsoleted' by the new 'uview' type (to which 'view' is typedef-ed, for backwards compatibility), and 'base_view' is 'obsoleted' by 'base_uview' ('base_view' is an alias for backwards compatibility). The '%view' keyword is 'obsoleted' by the '%uview' keyword. For rewrite-views the new 'rview' C type is introduced, with as default the 'base_rview'. The 'backwards compatible' variant of the rwrule is equivalent with both the following new-style forms: rwrule : pattern '->' term ';' rwrule : pattern '->' '<' ':' term '>' ';' rwrule : pattern '->' '<' 'base_rview' ':' term '>' ';' For debugging the generated rk.v file contains a char* arrary kc_rview_names that can be indexed with an rview, such that kc_rview_names[my_view_name] === "my_view_name" This leads to the INCOMPATIBILITY that the rewrite_ functions now have a second parameterm the 'rview': rewrite_( p, rview v ); INCOMPATIBLE new feature: added a file argument to the print_ routines, as first parameter: void print_( FILE* f, p ); For debugging purposes, if f == 0 output is printed to standard output. However, this means that you have to update existing code to keep it working: you have to replace all print_(p) calls by print_ in the generated k.h file (because it uses FILE* in declarations - rearranged the UNIQMALLOCINIT and friends macros - added BUCKETMALLOCINIT and friends macros - added a number of #line statements in with and foreach statements - added checks in the rewrite code to avoid creating a new term when nothing was changed. - fixed the code that checks for literal ints and floats - changed the kc_ht_create and kc_ht_create_simple routines to call the new kc_ht_create_bucket_management routine (with some default args) Changes from V3_6 to V3_7: (1992/11/10) INCOMPATIBLE CHANGE: - changed the syntax of the foreach-pattern-statement; it is now foreach( pattern; listphylum expression ) { C-text } ie we removed the '/' before the pattern, and we now interpret a pattern that contains only an outermost variable as a variable, and we warn if that variable is an operator (ie, if someone tried to use the 'degenerate' pattern syntax) New Feature: - added support for `float' atomic phylum - added 'out of memory callbacks (kc_set_out_of_storage_handler) Other changes: - fixed the code that handles outermost non-leaf variables (like a = pattern) in patterns, esp. in rewrite rules - changed the hashfunctions (should reduce number of collisions) - fixed the kc_print_all_hashtable_statistics routine - added a warning for the foreach-statement foreach( id; listphylum expression ) { C-text } to warn when `id' is the name of an operator (see above) - fixed the `return (function-return-type)0;' code that is printed in the `no-default-in-with' case in with-statements in non-void functions: this code should now only be printed if we know that `(function-return-type)0' is a valid expression (ie. not a struct nor a union or an unknown typedef) - fiddled with memset in order to shutup lint - we now include k.h (guarded!) in the other generated include files to protect careless users - fixed a problem in generated code when a pair of { } was missing (in the code generated for the 'default' cases in rewrite rules, unparse rules or with-statement) - csgio routines should now in all error cases return with an error string (there were cases where they would simply abort) - fixed an obscure bug that caused problems if nullary or binary operators do only occur as list operators - removed a couple of annoying asserts in kc that were not really necessary (error messages had already been reported before the asserts were reached) - added a -DUSE_STAT flag in the kc Makefile (to disable the use of fstat) in kc itself (fstat is not used in the generated code) - we no longer include memory.h in main.k because of problems with non-ansi versions of it. Gimmick: - added a version string for Sun Unbundled `version' program ;-) Changes from V3_5 to V3_6: (1992/07/10) INCOMPATIBLE CHANGES: - we now use the kc_malloc_t type only to interface to the library malloc routines. All kc malloc routines now use (kc_voidptr_t, a typedef to) void*. This is only a problem, and even then not a serious one, for those that defined their own malloc routines for use by kc-generated code, via the (NON)UNIQMALLOC macros. - we now generate function prototypes in all generated files. These prototypes are automatically used if the C-compiler defines the symbol __STDC__ or _cplusplus. In the k.[ch] files we need the ANSI-C elipsis notation (...) for the create-function prototype in the KC_OPERATOR_INFO. Old(er) versions of gcc (eg. 1.37.1) can not handle this. If this happens with your gcc, either get a newer version, try to use your `domestic' cc, or try the gcc -traditional flag. Best of above solutions is to get a new version of gcc, anyways. BACKWARDS COMPATIBLE CHANGE: - the include keywords now have/expect a KC_ prefix instead of KIMW_ Use of KIMW_ will cause a warning, but still works as expected. Other changes: - added a check to make sure that we always can infer the type of a pattern-expression from its pattern(s). If not an error is reported. - fixed the type checking of pattern variables: it now also works ok with nested with-expressions. - we now generated function prototypes in the generated .[ch] files. a warning (not an error) is given when it was not possible to find the type of a formal parameter of a function. - we now use the (ANSI-C) rename and remove routines if possible, instead of link/unlink. - it is now possible to use fstat in the different routine in main.k, to first check if the file-size differ, before actually comparing the files. - added a KC_CSGIO_NO_SHARING define in k.c, that can be used to turn off the use of node-sharing features by the CSGIOwrite routines. - all void* types have been replaced by kc_voidptr_t, for easy port to machines where void* type is not available - we now no longer need -ll to compile kc itself (as long as we don't define LEXDEBUG) - new lint rule (and macro) in the kc Makefile Changes from V3_4 to V3_5: (1992/06/25) - long strings in uparse rules may be mapped onto more than one printer call, to avoid problems with the string length in the generated code. Strings in C code are (again) simply copied into generated files. - for strings in the unparse rules that contain embedded new-line characters, in the generated strings the (escaped) new-line character (\n) is at the start of the `next' line, instead of at the end of the `current' line. The result is that it is save to write (| indicates the `left margin'): |Operator(*) -> [: |"#ifndef foo |# define foo |#endif foo |" ]; The above will be translated into something like: | (*kc_printer)( "#ifndef foo\ |\n#ifndef foo\ |\n# define foo\ |\n#endif foo\ |\n", kc_current_view ); - many minor changes to clean up the code (and silence lint), ie. - removed a number of unused variables (and generated labels) - many local functions/variables are now declared `static' - we now #include in case of an Ansi-C compiler - added a few declarations of non-Ansi, Unix standard library routines (like read, link, unlink, close etc.) - as a consequence of the previous changes, it should now be easy to compile kc with Sun bundled cc. - fixed a bug that caused the generation of zero-element array definitions (like `YYSTYPE kc_subtemp[0];') when all operators are nullary. - fixed the node-sharing in the csgio routines (introduced in V3_4) - changed the strings sharing in the csgio routines. - we now generate only one enum type for all prod_sel's, this may be useful during debugging, as the debugger may now display the enum-name instead of its int value in almost all cases. - quoted literal double-quotes ( '"' changed into '\"' ) in the yacc input, because not all yacc's treat them correctly (watch for sun's yacc) - the generated *.h files can now (again?) be #included by C++, as in extern "C" { #define KC__P(X) X /* to switch on the prototypes */ #include "k.h" #include "any.h" /* generated from `any.k' */ #include "csgiok.h" #include "unpk.h" } However, it is advised to *not* switch on the prototypes while compiling the normal .c files, because it will only result in a complaining ansi-C compiler, probably because the *.c files still use the `old' C function declaration style. Changes from V3_3 to V3_4: (1992/06/01) INCOMPATIBLE CHANGE: - added sorting of the operator map, string and node sharing to the CSGIO routines. The programmers interface has not changed, but structure files with node sharing cannot be read by the `old' CSGIOread routines. Regeneration of the code (= rerun kc), and recompilation should be sufficient to update existing programs. Strings are shared always, nodes are only shared if they are shared (= have the same pointer) in the program that calls CSGIOwrite. Other changes: - fixed a small bug that caused kc to crash after reporting some errors for erroneous input. - minor cleanup to shut up lint. Changes from V3_2 to V3_3: (1992/05/25) (internal, not distributed) - added patchlvl.h file to the sources - we now allow multiple include redirect keywords to follow a %{ - added new hashtable routines, combined with multiple `uniq' storage classes See separate file for the`programmers interface to hash routines'. - added %storageclass declaration %storageclasse uniq1[,] uniq2[,] ... uniqn; - a special comment /*EMPTY*/ is recognized and passed on to the generated C files. The use of /*EMPTY*/ in empty unparse rules/patterns helps to shut up CodeCenter (Saber-C) - minor cleanup of the generated code, to avoid unnessary lint complaints. - added code to suppress kc-caused 'function has return(e); and return;' complaints by lint. if such a comment appears the problem should be in the user code. Changes from V3_1 to V3_2: (1992/02/14) - Fixed a bug in the kc_ci_strcmp routine that is used as cases insensitive strcmp. The bug caused this routine to always return the value 0. Changes from V3_0 to V3_1: (1992/02/12) - Fixed a bug in the generated csgiok.c code, that caused the CSGIOwrite routines to return a non-null result even if no error occured. Changes from V2_8 to V3_0: (1992/02/07) INCOMPATIBLE CHANGES: - the copyk.[ch] files are no longer generated; the copy functions are encorporated in the k.[ch] files. A simple `rm -f copyk.[ch]; touch copyk.c copyk.h' will make most old Makefile's work without changes. - the return type of emalloc (MALLOC) & friends (and argument type of erealloc) is now kc_malloc_t (mapped to char* by default) (in preparation of ANSI-C) - the type of the size argument of emalloc (MALLOC) & friends is now kc_size_t (mapped to unsigned by default) (in preparation of ANSI-C) - (support for) `integer' phylum removed - the KC_FIELD macro no longer exists (at least in the V3_0 version) Other changes: - most code completely rewritten - introduced new superflous (pattern) variables in the source code :-) - shorter file names to be MS DOS compatible. - most generated functions are now table driven, polymorpheus. they are to be called via the `traditional' function names, to allow error checking with lint, and avoid problems with casts. - the pattern matching code has been completely rewriteen - the switch-cases and the with-cases have been combined; dollar variable in a with-clause now refer to subterms of the `enclosing' pattern. - combination of for- and with- clauses (as in the function- definitions with a $ in the argument-list. for ( $ ; ) { } - new syntax for use of the for-clause as a filter: for ( / ; ) { } - multiple patterns can be grouped with the same rewrite-rule right-hand-side, unparse rule or Ctext; the only limitation is that the variables in the the patterns should be of the same type. example: , -> ; , -> [: ]; , : { } /* in with-case */ - the same pattern-syntax can be used in all patterns - new pattern items: /* as _outermost_ pattern, as in switch-cases in kc before V3_0 */ '=' /* to introduce non-leaf variables */ /* to put in a literal int, eg 684 */ /* to put in a literal "quoted string" */ the can be put for a casestring or a nocasestring, the interpretation will be done based on the context. - it is now possible to declare the views that are being used, one or more %view , , ... , ; statements. The % should be the first character of the line. If the Kimwitu input contains one or more %view declarations, then errors will be given for all views that are used but not declared. Typing errors in view names will be caught in this way. For backwards compatibility Kimwitu input does not _have_ to contain a %view declaration. - grouping of unparse-items is now possible, using ${ and $} as `special unparse-items' which are replaced by resp { and } in the generated code, in eg. Pattern() -> [: { if ( ) } ${ $} { else } ${ $} ]; NOTE: it was already possible to write the above example with ${ and $} in the included C code, as: Pattern() -> [: { if ( ) ${ } { $} else ${ } { $} } ]; but the new syntax makes it more useful to look for matching brackets in an editor (eg using the % command in vi) - it is now possible to unparse an attribute of an attribute (of ... ) using (as expected) patternvariable -> a -> b ... Changes from V2_6 to V2_8: (1991/08/27) INCOMPATIBLE CHANGES: - changed initialization routines to allow replacement of a term by another one at initialization time, simply by assigning to the $0 variable in the initialization code NOTE: it is no longer allowed to put a plain `return;' in initialization code; such a `return;' should be replaced by `return $0;' - changed the unparsing syntax for souble-quoted (") strings: strings are now allowed to span multiple lines, the line-breaks in such a string do also appear in the generated code (they are replaced by a \n\ in the generated code) Other Changes: - reorganized parts of the code for easier compilation - removed superflous pattern variables in the source code - added (type checking) checks for the user defined unparsing rules - changed unparsing syntax: it is now possible to put casted variables in the unparse rules, to unparse phyla that are stored in (attibutes of) variables for which kimwitu does not know the type (eg. global variables, or variables that are introduced in the Ctext in an unparse rule). eg. the following unparse rule (not useful, but anyway:) Example(x, y) -> [: { phylum z; z = x; } (phylum)z ]; first instroduces a new (local) variable `z' of phylum `phylum' that is unparsed Syntax: '(' ')' or '(' ')' ':' This will result in a call: unparse_( , kc_printer, kc_current_view ) or unparse_( , kc_printer, ) The gen.k sources of kc contain numerous examples of this. - changed the definition of the KC_FIELD macro, to make gcc `eat' the generated code - added (redefinable) macro INTHASH, that defines the hash function to be used for ints - added (redefinable) macro KC_BUCKET_INC, that defines the size of the increments in the hasbucketsize Version V2_7 was an `internal' version, for which no changes are given here. Changes from V2_5 to V2_6: (1991/02/13) - replaced the assert_( var ) macros by assert_( var, char *varstring ) macros that give better error messages - fixed the problem with the negative milli-seconds in the kc_time_statistics macros - added a `HEADER' keyword for included stuff Changes from V2_4 to V2_5: (1991/01/18) - each input file is now parsed separately, to allow better error messages for for example missing close brackets - added a new pair of output files: copyk.[ch] - added copy_ functions in (new filenames) copyk.[ch] - we no longer remove all the generated files when an error was found in an input file of Kimwitu - minor clean-up in the generated code, to reduce lint error messages - fixed the include mechanism for inclusion in the rewrite (rk.[ch]) files - added the foreach-statement - we now allow dollar variables in the intialisation code and in the arument of the with- and the foreach statement, and in the unparse rules - added a few checks on the use of dollar-variables - added/fixed the code that collects time statistics on a sun[34] enable this code by adding -DKC_TIME_STATISTICS, use the calls void kc_print_time_statistics( FILE *); and void kc_reset_time_statistics(); (actually: they are macros) - you should now use -DKC_OPERATOR_STATISTICS to be able to use void kc_print_operator_statistics(/ FILE *) - introduced new names for the structs and unions - speeded up the kc_ci_strcmp function - added a malloc_uniq function, to malloc stuff that will never be freed - introduced UNIQ{MALLOC,FREE} and NONUNIQ{MALLOC,FREE} macros, to make it easier to use your own malloc package. We now use MALLOC,REALLOC,FREE for the internal bookkeeping, UNIQ{MALLOC,FREE} for the tree/term nodes that will never be freed, and NONUNIQ{MALLOC,FREE} for the tree/term nodes that can be freed. - introduced freelist_ functions, that free list nodes, but not the elements of the list - replaced the recursive length_ function by an iterative one - added a file argument to the kc_print{time,hash,operator}_statistics - speeded up the assert macros: now they only call kc_assert if the assertion fails - fixed the generated pattern matching code: the pattern testing code for the with-clause and the unparsing rules should now be generated in the correct order - we now allow ${ and %} to escape { and } in C-texts - we now define the Kiwitu internal scanner buffer size to be BUFSIZ (it was smaller on HP's) - ?????????????? Changes from V2_3/V2_2 to V2_4: (1990/10/29) - introduced phylum/operator maps that hold info about the phyla/operators - added code to collect statistics about the operator usage. enable this code by adding -DKC_STATISTICS to the cc flags during compilation of the generated code. The statistics can be printed using void kc_print_operator_statistics(/*void*/) - added assert_ macro definitions & calls. Those macros test whether their argument != NULL & has a prod_sel in the range of using assert. They appear in the generated function code direct at the start of each function - speeded up the csgio reading code - fixed reading/writing of unprintable characters in CSGIO format. - fixed strategy for finding unparse_view/pattern combination - added code such that kimwitu detects write errors, eg. because the file system is full V2_2 and V2_3 are almost identical. No changes mentionable. Changes from V2_1 to V2_2/V2_3: (1990/09/19) - reduced the number of strings appearing in the generated code - added unparsing code - added special comments before and after each generated routine, such that it can be removed easily using eg. sed Changes from L4Mar90Plus to V2_1: (1990/08/30) - updated everything to conform to the manual, eg. new interface for CSGIO functions, removed kc_init() routine, only generate new files if they differ from the old ones, allow expressions instead of variables in the with-expression, allow extension of phyla with new operators, attrtibutes or initialization - changed HASH routines