1.28 starter file for class

1.28 starter file for class - ; The first three lines of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
;; The first three lines of this file were inserted by DrScheme. ;; They record information about the language level. #reader(lib "plai-restricted-reader.ss" "plai")((modname rcae-starter) (read- case-sensitive #t) (teachpacks ())) ;; NOTE: this file uses language level "Restricted PLAI Scheme" (not "Pretty Big") ;; parse : sexp -> RCAE (define (parse expr) (cond [(number? expr) (num expr)] [(symbol? expr) (id expr)] [(list? expr) (case (first expr) [(+) (add (parse (second expr)) (parse (third expr)))] [(*) (mul (parse (second expr)) (parse (third expr)))] [(if0) (if0 (parse (second expr)) (parse (third expr)) (parse (fourth expr)))] [(with) (let ([var (first (second expr))] [named-expr (parse (second (second expr)))] [body (parse (third expr))]) (app (fun var body) named-expr))] [(rec) (let ([var (first (second expr))] [named-expr (parse (second (second expr)))] [body (parse (third expr))]) (rec var named-expr body))] [(fun) (fun (second expr) (parse (third expr)))] [else (app (parse (first expr))
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/06/2008 for the course CS 4536 taught by Professor Fisler during the Winter '08 term at WPI.

Page1 / 2

1.28 starter file for class - ; The first three lines of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online