You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
aoc-racket/2016/day12/lang.rkt

25 lines
694 B
Racket

8 years ago
#lang br/quicklang
;; http://adventofcode.com/2016/day/12
(provide read-syntax)
(define (read-syntax path port)
(strip-bindings
#`(module mod "lang.rkt"
#,@(for/list ([str (in-lines port)]
#:when (not (equal? str "")))
(format-datum `(handle ,@(map string->symbol (string-split str))))))))
(define (mb . INSTS)
#'(#%module-begin
(define insts (list . INSTS))
(define regs (make-hash '((a . 0)(b . 0)(c . 0)(d . 0))))
(let loop ([ptr 0])
(define inst (list-ref insts ptr))
(inst regs))))
(provide (rename-out [mb #%module-begin]))
(define-macro-cases handle
[(_ cpy X Y) #'(λ(regs) 42)])
(provide handle)