The officially recommended environment for this course is Linux as provided by the Johnson 118 lab. Mac OS is also supported, but in order to use this environment make sure that you install the developer tools (both Xcode and the command line tools). Any other Unix environment should work as long as it provides GCC, GNU make, Flex, and Bison.
I have limited knowledge of Windows, but I have had reports that it is relatively easy to set up a suitable environment under Windows using Cygwin. The installation process is a bit arcane when it comes to dependencies, but contact me and I should be able to offer some advice on the matter.
The handouts will contain references of ``the manual page'' of some function or data structure. These manual pages can be obtained in any Unix-like environment (including Linux and Mac OS) using the command man. For example, to obtain the manual page of the function strtod open a terminal and type
man strtodIn some cases you may obtain the wrong manual page. For example, typing
man printfwill give you the manual page of the command printf rather than the documentation of the C function with the same name. That is because the manual pages are organized into sections, with Section 1 containing commands while most of the C functions that you will be using are in Section 3 (though some may be in Section 2). When the man command does not specify explicitly a section, the manual page of the first occurrence of the argument (starting with Section 1) will be displayed. In such cases an explicit section number can be specified as first argument. For example, the following command will reach the manual page of the C function printf (which resides in Section 3):
man 3 printf
For more details see the...manual page of man by typing in the following command:
man man
The Flex manual is normally maintained using GNU info rather than a manual page. This documentation can be obtained locally by typing in the following command in a terminal on a Linux system:
info flexAlternatively, check out the on-line flex manual.
Flex is not exactly user friendly. If you put a space or newline in the wrong place, it will often just print ``syntax error'' with no line number or hint of what the true problem is. It may take some incursions into the manual, a little experimentation, and some patience to learn its shortcomings. Here are a few suggestions to help keep you sane:
The following brief introduction to Bison from Stanford should be more than enough to complete this assignment. If more information is needed then you should take a look at the official GNU Bison manual.
Also see the manual page of make.
For this course any reasonably recent C/C++ complier will do, including GCC and also LLVM (which is the preferred compiler in Mac OS) which could be used as a drop-in replacement as long as the compiler is called using the GNU name (gcc, g++, etc.). All the makefiles provided should work with both GCC and LLVM but may need changes to work with other compilers.