make
There is an alternate version that is slightly deobfuscated. See alternate code below.
./zeitak < file
where file
is the file to be checked for nesting errors. For example, you may
try incorrect.c and the program itself. You may also run it on
text files that are not code.
make test
NOTE: the program prints an error and exits on the first nesting error so it will not detect multiple issues.
The alternate code, zeitak.alt.c, is a version that was slightly deobfuscated by the author. You may find reading it helpful in your attempt to understand this extremely subtle entry.
make alt
Use zeitak.alt
as you would zeitak
above.
This is an extremely subtle and twisted piece of Gold award winning code!
The judges spent a considerable amount of time analyzing this entry. At one point we spent 18 minutes just to understand 18 key characters of this code.
NOTE: if you use vim to view the code, make sure to do:
:set tabstop=4
in command mode, before looking at the code, to see the correct layout.
As you have probably understood by looking at the source*, this program has
something to do with parenthesis (and equality of opening and closing
parenthesis, if you look close enough). It goes over the file given to it and
checks that every opening (
, [
, or {
has a matching closing one and
vice versa. It also checks that every "
or '
is closed.
If an error is detected, an error message will be printed. If the problem is a superfluous closing bracket, it will even print a few characters around it’s position.
* Make sure you view the source with 4 spaces tab width.
(")"); printf
\"
) are ignored, so the following line will produce
an error:("\""); printf
IOCCC entries already contain entries without digits, control-flow keywords and certain operators in their source. This entry has an even more limited source, that is:
stdio
.?:
operator).So, what’s left? Parenthesis, and lots of them, as looking at the source will reveal immediately. The main obfuscation is building the whole algorithm using only function calls, typecasts, array lookups and pointer operators.
The program requires char
to be one byte and pointers to be
at least two bytes long.
The program was tested on the following platforms: