CS 315
Project 2


Assigned: Nov. 1, 2024
Due: Nov. 10, 2024 23:59

Parser for a Programming Language for Drones and its Lexical Analyzer

The second project builds on your language design of the first project. This project involves building a parser for your language using the yacc tool. Please refer to the description of Project 1 for the requirements for your programming language design. There are some minor changes, please read carefully the instructions below.

Part A - Revised and Augmented Language Design (20 points)

The requirements for the language are the same as Project 1 except for a few minor extensions. You can use as much of your previous design work as you can. However, if you have not already done so, you should incorporate the following elements into your design for the second part of the project:

Please note that there is no single correct answer. This is a design project. As long as your language is consistent, unambiguous and it makes sense with respect to the specifications given above, it is fine. However, it is expected to be readable, writable and reliable, as much as possible.

Part B - Implementing the Parser (50 points)

For the second project, you are required to implement a parser using the yacc tool. The parser reads the source code of a program, written in your programming language from an input file. If the source code represents a valid program in your programming language, the parser should print out a message indicating the acceptance of the input (e.g. "Input program is valid"). Otherwise, the parser should print out an error message indicating the line number of the source code that contains the error (e.g. "Syntax error on line **!" where ** will be the line number of the source program at which the error was detected).

You should use the lexical analyzer that was developed in the project, but you may have to modify it; for example, to count line numbers. Also, the lexical analyzer will return tokens, instead of printing messages.

VERY IMPORTANT NOTE:

Part C - Example Program (25 points)

Finally, you will test your parser on the programs that you submitted in the first part of the project. Also show that your parser finds syntax errors by introducing small errors in these programs.

VERY IMPORTANT NOTE: If you do not submit a test program, we will have no way of evaluating your parser, hence you will receive a 0 from Part C!

Part D - Teamwork (5 points)

You will be working with the same group you worked with for Project 1. The remaining 5 points of your grade will be determined by your contributions to the project. Each member will evaluate themselves and the other members of the team, on five different dimensions. The scores given to each member for each dimension must be different. The member who deserves the highest point for a particular dimension may be given 5, while the member who deserves the lowest point may be given 0. Please fill in the form available here and email it to guvenir@cs.bilkent.edu.tr, on the same day of submission. Rename the files as CS315_24F_Team_X-ID_Y, where X is your team number and Y is your ID number. If you do not submit this form, your teamwork grade will be 0. Likewise, if any two students are given the same grade on any dimension, your teamwork grade will be 0. The teamwork grade of each student will be computed separately, by taking into account the comments written by the student and other team members. The numerical values in columns D-H of the form will be used in statistical analyses. Needless to say, do NOT collaborate in preparing and submitting your peer assessments.

Logistics

There are two parts that you will hand in before the due date of the project.
  1. A project report (in PDF format) including the following components:
  2. Your lex and yacc description files, together with the example programs described above, written in your language. Specifically, do the following:

Submission

Please upload the zip (or rar) file you created to Moodle (CS 315 (All Sections) Programming Languages) before the due date. Late submissions will be accepted, with 20 points (out of 100) deduction for each extra day.

If your submission does not adhere to the above guidelines, points will be deducted.
Make sure you have correct file naming.
Your parser must compile and run on dijkstra.cs.bilkent.edu.tr. The evaluation of your parser will be done only on this machine.