System Programming

Course ID
B.Sc. CS (Hons.)
Paper Type
DSE - 1
Lecture & Practical

Unique Paper Code: 32347501

The course is focused on design of assembler and basic compiler. The course covers topics like absolute loader, relocating loader and dynamic linking.

Learning Outcomes:

At the end of the course, students should be able to:

  • Describe the working of assemblers and compilers
  • Use Lex/ Yacc for building basic compiler.
  • Develop a two pass Assemblers.
  • Describe the role of the loaders, linkers and relocatable programs.

Course Contents

Unit 1
Unit 2
Unit 3
Unit 4
Unit 5

Unit 1

Assemblers & Loaders, Linkers: One pass and two pass assembler, design of an assembler, Absolute loader, relocation and linking concepts, relocating loader and Dynamic Linking.

Unit 2

Introduction: Overview of compilation, Phases of a compiler.

Unit 3

Lexical Analysis: Role of a Lexical analyzer, Specification and recognition of tokens, Symbol table, lexical Analyzer Generator.

Unit 4

Parsing & Intermediate representations: Bottom up parsing- LR parser, yacc,three address code generation, syntax directed translation, translation of types, control statements.

Unit 5

Storage organization & Code generation: Activation records, stack allocation, Object code generation.


Lab List 1

Programs to get familiar with Lex and Yacc

  1. Write a Lex program to count the number of lines and characters in the input file.
  2. Write a Lex program that implements the Caesar cipher: it replaces every letter with the one three letters after in in alphabetical order, wrapping around at Z. e.g. a is replaced by d, b by e, and so on z by c.
  3. Write a Lex program that finds the longest word (defined as a contiguous string of upper and lower case letters) in the input.
  4. Write a Lex program that distinguishes keywords, integers, floats, identifiers, operators, and comments in any simple programming language:
  5. Write a Lex program to count the number of identifiers in a C file
  6. Write a Lex program to count the number of words, characters, blank spaces and lines in a C file
  7. Write a Lex specification program that generates a C program which takes a string “abcd” and prints the following output

  8. A program in Lex to recognize a valid arithmetic expression
  9. Write a YACC program to find the validity of a given expression (for operators + – * and /)A program in YACC which recognizes a valid variable which starts with letter followed by a digit. The letter should be in lowercase only
  10. A Program in YACC to evaluate an expression (simple calculator program for addition and subtraction, multiplication, division)

Lab List 2

  1. Program in YACC to recognize the string „abbb‟, „ab‟ „a‟ of the langauge (an b n , n>=1).
  2. Program in YACC to recognize the language (an b , n>=10). (output to say input is valid or not)

Additional Information

Text Books

Aho, A., Lam, M., Sethi, R., & Ullman, J. D. (2006). Compilers: Principles, Techniques, and Tools. 2nd edition. Addison Wesley
Chattopadhyaya, S. (2011). System Software. P H I Learning

Additional Resources

Beck, L. & Manjula, D. (1996). System Software: An Introduction to System Programming. 3rd edition. Pearson Education
Dhamdhere, D. M. (2015). Systems Programming. Tata McGrawHill

Teaching Learning Process

Use of ICT tools in conjunction with traditional class room teaching methods
Interactive sessions
Class discussions

Assessment Methods

Written tests, assignments, quizzes, presentations as announced by the instructor in the class


Compilers, lexical analyzer, syntax directed translation, assembler, loader, linker

Disclaimer: Details on this page are subject to change as per University of Delhi guidelines. For latest update in this regard please refer to the University of Delhi website here.