36 lines
567 B
Racket
Executable File
36 lines
567 B
Racket
Executable File
#lang typed/racket
|
|
|
|
(provide Cell
|
|
Tape
|
|
Instruction
|
|
Token
|
|
Program
|
|
Loop)
|
|
|
|
(define-type Cell (U Zero Positive-Byte))
|
|
|
|
(define-type Tape (Listof Cell))
|
|
|
|
(define-type Instruction
|
|
(U 'pointer-increment
|
|
'pointer-decrement
|
|
'increment
|
|
'decrement
|
|
'output
|
|
'input
|
|
Loop))
|
|
|
|
(define-type Token
|
|
(U 'pointer-increment
|
|
'pointer-decrement
|
|
'increment
|
|
'decrement
|
|
'output
|
|
'input
|
|
'loop-start
|
|
'loop-end))
|
|
|
|
(define-type Program (Listof Instruction))
|
|
|
|
(define-type Loop Program)
|