0% found this document useful (0 votes)
31 views3 pages

CS3501 Set3

compiler design

Uploaded by

sivapriyamms
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

CS3501 Set3

compiler design

Uploaded by

sivapriyamms
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

B.E / B.Tech.

PRACTICAL END SEMESTER EXAMINATIONS, NOVEMBER/DECEMBER 2023


Fifth Semester
CS3501 - COMPILER DESIGN
(Regulations 2021)

Time : 3 Hours Answer any one Question Max. Marks 100

Aim/Principle/Apparatus Tabulation/Circuit/ Calculation Viva-Voce Record Total


required/Procedure Program/Drawing & Results
20 30 30 10 10 100

1. (i)Write a program to recognize a valid arithmetic expression that uses operator +, - , * and /.

(ii)Develop a LEX program to find number of white spaces.

2. (i)Write a program to find number of identifiers in a C file.

(ii)Write a program to test whether a given identifier is valid or not.

3. (i) Develop a LEX Program to scan reserved words of C Language.

(ii) Design a LEX Program to find identifiers of C Language.

4. Write a program that uses the semantic rules of LEX and YACC tool to construct a calculator
that computes the supplied expression.

5. Create a Lex program to identify a valid C language control structure syntax for the following

(i) if-else-if

(ii) switch-case

Page 1 of 3
6. Write a Lex program to count the number of words, characters, blank spaces and lines in a C
program.

7. Write a program to implement the following code optimization techniques:

(i) Strength reduction.

(ii) Algebraic transformation.

8. Write a program to implement the back end of the compiler for which the three-address code is
given as input and the 8086-assembly language code is produced as output.

9. Write a program to construct of DAG (Directed Acyclic Graph).

10. Write a program to implement any one of the dynamic storage allocation strategies (Heap, Stack,
Static).

11. (i) Write a program to find whether a given string is keyword or not.

(ii) Develop a LEX program to count newline characters.

12. Write a program to implement the type checking for given expression.

13. Develop a program to generate tokens for the following input string

(12+23*34)

14. Write a LEX program to recognize a valid variable which starts with a letter followed by any
number of letters or digits.

Page 2 of 3
15. Write a program for implementing Three Address Code using LEX and YACC.

16. Create and print a symbol table of C language that contains name, type and size of identifier.

17. Write a program to implement the Lexical Analyzer using lex tool to recognize few patterns

(Identifiers, Constants, Comments, Operators).

18. Write a program to generate three address codes for

(i)assignment expression

(ii)arithmetic expression

19. Write a program for implementing a Lexical analyzer using LEX tool in Linux platform.

20. (i)Write a C program to recognize strings under 'a', 'a*b+', 'abb'.

(ii) Write a C program to calculate FIRST of a regular expression.

Page 3 of 3

You might also like