| CS286 -- Lab 1: Prerequisite Assessment |
|
|
PurposeThe purpose of this lab assignment is to review concepts from previous courses. This is accomplished through designing and implementing a C++ program to convert C++ source code into an XML formatted document. AssignmentYou should write a C++ program that will convert one or more C++ source files into XML elements that, when added to a report submission, will format the C++ source code in the same manner as MSVC++'s editor does. Your program should accept one or more filenames from the command line prompt and send the results to standard console output. In particular,
Here is a list of all the C++ keywords: __multiple_inheritance, __single_inheritance, __virtual_inheritance, asm, auto, bad_cast, bad_typeid, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, extern, false, float, for, friend, goto, if, inline, int, long, namespace, new, operator, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, type_info, typedef, typeid, union, unsigned, using, virtual, void, volatile, while, xalloc. Here is a list of all the C++ preprocessor directives: define, elif, else, endif, error, if, ifdef, ifndef, line, include, pragma, undef, warning. An example of the program usage is given below. Click on the source files to see what the input looks like and on the XML file to see what the output should look like. C:\>programName enterInt.h main.cpp enterInt.cpp > lab1.xml Programming consideration: Please note that this is not as simple as it make appear at first glance. Be sure to dedicate an adequate portion of time to understanding the requirements. It may be particularly helpful to study the example file carefully. Also, students in the past have forgotten that the + and - operators are not defined for the bidirectional itererator. You will need to use increment and decrement operators instead. Your design must include at least one user defined abstract data type. Program ExtrasIt should be clear that the rule that I have given for the conversion of tab characters is too simplistic. While not required, you may wish to improve your program so that it handles tabs correctly. You may wish to allow the user to enter a project filename and have your program generate the code subsections for all of the source files in the project. If you choose to do this, you should not remove the ability to specify a list of source files. This could be done by adding a command line option. For example: C:\>programName -project projectName > lab1.xml The -project flag signifies to your program that a project file has been entered instead of a list of source files. Your program will then need to read the project file(s) to find the list of source files. Hint: take a look at the *.dsp file. Lab report (due 11:00pm, the day prior to week 3 lab)The lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:
As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic Submission Guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well. If you have any questions, consult the instructor. |
| © 2001 Dr. Christopher C. Taylor | Office: CC-27C | Phone: 277-7339 | Last Updated: March 28, 2001 |
| I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to. | |||