This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| (define x 22) | |
| ;; □ -- List introduction: literals, basic operations | |
| '() | |
| 'foo | |
| '(x y z) ;; homoiconicity -- the language uses the same | |
| ;; representation for syntax / expressions as it does | |
| ;; for data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; CIS352 -- Spring '26 | |
| ;; Lecture 2 | |
| ;; Forms | |
| ;; All forms are surrounded by parens, they form S-expressions | |
| ;; Here's something to remember from today's class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; CIS352 notes -- 01/13 | |
| #lang racket | |
| ;; I can use define to define both values, and also functions | |
| ;; this is a value | |
| (define foo 42) | |
| ;; Racket is expression-based, meaning that functions evaluate | |
| ;; their body expressions, and the result of evaluating any expression | |
| ;; is the computation's whole result... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; Closure Conversion | |
| (define (map f l) | |
| (match l | |
| ['() '()] | |
| [`(,hd . ,tl) (cons | |
| (let ([clo-f (vector-ref f 0)]) (clo-f f hd)) ;; (f hd) | |
| (map f tl))])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; CIS531 Fall '25 Project 1 | |
| ;; Compiling LVar -> x86-64 | |
| (require "irs.rkt") ;; Definition of each IR (please read) | |
| (require "system.rkt") ;; System-specific details | |
| (require "interpreters.rkt") | |
| (provide | |
| typecheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| (define (atom? a) | |
| (match a | |
| [(? integer? i) #t] | |
| [(? symbol? x) #t] | |
| [_ #f])) | |
| (define (anf-transform e) | |
| ;; e is the expression to be converted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; CIS531 -- Fall 2025 | |
| ;; Kristopher Micinski | |
| ;; | |
| ;; Notes on CPS Conversion | |
| #;(+ (* (read) 3) (+ 4 5)) | |
| ;; When we translate constructs like +, *, and other |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| (require "system.rkt") | |
| ;; | |
| ;; This file provides detailed documentation of each of the IRs used | |
| ;; in the project. | |
| ;; | |
| ;; Please do not modify this code (doing so will not help you): your | |
| ;; passes must conform to these specifications for the autograder to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; When we say an operator "associates to the left," | |
| ;; we mean that we interpret a construct like | |
| ;; 10 - 2 - 2 is interpreted as (10 - 2) - 2 rather | |
| ;; than the (incorrect) 10 - (2 - 2). Most typical | |
| ;; arithmetic operators like +, *, /, and - associate | |
| ;; to the left. | |
| ;; Unfortunately, LL parsers do not make this natural |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; Tuesday, April 8, 2025 | |
| ;; CIS352 | |
| (define (λ-expr? e) | |
| (match e | |
| [(? symbol? x) #t] | |
| [`(lambda (,(? symbol? x)) ,(? λ-expr? e-b)) #t] | |
| [`(,(? λ-expr? e0) ,(? λ-expr? e1)) #t] |
NewerOlder