CS 1MD3 T2 2003
Bonus Assignment #4
- Due: Tuesday Apr 8th, midnight, by email
- The references for
javap,
the JVM (and more downloadable from
the Java documenation page) will come in quite handy.
- Write, in C a version of javap. In other words,
your program should read in a (binary) Java .class file (given as
a file name on the command line) and print the 'decompilation' of
the class file as output.
- The only things to mimic are javap called with only a class
file as input, or with the -c option.
- Deliverables:
- The C program, and test files that are known to work.
- This assignment will be worth a sliding amount depending
on the functionality provided.
- This assignment is very difficult if you try to "just code it".
However, if you think it through and use (many) of the data-structures
from class, including a finite-state machine or two, as well as
table-based dispatch, this is not so bad. It can be done in
around 300 lines of actual code and maybe 200 lines of data
definitions (op-codes, keywords, etc). To be precise: use a
finite state machine with an auxilliary stack, where you use
the stack to store state transitions. Use (lots) of data tables.
- Very complicated and/or very long solutions will be worth
much fewer points than a thought-through concise solution.
Back to main page