This file contains 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
(define-syntax-class base-type | |
#:attributes (name internal-name) | |
(pattern ((~literal #%plain-app) internal-name:id) | |
#:with (_ ... name) (syntax-property this-syntax 'orig))) | |
(define-syntax-class ctor-type | |
#:attributes (name internal-name [arg 1]) | |
(pattern ((~literal #%plain-app) internal-name:id | |
((~literal #%plain-lambda) () | |
((~literal #%expression) . _) | |
arg ...)) |
This file contains 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 (for-syntax syntax/parse | |
syntax/transformer)) | |
(provide #%module-begin | |
#%top-interaction | |
#%datum | |
(rename-out [my-app #%app] | |
[my-+ +] | |
[my-expr #%expression])) |
This file contains 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 turnstile | |
;; this is a silly language that allows the literal #t to be an Int. | |
;; you can decide lexically which expressions obey this property using (true=>int <expression>) | |
;; this is a test that the turnstile syntax works, because I don't yet have a "serious" language | |
;; to test the behavior with | |
(provide #%datum #%top-interaction true=>int | |
(type-out Int Bool)) | |
(define-base-type Int) | |
(define-base-type Bool) |
This file contains 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/base | |
(require (for-syntax racket | |
racket/syntax | |
(only-in racket/function curryr) | |
syntax/parse | |
syntax/stx)) | |
(provide (all-from-out racket/base)) | |
(begin-for-syntax | |
; tweak these parameters to change resulting macro size |
This file contains 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 s-exp "garbage-macro.rkt" | |
(new-let ([s "hello, world"]) | |
(displayln s)) |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <time.h> | |
void gen_int_test(const char* reader, | |
void* ptr, | |
size_t bits, | |
int64_t expected) | |
{ |
This file contains 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 (for-syntax syntax/parse) | |
(for-meta 2 racket syntax/parse syntax/stx racket/syntax)) | |
(begin-for-syntax | |
(begin-for-syntax | |
;; attr+arity ::= id | |
;; | [id arity] | |
;; |
This file contains 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/base | |
(require redex) | |
(define-language L | |
[x ::= variable-not-otherwise-mentioned] | |
[c ::= number null] ; atoms | |
[e ::= c (cons e e) x (roll [x] e) (+ e e)] ; expression | |
[v ::= c (cons e e)] ; WHNF values | |
[e\v ::= (roll [x] e) (+ e e)] ; non-value expressions (thunks?) |
This file contains 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/base | |
(require redex) | |
(define-language Haskill | |
[x ::= variable-not-otherwise-mentioned] | |
[ctor ::= cons null A B C #t #f] | |
; expressions | |
[e ::= | |
x |
This file contains 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/base | |
(provide | |
queue? ;; any -> boolean | |
queue ;; any ... -> queue | |
empty-queue ;; queue | |
queue-empty? ;; queue -> boolean | |
queue-count ;; queue -> nonnegative-integer | |
queue-first ;; queue -> any | |
queue-rest ;; queue -> queue | |
queue-add ;; queue any -> queue |
OlderNewer