-
Notifications
You must be signed in to change notification settings - Fork 0
/
interp-Clambda.rkt
37 lines (33 loc) · 1.19 KB
/
interp-Clambda.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#lang racket
(require "utilities.rkt")
(require "interp-Llambda-prime.rkt")
(require "interp-Cvar.rkt")
(require "interp-Cif.rkt")
(require "interp-Cwhile.rkt")
(require "interp-Cvec.rkt")
(require "interp-Cvecof.rkt")
(require "interp-Cfun.rkt")
(require (prefix-in runtime-config: "runtime-config.rkt"))
(provide interp-Clambda interp-Clambda-mixin)
(define (interp-Clambda-mixin super-class)
(class super-class
(super-new)
(define/override (interp-op op)
(verbose "Clambda/interp-op" op)
(match op
['procedure-arity
(match-lambda
[(vector (CFunction xs info G env) vs ... `(arity ,n)) n]
[v (error 'interp-op "Clambda/expected function, not ~a" v)])]
[else (super interp-op op)]))
))
(define Clambda-class (interp-Clambda-mixin
(interp-Cfun-mixin
(interp-Cvecof-mixin
(interp-Cvec-mixin
(interp-Cwhile-mixin
(interp-Cif-mixin
(interp-Cvar-mixin
interp-Llambda-prime-class))))))))
(define (interp-Clambda p)
(send (new Clambda-class) interp-program p))