CIT 597 Regular Expressions in Perl
Fall 2008, David Matuszek

Purposes of this assignment:

General idea of the assignment:

Write, in Perl, a syntax colorer for Java programs. Embed the result in an XHTML 1.1 page, and provide CSS for it.

Some details:

Your program should accept input from STDIN and produce its results on STDOUT.

The input will be a Java file. The output will be an XHTML 1.1 file, with the marked-up Java file in its <body>. (This is so that we can easily examine your results in a browser.)

The output should default to using a monospace font. Whitespace should be preserved.

You should provide syntax "coloring" for: keywords, comments, and literals. Literals include quoted strings, character literals, and numbers. The word "coloring" is quoted because it may include other display characteristics, such as boldface or underlining.

The actual colors or other style information should be provided in a separate CSS file, which is used by your XHTML file.

You should be able to process any syntactically correct Java file, and produce correct output.

Here are some complexities you need to deal with:

It is possible in Perl to step through strings a character at a time, and process them much the same way as you would do in C. This isn't the Perl way! You may do a small amount of character-at-a-time manipulation, if it turns out to be necessary (I don't think it will), but the majority of your string manipulation should be done with regular expressions.

Advice

Due date:

Midnight, Friday October 17. Zip up your complete project directory and submit via Blackboard.