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/base | |
(require racket/list racket/set racket/string racket/match) | |
(define (local? sym) | |
(define str (symbol->string sym)) | |
(define trimmed (string-trim str #rx"_[0-9]+" #:left? #f)) | |
(not (equal? str trimmed))) | |
(define (get-primitives l) |
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/base | |
; Hastily adapted from debug-repl at https://github.com/AlexKnauth/debug/blob/master/debug/repl.rkt | |
; Note that this code relies on the output of `syntax-debug-info`, which the Racket documentation | |
; does not provide strong promises about. It may break with a future release of Racket. | |
; MIT License | |
; | |
; Copyright (c) 2015-2022 Alex Knauth, Suzanne Soy, Matthew Butterick, Sorawee Porncharoenwase, |
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 (eval e env) | |
(match e | |
[(? symbol?) (hash-ref env e)] | |
[`(let ([,(? symbol? x) ,e]) ,b) | |
(eval b (hash-set env x (eval e env)))] | |
[(? number?) | |
e] | |
[`(+ ,e1 ,e2) |
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 (for-syntax racket/syntax "syntax-serializer.rkt")) | |
(provide Foo (for-syntax bar) check) | |
(define Foo #f) | |
(define-syntax (def stx) | |
(syntax-case stx () |
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
;;; Copyright (c) 2000-2008 Dan Friedman, Erik Hilsdale, and Kent Dybvig | |
;;; | |
;;; Permission is hereby granted, free of charge, to any person | |
;;; obtaining a copy of this software and associated documentation files | |
;;; (the "Software"), to deal in the Software without restriction, | |
;;; including without limitation the rights to use, copy, modify, merge, | |
;;; publish, distribute, sublicense, and/or sell copies of the Software, | |
;;; and to permit persons to whom the Software is furnished to do so, | |
;;; subject to the following conditions: | |
;;; |
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 | |
(match-define (list pout pin id perr f) (process "exit")) | |
(with-handlers ([exn:fail? (lambda (e) (printf "error in write: \n~a\n" e) (void))]) | |
(write-bytes #"foo" pin) | |
(flush-output pin) | |
(sleep 0.1) | |
(write-bytes #"bar" pin) | |
(flush-output pin)) |
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 | |
(for-syntax | |
ee-lib | |
syntax/parse)) | |
(begin-for-syntax | |
(define lift-binds! (make-parameter #f)) | |
(define lift-syntaxes! (make-parameter #f)) |
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 | |
(module A racket | |
(provide m) | |
(require (for-syntax syntax/parse syntax/location)) | |
(module empty racket | |
(provide #%module-begin)) | |
(define-syntax (m stx) |
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 | |
; Interpreter for MetaScheme, the core staged language. | |
(struct lit [v] #:transparent) | |
(struct lam [xs e] #:transparent) | |
(struct ref [x] #:transparent) | |
(struct app [e1 e2] #:transparent) | |
(struct lif [c t e] #:transparent) | |
(struct quot [e] #:transparent) |
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 | |
(struct lit [v] #:transparent) | |
(struct lam [xs e] #:transparent) | |
(struct ref [x] #:transparent) | |
(struct app [e1 e2] #:transparent) | |
(struct quot [e] #:transparent) | |
(struct unquot [e] #:transparent) | |
(struct lif [c t e] #:transparent) | |
(struct run [e]) |
NewerOlder