Laboratory Assignments of System Software
The first of the following assignments is meant to make the students capable
of processing a text file for a given objective. The remaining exercises
excluding the last two, have a kind of continuity, in the sense that some
portion of program written for one is to be used in one or more subsequent
exercises. For these assignments, the students may consider any assembly
language, real or hypothetical.
- Write a C program that reads an input text file and print each word in
a single line on the terminal. All sequences of alphanumeric characters and
underscore characters are to be treated as individual words. All other
symbols except white space and newline are individual words.
- Write a C program that contains a lexical analyser function which
returns a distinct numeric value corresponding to the various tokens it
recognises in an input assembly language program. Your program should use
this function in a way that the output is a sequence of the tokens (the
numbers) printed on the terminal.
- Write a C program that reads an input assembly program and produces a
Symbol table, Literal table, and an intermediate code. Use the lexical
analyser function created in the earlier exercise.
- For the earlier program that creates the symbol table, literal table and
intermediate code corresponsing to an input assembly program, write the
lexcial analyser using flex.
- Extend the earlier program into a complete 2-pass assembler.
- Implement a simple macro-preprocessor, i.e., a program that reads an
input assembly program containing macro definitions and macro calls and
produces as output the program where there are no macro definitions and the
macro calls are replaced by the corresponding macro bodies.
- Familiarization of linking and loading related commands in UNIX.
- Use of make, rcs, sed, grep, awk.