Your task in this assignment will be to write a Perl script that does simplified MACRO PREPROCESSING like the C compiler does.
An input file will look something like this:
MACROS #define student hard working intellectual #define job high-paying career #define PI 3.1415926 PROGRAM Here a student making a data file can have any text ... Macro declarations come first, program text after. The job of the macro procesor will be to find the target strings whenever they appear and replace them with the rest of the line that follows the target string in the corresponding macro definition public class fooBar { // the job of this class is... // public static int pi = PI; void getPi ( ) { return pi; } }
The output file will the test after "PROGRAM" line with all the proper macro substitutions done.
#define "some target string" the replacement part follows to EOL
$define bday/i date of birth
You should go to ActivePerl for Windows and Unix implementations of Perl. Download the binaries and follow the installation instructions.
The department has Perl installed on our Unix compute servers (eagle, capefear). It is located at "/usr/local/bib/perl" and you can that one if you have an account.
You can develop your programs with any Perl you have, but you must make sure it runs correctly under ActivePerl on a PC, or under the Unix Perl.
This assignment is due Feb. 9 (by class time). Late assignments get 25% off each day they are late. Your submission will be electronic. Your electronic submission will be an e-mail sent to wluebke@cs.unc.edu with the subject
COMP 144 Assignment 3 Submission
and a single .zip file attached to it. This file should have the following content:
I will grade both the quality of the source code (design and documentation) and the output. I will not grade programs that do not compile. Collaboration is encouraged, but you cannot share source code. Honor Code applies to this program. Please, read http://www.cs.unc.edu/Admin/Courses/HonorCode.html for more details.