Re: Homework question

From: Assaf Kfoury (kfoury@cs.bu.edu)
Date: Mon Sep 13 2004 - 21:18:13 EDT


Received: from cs.bu.edu (h000c41248e2b.ne.client2.attbi.com [24.34.20.189]) (authenticated bits=0) by cs.bu.edu (8.12.2/8.12.2) with ESMTP id i8E1I3eq017726; Mon, 13 Sep 2004 21:18:03 -0400 (EDT)
Message-ID: <414646D5.7070507@cs.bu.edu>
Date: Mon, 13 Sep 2004 21:18:13 -0400
From: Assaf Kfoury <kfoury@cs.bu.edu>
Organization: Boston University
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
X-Accept-Language: en
To: Hany Morcos <hmorcos@cs.bu.edu>, cs520@cs.bu.edu
Subject: Re: Homework question
References: <010001c499ea$6f241850$930ac580@hmorcos>
In-Reply-To: <010001c499ea$6f241850$930ac580@hmorcos>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Length: 1561
Status: RO
X-Mozilla-Status: 8011
X-Mozilla-Status2: 00000000
X-UIDL: 411f69ec00000845

The code written by Pierce carries out two actions:

(1) a syntactic analysis of an input expression, i.e., it determines
whether the input expression is legal according to the formal syntax of
Chapter 3, and

(2) if it is legal according to the formal syntax of Ch 3, an evaluation
of the input expression according to the small-step operational
semantics of Ch 3.

So, for example, the input expression "if true then false else true" is
determined to be legal, and its evaluation returns "false".

Pierce wrote his code in OCaml, which is a variant of SML. I ask you to
repeat what Pierce accomplished already, by making two changes:

(1) restrict the syntax to boolean values, using the formal syntax of
Figure 3-1 on page 34, and

(2) produce a code written in SML.

Your code should be interpreted by the SML interpreter. You will not
compile your code. Rather, to test your code, you will launch the SML
interpreter (by issuing the command "sml" at the Unix prompt), and then
load your file to be interpreted.

You may find the following website useful:

http://www.ps.uni-sb.de/~rossberg/SMLvsOcaml.html

Assaf

Hany Morcos wrote:

> Hello Dr. Kfoury,
>
> I have a ( little bit stupid ) question about problem 4 in the
> homework. After modifying the Ocaml code in part (a) are we supposed
> to run it ? I mean compile it and have an executable to run using
> OCaml compiler?
>
> Also in part (b) After writing the new grammar in ML are we supposed
> to have an executable that parses inputs and prints output ?
>
> Thanks,
> Hany



This archive was generated by hypermail 2b29 : Fri Nov 19 2004 - 17:00:43 EST