0% found this document useful (0 votes)
6 views4 pages

Project1

The document outlines Project 1 for CSc 201 at California State University, Sacramento, focusing on creating an executable specification of a simple imperative programming language using ML. It details the project structure, including steps for defining abstract syntax, static semantics, and dynamic semantics, along with submission requirements and deadlines. Students must attend specific lectures, follow guidelines, and ensure their code is well-documented and tested.

Uploaded by

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

Project1

The document outlines Project 1 for CSc 201 at California State University, Sacramento, focusing on creating an executable specification of a simple imperative programming language using ML. It details the project structure, including steps for defining abstract syntax, static semantics, and dynamic semantics, along with submission requirements and deadlines. Students must attend specific lectures, follow guidelines, and ensure their code is well-documented and tested.

Uploaded by

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

CSc 201: Programming Language Principles

California State University, Sacramento


Fall Semester 2022
Project 1 Given on Tuesday of the 6th Week 10/4/2022
Due Monday of the 10th Week 10/31/2022, 20 Points

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

Step 1 Abstract Syntax


Submission deadline: 8pm of Monday of the 7th week 10/10/2022. 5 points total: 3 points
for team submission, 2 points for individual attendance of lectures on 10/4 and 10/6.

• 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.

Step 2 Static Semantics


Submission deadline: 8pm of Thursday of the 8th week 10/20/2022. 7 points total: 5 points
for team submission, 2 points for individual attendance of lectures on 10/11 and 10/13.

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.

Step 3 Dynamic Semantics


Submission deadline: 8 pm of Monday of the 10th week 10/31/2022. Each team is required
to give a demo during class time on Tuesday 11/1/2021 or Thursday 11/3/2022. 8 points
total: 6 points for team submission and demo, 2 points for individual attendance of lectures
on 10/18 and 10/20.

• Define the domain for dynamic semantics and associated operations/functions.


• Define functions for dynamic semantics. These function definitions are also abstract
syntax directed.
• Test your functions for dynamic semantics by using proper pieces of your sample
program.
• Define a top-level function that allows your functions for static semantics and your
functions for dynamic semantics work together. Apply the top function to your sample
program with an appropriate definition of the initial program state, then check the result.

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.

The Abstract Grammar of Graal from B. Meyer’s Introduction to the Theory


of Programming Languages (see Meyer’s book)

3
The Abstract Grammar in BNF for a Graal-like Language for Project1

<Program> ::= <DeclarationList> <Instruction>

<DeclarationList> ::= <Declaration> *


<Declaration> ::= <Variable> <Type>
<Type> ::= BooleanType | IntegerType

<Instruction> ::= Skip |


<Variable> <Expression> |
<Instruction> * |
<BooleanExpression> <Instruction> <Instruction> |
<BooleanExpression> <Instruction>

<Expression> ::= <IntegerExpression> | <BooleanExpression>


<BooleanExpression> ::= <BooleanConstant> |
<Variable> |
<IntergerExpression> <RelationalOp> <IntegerExpression> |
<BooleanExpression> <BooleanOp> <BooleanExpression>
<IntegerExpression> ::= <IntegerConstant> |
<Variable> |
<IntegerExpression> <ArithmaticOp> <IntegerExpression>

<Boolean_Op> ::= And | Or


<Relational_Op> ::= Lt | Le | Eq | Ne | Ge | Gt
<Arithmatic_Op> ::= Plus | Minus | Times | Div

<Boolean_Constant> ::= B
<Integer_constant> ::= Z
<Variable> ::= S

You might also like