IOI Compiling Environment Rob Kolstad, Ph.D. USA Team Leader [Postscript added at end by Tom Verhoeff, 13-Oct-1999] The Problem Current C/C++ and Pascal compilers have limited memory models and some other limitations that are discouraging their use for programming more general than contest problems. Thus, students are less satisfied with them. The compilers also do not enable use of programming problems that require use of larger amounts of memory, thus removing a rich set of problems from the programming contest environment. Furthermore, some students are now much more attracted to operating systems like Linux. These systems often exhibit better behavior when running erroneous programs. The marketplace has other, better compilers, most of which are dramatically more expensive and thus undesirable for our widespread audience. Updates alone can be a large expense for a country with thousands of classrooms. Summary of Summer Meeting In July of 1999, IOI representatives from China, England, Finland, Holland, Portugal, and USA met in Enschede, Holland for a three day meeting on "Renewal of the IOI. Most recommendations will be presented separately. At that time, certain compilers were quickly converging on stability but no report could be generated until that convergence occurred. I volunteered to write this report to summarize the state of the art of certain free compilers and make recommendations to the IOI at our meetings here in Turkey Current Status Evaluation was performed by Russ Cox, IOI Gold Medal winner, USACO automated grading expert, and 1999 ACM finalist in Eindhoven, Holland for Harvard U. also has expertise in various compiler technologies Russ evaluated the two leading candidates (generally considered to be far ahead of other contenders). His evaluation criteria were: * The "look and feel" of the IDE (compared to current Borland compilers as used at IOI) * The acceptability of the compiler for a task evaluation environment Russ examined two compilers: * DJGPP, the DOS version of the widely used GNU C/C++ compiler, now has a complementary IDE known as RHIDE. Find the combination at http://www.delorie.com/djgpp/ . * Free Pascal, the current pascal compiler leader in the free source world, can be found at http://tfdec1.fys.kuleuven.ac.be/~michael/fpc/ . Both compiler/ide sets weigh in at about 10MB distribution size. DJGPP balloons to 20MB when installed, while Free Pascal uses about 7MB. DJGPP The GNU C/C++ compilers are used to generate the majority of C object files created in the world today; they are arguably solid as a rock. They differ from the Borland compilers in that certain include files have different names (or are missing); this is not regarded as having any consequence. The RHIDE companion IDE for C/C++ is a virtually perfect clone of the Borland Pascal(!) IDE. It is however, missing a few keyboard shortcuts and a small number of menu options; it is believed these are currently being implemented. Free Pascal The Free Pascal compiler is now able to compile and run programs like those of the contests. Russ ran our previous contest's 60 Pascal programs through the new compiler and was able to duplicate the results of the Borland compiler (though some erroneous programs produced different erroneous results). This is encouraging. Free Pascal comes with its own (apparently nameless) IDE, which is still in its fledgling stages. Editing and interactive compiling work fine. Interactive debugging support is not yet implemented. Stepping, breakpoints, and so on do not work. Work continues daily. There is another IDE for Free Pascal, called FPEdit, which seems to have stopped development in 1997. It is little more than a text editor with an option to compile and does not do a good job of emulating the Borland look and feel. An interesting difference between the Free Pascal compiler and the Borland compiler is that (at least in the default installation mode) the Free Pascal compiler does not allow arbitrary text after the ``end.'' line that ends the program, while Borland does. This caused the free compiler to reject some Pascal programs that Borland had accepted. However, this hasn't been a problem for C programmers, so it shouldn't be too bad to cure the Pascal programmers of it. When compiling, the Pascal compiler did not accept some programs which appeared valid. Turning on the ``emulate Borland Pascal as much as possible'' switch fixed this. The empty file appears to be a valid Borland program but not a valid Free Pascal program. Free Pascal apparently numbers lines starting at zero. It would appear that OO Borland Pascal does not require redeclaration of the procedure parameters of a function whose prototype has been declared, i.e., this is valid: type myclass = object procedure init(x : integer); end; procedure myclass.init; begin writeln('hello world'); end; In Free Pascal, the procedure parameters must be redeclared at the point where the procedure is defined: type myclass = object procedure init(x : integer); end; procedure myclass.init(x : integer); begin writeln('hello world'); end; This is better style anyway, and not many Pascal users use OOP. As far as automated compiling and grading goes, both free compilers are usable. As far as the IDE goes, DJGPP+RHIDE is usable, while the Free Pascal IDE has some work left to be done. Mixed OS Environments These compilers and IDEs run under both Windows and Linux, a free UNIX clone gaining popularity worldwide. Linux enables easily automatable, quite efficient, and very speedy grading and tabulation systems to be implemented. My Recommendation I believe we should monitor compilers' and IDEs' progress to ensure progress is made on correcting the deficiencies. I recommend that the GA should anticipate switching the "IOI Competitive Environment" to new, free compilers starting Fall, 2000, pending completion of the Free Pascal IDE. Postscript: * At IOI'99 it was pointed out that Free Pascal also works with RHIDE, including debugging. * The new web site for Free Pascaal is: http://www.freepascal.org/