[Solved] CS450 Homework8-Translating SimpleJS into LambdaJS

$25

File Name: CS450_Homework8_Translating_SimpleJS_into_LambdaJS.zip
File Size: 471 KB

SKU: [Solved] CS450 Homework8-Translating SimpleJS into LambdaJS Category: Tag:
5/5 - (1 vote)

Translating SimpleJS into LambdaJS

  1. Implement the following translation function from SimpleJS into LambdaJS.

def

J[[x.y]] ==(deref x)[y]

def

J[[x.y := e]] ==let data = [[e]] in

let o = (deref x) in

x := o[y] data; data

J[[x.y(e)]]] ==def let m = (deref x)[y] in

let f = (deref m)[$code] in f(x,[[e]])

J[[function(x) {e}]] ==def alloc {$code : (this,x).[[e]],prototype : alloc {}}

def

J[[new ef(e)]] ==let ctor = deref [[ef]] in

let obj = alloc {$proto : ctor[prototype]} in

let f = ctor[$code] in f(obj,J[[e]]); obj

def

J[[c]] ==c

def

J[[x]] ==x

def

J[[let x = e1 in e2]] ==let x = [[e1]] in [[e2]]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS450 Homework8-Translating SimpleJS into LambdaJS[Solved] CS450 Homework8-Translating SimpleJS into LambdaJS
$25