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] |
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 -- P3 Builtins help | |
| ;; | |
| ;; I wrote up these notes based on some student meetings. | |
| ;; This project is intentionally a bit vague about how to | |
| ;; handle the builtins. That is because I want you to have | |
| ;; some ability to have the experience of figuring out how | |
| ;; you might want to engineer your own solution, considering | |
| ;; the various trade-offs. |
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 | |
| ;; Consider the folllowing λ-calculus expression, write | |
| ;; a reduction sequence where each β reduction in the | |
| ;; sequence uses CBV evaluation order | |
| ((λ (x) x) | |
| ((λ (y) y) (λ (z) z))) | |
| ((λ (x) x) | |
| ((λ (z) (z z)) (λ (y) (y y)))) |
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 -- March 20, 2025 | |
| ;; For the past few lectures, we've talked about the idea of "in-context" β: | |
| ;; the idea that we can "just do all the βs." So for example: | |
| ((λ (b) b) | |
| (((λ (x) x) (λ (a) a)) | |
| ((λ (y) y) (λ (z) z)))) |
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 | |
| ;; CIS 352 -- Spring '25 | |
| ;; March 18, 2025 | |
| ;; This week in class: | |
| ;; [ ] λ-calculus refresher | |
| ;; [ ] λ-calculus β reduction motivation | |
| ;; [ ] Extending the λ-calculus with numbers | |
| ;; [ ] Building an interpreter with closures |
NewerOlder