Project1
Project1
General Information
This project is designed for you to write, using ML, an executable specification of an abstract
language system for a simple imperative programming language. In such a system, the meaning
of programs in the simple imperative language defined can be computed. Therefore, your
executable specification of this language can serve as a rapid prototype of the implementation for
this imperative language. This team project provides an opportunity of applying to practice the
course materials on abstract syntax, denotational semantics, and functional programming
language SML.
Before the start of your project, read carefully all sections of this document including Project
Description, Project Requirements, Project Submissions, and the Abstract Grammar in
BNF for a Graal-like Language for Project1. As you work on your project, use them to guide
you and follow the steps specified. When you progress at the steps specified, it is important to
review the lectures on ML, abstract syntax, static semantics, and dynamic semantics. As an
individual student, you should review and understand each step, each part of this team project,
and the code written by your team.
Project Description
• In your ML file, use ML data type definition mechanisms to define an abstract syntax for
a Graal-like language defined in this file and discussed in class. You need to use data
constructors, type constructors, and recursions in your data type definitions.
• Understand the algorithm of the one sample program assigned to your team by executing
and testing it in an imperative language programming environment which you are
familiar with.
• Include the given sample program in your ML file using comments. Then, step by step,
using your data type definitions in ML for the abstract syntax, represent this sample
program as an instance of data type Program you define.
1
• For the Graal-like language, define the domains for static semantics and associated
operations/functions for the contextual information.
• Define the functions for static semantics. The function definitions are abstract syntax
directed.
• Test your functions for static semantics by using proper pieces of your sample program.
• Apply the top function for static semantics to your sample program for the validity check.
The organization/sections of SML definitions/code in your ONE .ml (or .sml) file
Step1: Definitions for the abstract syntax and representation of a sample program
• type/datatype definitions
• comments to include the Graal-like sample program assigned to your team
• representation of the Graal-like sample program assigned to your team
Step2: Definitions for the static semantics
• type/datatype definitions
• function definitions, and testing in the between
Step3: Definitions for the dynamic semantics
• type/datatype definitions
• function definitions, and testing in the between
Project Requirements
• You are required to attend lectures of 10/4, 10/6, 10/11, 10/13, 10/18, and 10/20 that are
on the Project1 materials.
• You are required to submit your team project work on time. There is a firm deadline for
each step. After the firm deadline, zero credit will be given to your team for the project
work of that step.
• You are required to submit your complete work and SML accepted work for each step.
Zero credit will be given to your project work of that step if there is any incompletion.
2
• You are required to follow the specific and also detailed instructions and requirements
given in lectures for this project of this semester. Zero credit will be given to your
project work if any part (e.g., definition, testing) of your project work does not follow the
given specific and also detailed instructions and requirements, if any part of your project
work is not what is required for this semester, and/or if there is any violation of academic
honesty.
Please review the University’s Policies on Academic Honesty.
Everyone, please attend lectures to learn the project related materials and directly apply
that to your project.
• You are required to do rule-based, pattern matching-based recursive function definitions.
For each function you define, use SML comments to clearly specify the function
signature.
• You are required to test functions as well as the entire program/specification as instructed
in lectures. For each testing case you use to test a function, use SML comments to
clearly specify what the testing case is.
• You are required to ensure the readability of your SML code/program layout. You need
to use SML comments clearly indicate where each step of this project starts.
Project Submissions
At the end of each step, each team should send one email only to the instructor at
[email protected] as your team project submission. You are required to have the subject line:
CSC201 Sec# Proj1 Team# Step#. Email communication with the instructor for the project
must include all team members.
When you submit your work of one step, your work in the previous step(s) have to be included in
your same file submission. You are required to submit the following for each step of your team
work:
1) Your executable .ml (or .sml) file, i.e., a plain .ml.txt (or .sml.txt) file. This file needs to
include the following as SML comments at the top: CSC 201 Section #, Team #, full
names of all team members.
The file name should be Sec#Proj1Team#Step#.ml.txt (or
Sec#Proj1Team#Step#.sml.txt).
2) Your result file generated by SML, a plain .txt file.
The file name should be Sec#Proj1Team#Step#Result.txt.
3) Your .docx file including all your executable ml code and comments followed by the
result generated by SML. This file can be created by copying the content of BOTH your
files 1) and 2).
At the top of this .docx file, please also list the following: CSC 201 Section #, Team #,
full names of all team members.
The file name should be Sec#Proj1Team#Step#Whole.docx.
3
The Abstract Grammar in BNF for a Graal-like Language for Project1
<Boolean_Constant> ::= B
<Integer_constant> ::= Z
<Variable> ::= S