The task is to extend the C or C++ language by writing a preprocessor. The preprocessor need only be a program that reads the extended source file, makes textual changes, and saves the resulting C or C++ source file.
Beginners
---------
Extend either C or C++ to use a Pascal style for loop. The grammer is:
For example, a loop to count from 1 to 10 would be written in the extended language as:Code:for identifier := i (to|downto) n
statement
And to count down from 10 to 1:Code:for i := 1 to 10 {
printf("%d\n", i);
}
IntermediateCode:for i := 10 downto 1 {
printf("%d\n", i);
}
------------
Extend either C or C++ to perform run-time boundary checking on arrays. If a subscript would cause the array access to go out of bounds, the program should terminate with an appropriate error message. The check must be performed before the array is accessed, otherwise undefined behavior would make this extension useless.
Advanced
---------
This task is for C only. Write an extension that gives C a built in string type. The following operators are required for the C string type:
==, !=, <, >, <=, >=
C strings must be able to grow dynamically. The null character has no special meaning in a C string. Strings may use the subscript operator to obtain and modify a specific character. If the subscript is out of range then the string will grow to meet the demand. Negative subscripts will walk backward from the end of the string.
Entries will be judged on how complete and robust the extension is. Sign-up for the contest will last one month. When all entries that have signed-up are complete, the entries will be judged. Entries that have not signed-up will be accepted provided they are submitted before all signed-up entries.