You are on page 1of 2

Compiler lab Project FA09-BS (CS) Section (A, B, C) Instructors: Mr. Sajid Anwer, Mr.

Atta Ur Rehman Shah


You have to develop all the six phases of compiler for the following language. The language for the development of compiler is your own choose either C or Java.

1. Identifiers in C (variable, function, array names).


Identifiers names are combinations of letters (a-z A-Z) ,digits(0-9) and underscore. And first character cannot be digit.

2. Float, digit and character literals in C 3. Spaces, tab ,newline and semicolon in C

4. Single and multiline comments in C


Single line: // some code Multiline: /* */

5. If ELSE in Pascal.
Default syntax if <condition> then <command> else <command> Example IF b=0 THEN write ('You cannot do divisions by 0!') ELSE BEGIN write (a div b); readln; END; end.

6. For loop and while in Python.


Default syntax for iterating_var in sequence:

statements(s) Example for x in range(0,3): print 'We\'re on time %d' % (x) while expression: statement(s)

You might also like