Friday, 7 October 2016

CL1 PMCD practice program

410446 Computer Laboratory-l

Teaching Scheme:                                               Practical: 4 hrs/week
Examination Scheme:                                          Practical: 50 Marks

Principles of Compiler Design Assignments


(Should be implemented in Lab, not to be performed in final exam)
Install fedora/Ubuntu on a machine, Detail implementation of all installed Linux Distribution Commands, Find out Editor Options, Study all commands of vi editor.

LEX
Assignment to understand basic syntax of LEX specifications, built-in functions and Variables.
(1) WAP to Count number of characters, words and lines in input single file, multiple files.
(2) WAP to Count number of letters (A-Z or a-z), vowels (AEIOU or a e i o u).
(3) Write a Lex program to print details of book chosen by user stored in        input file. Details include author name, publication and Edition from given input file of having all book database in Library Management System.
(4) Program to count the number of identifier in file.
(5) Program to remove single and multiple line comment in a C program and create output text file by removing multi line comments from input file.  Also count number of characters, words and lines of input file.
(6) Write a lex program that capitalizes all reserved words outside the comments in a c program.
(7) Implement a lexical analyzer for a subset of C using LEX try to understand role of lexical analysis in compilation, understand the theory behind design of lexical analyzers and lexical analyzer generator, be able to use LEX to generate lexical analyzers
(8) Implement a lexical analyzer for a subset of C using LEX Implementation should support Error handling,
(9) Write a LEX program for parsing asm file(Assembly Language).
(10) Write Lex program for tokenizing SQL statements which are in file. [Select, Insert, Update, Delete, Rename etc]
(11) Write a program using LEX to copy contents of input text file to output, writing each sentence in title case.
(12) Write a program using LEX to copy contents of input text file to output, omitting all words that begin with letters x,y and z.
(13) Write a lex specification for simple C-preprocessor which processes simple #define statements.

YACC
Assignment to understand basic syntax of YACC specifications, built-in functions and Variables
(14) Write a program using YACC for simple desk calculator.

LEX & YACC
(15) Write a program using lex and yacc for advance desk calculator
(16) Using concept of YACC tool/ Parser generator write a lex and yacc program to accept the  infix expression and convert it into postfix  Expression.
(17) Implementation of a lex  and yacc program to convert Infix arithmetic expression into Prefix form .
(18) Implementation of a lex  and yacc program to convert prefix arithmetic expression into Postfix form .
(19) Write a LEX and YACC program to convert postfix arithmetic expression into infix form.
(20) WAP using LEX & YACC to convert POSTFIX arithmetic Expression into PREFIX form.
(21) Implementation of a lex  and yacc program to convert postfix arithmetic expression into infix form .
(22)         Implementation of a lex and yacc program to evaluate postfix expression
(23)         Write a program to create syntax tree for given input arithmetic expression.

CODE GENERATION
(24) Write an ambiguous CFG to recognize an infix expression and implement a parser that recognizes the infix expression using YACC. Provide the details of all conflicting entries in the parser table generated by LEX and YACC and how they have been resolved Intermediate Code Generation
(25) Write a program using LEX & YACC to generate INTERMEDIATE CODE in the form of THREE ADDRESS CODE (QUADRUPLES) for assignment operator.
(26) WAP using lex and yacc to generate intermediate code in the form of 3 address code (quadruples) for if else statement of C language.
(27) WAP using lex and yacc to generate intermediate code in the form of 3 address code (quadruples) for switch statement of C language.
(28) Write an attributed translation grammar to recognize declarations of simple variables, "for", assignment, if, if-else statements as per syntax of C or Pascal and generate equivalent three address code for the given input made up of constructs mentioned above using LEX and YACC. Write a code to store the identifiers from the input in a symbol table and also to record other relevant information about the identifiers. Display all records stored in the symbol table.

Code Optimization
(29) To implement code optimization on target code (peephole optimization).

Code Generation

(30) Write a program to generate TARGET CODE from input file containing intermediate code in the form of Quadruples.

No comments:

Post a Comment