CSE 305: Language Interpreter DesignPython

Java Python CSE 305: Language Interpreter Design

Due: July 8 2024, 11:59pm

1 Overview

The goal of this project is to understand and build an interpreter for a small, OCaml-like, stack- based bytecode language.  You will be implementing this interpreter in  OCaml, like the previous assignments.  The project is broken down into three parts.  Part 1 is defined in Section 4 and is worth 100 points, Part 2 is defined in Section 5 and is worth 150 points, and Part 3 is defined in Section 6 and is worth 150 points.  All parts are due by July 8 2024, 11:59pm, but we recommend you keep to the following time schedule for each part:

1.  Part 1 by June 17 2024, 11:59pm(100 points)

2.  Part 2 by June 26 2024, 11:59pm(150 points)

3.  Part 3 by July 8 2024, 11:59pm(150 points)  **this is the last day to submit**

This is an individual project.  You will submit a file named interpreter.ml which contains a function, interpreter, with the following type signature:

val  interpreter  :   string  *  string  -> unit

If your program  does  not  match  the type signature, it will not compile on Autolab and  you will  receive 0  points. You  may,  however,  have  helper  functions  defined outside of interpreter—the grader is only explicitly concerned with the type of interpreter.

You must submit a solution for each part.  Each part is graded individually, so you may wish, for example, to submit your Part 3 solution for parts 1 and 2.  Late submissions will not be accepted and will be given a score of 0. Test cases will also be provided on Piazza for you to test your code locally. These will not be exhaustive, so you are highly encouraged to write your own tests to check your interpreter against all the functionality described in this document.

2 Functionality

Given the following function header:

let  interpreter  ((input  :   string),  (output  :    string  ))  :   unit  =  . . .

input and output will be passed in as strings that represent paths to files just like in the Pangram assignment.  Your function should write any output your interpreter produces to the file specified by output.  In the examples below, the input file is read from top to bottom and then each com- mand is executed by your interpreter in the order it was read. It is incredibly useful to read in all of the commands into a list prior to executing them, separating input from the actual interpreta- tion of the commands.  The input file can be arbitrarily long.  You may find the library function String.split__ on__char to be useful for separating a string into a string list.

3 Grammar

The following is  a  context free grammar for the bytecode  language you will be implementing. Terminal symbols are identified by monospace  font,  and nontermina

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值