0% found this document useful (0 votes)
3 views

CCProject

The document outlines a project for a Compiler Construction course at the University of Central Punjab, requiring students to write a parser for a specified C-like grammar using a predictive parsing approach. It includes rules for individual work, penalties for late submissions and plagiarism, and specifies the use of C++ for development without built-in data structures. Evaluation criteria include source code quality, input/output files for the scanner, and error reporting from both the scanner and parser.

Uploaded by

ahmed nadeem
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)
3 views

CCProject

The document outlines a project for a Compiler Construction course at the University of Central Punjab, requiring students to write a parser for a specified C-like grammar using a predictive parsing approach. It includes rules for individual work, penalties for late submissions and plagiarism, and specifies the use of C++ for development without built-in data structures. Evaluation criteria include source code quality, input/output files for the scanner, and error reporting from both the scanner and parser.

Uploaded by

ahmed nadeem
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/ 3

University of Central Punjab

Faculty of Information Technology & Computer Sciences


Compiler Construction, Fall 2024
Project

Late will be penalty of deduction of 2 absolute marks per day

Grammar
Right down grammar for C-Like syntax

Function  Type identifier < ArgList > CompoundStmt


ArgList  Arg | ArgList ,Arg
Arg  Type identifier
Declaration  Type IdentList ;
Type  int | float
IdentList  identifier ,IdentList | identifier
Stmt  ForStmt | WhileStmt | Expr ; | IfStmt
| CompoundStmt | Declaration | ;
ForStmt  for < Expr ; OptExpr ; OptExpr > Stmt
OptExpr  Expr | 
LoopStmt  loop < Expr > Stmt
IfStmt  agar < Expr > Stmt MagarPart
MagarPart  magar Stmt | 
CompoundStmt  { StmtList }
StmtList  StmtListStmt | 
Expr  Rvalue
Rvalue  Rvalue Compare Mag | Mag
Compare  == | < | > | <= | >= | != | <>
Mag  Mag + Term | Mag – Term | Term
Term  Term * Factor | Term / Factor | Factor
Factor  < Expr > | identifier | number

Assignment Description:
For this assignment,

1. You have to write a Parser for above Grammar.


2. Parser will get Token from scanner and built a parse tree.
3. Parser will built the parse tree using Predictive Parser (LL(1)) grammar.
4. Panic Mode approach will be implemented to output the syntax error.
University of Central Punjab
Faculty of Information Technology & Computer Sciences
5. This assignment includes following parts:
University of Central Punjab
Faculty of Information Technology & Computer Sciences

Rules:
1. This is an individual assignment. Each student has to submit his/her assignment work.
2. Group discussion is allowed but don’t share code and other part of assignment with other student.
3. Plagiarism is not tolerable in any of its form. Minimum penalty would be a ‘0’ marks in the project
module.

Tools:
Language (For Development): C++

Note: Student cannot use built-in data structure. Student can use his own data structure Hash Table,
Linked List which he/she developed in data structure course. In this case student should know about the
data structure.

Evaluating Criteria:
1. Source code should reflect the detail given in documents (other parts).
2. A text file with valid source code will be input of the scanner and Token file will be output of the scanner
tool.
3. A text file will show the productions in separate lines used in building the parse tree.
4. A text file show the errors generated from both scanner and parser.

You might also like