0% found this document useful (0 votes)
18 views1 page

Lab Sheet 5 Parsing S6 B.Tech Computer Science and Engineering Amrita School of Engineering, Amritapuri

This document provides exercises for recognizing various statements as part of a compiler design lab. Students are asked to add parsing rules to recognize conditional statements like if-else and switch statements, looping statements like while and for, and function and class declarations in C++. The goal is to parse a wide variety of statements as part of the lab.

Uploaded by

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

Lab Sheet 5 Parsing S6 B.Tech Computer Science and Engineering Amrita School of Engineering, Amritapuri

This document provides exercises for recognizing various statements as part of a compiler design lab. Students are asked to add parsing rules to recognize conditional statements like if-else and switch statements, looping statements like while and for, and function and class declarations in C++. The goal is to parse a wide variety of statements as part of the lab.

Uploaded by

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

Compiler Design Lab

Lab sheet 5
Parsing
S6 B.Tech Computer Science and Engineering
Amrita School of Engineering, Amritapuri

Given below are some exercises to recognize a wide variety of statements.

1. Add rules to recognize conditional statement.


a. Rules of the form: if (condition) statements else statements (else is optional)
condition: ID comparator expr
comparator: < | > | <= | >= | == |! =
b. Rules of the form: switch(condition) statements
2. Add rules to recognize while statements.
a. Rules of the form: while (condition) statements
3. Add rules to recognize for statements.
a. Rules of the form: for(id = value;condition;increment/decrement)
statements
4. Add rules to recognize function declaration.
5. Add rules to recognize function definition
6. Add rules to recognize class declaration in C++.

You might also like