initiated the programming ritual
This commit is contained in:
parent
de00b27559
commit
fba6455020
1 changed files with 57 additions and 0 deletions
57
main.rkt
Normal file
57
main.rkt
Normal file
|
@ -0,0 +1,57 @@
|
|||
;; The first three lines of this file were inserted by DrRacket. They record metadata
|
||||
;; about the language level of this file in a form that our tools can easily process.
|
||||
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname main) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
|
||||
; 2018-11-21 - Made by Claudio Maggioni - Tommaso Rodolfo Masera
|
||||
|
||||
; easybf
|
||||
|
||||
; A Byte is an Int between 0 and 255
|
||||
; Interpretation: a byte in decimal notation.
|
||||
|
||||
; A Tape is a NEList<Byte>
|
||||
; Interpretation: a tape in brainf*ck's Turing machine.
|
||||
|
||||
; A DataPointer (DP) is a NonNegInt
|
||||
; Interpretation: an data pointer in the brainf*ck language in a tape.
|
||||
|
||||
; A Program is a String of:
|
||||
; - ">"
|
||||
; - "<"
|
||||
; - "+"
|
||||
; - "-"
|
||||
; - "."
|
||||
; - ","
|
||||
; - "["
|
||||
; - "]"
|
||||
; Interpretation: the brainf*ck program.
|
||||
|
||||
; A InstructionPointer (IP) is a NonNegInt
|
||||
; Interpretation: a pointer to the instruction to execute.
|
||||
|
||||
; A World is a (make-world tape dp output program ip) where:
|
||||
; - tape: Tape
|
||||
; - dp: DataPointer
|
||||
; - output: String
|
||||
; - program: Program
|
||||
; - ip: InstructionPointer
|
||||
; Interpretation: the current state of execution of a brainf*ck program.
|
||||
(define-struct world [tape dp output program ip])
|
||||
|
||||
; Template function for World
|
||||
(define (fn-for-world w)
|
||||
(... (world-tape w)
|
||||
(world-dp w)
|
||||
(world-output w)
|
||||
(world-program w)
|
||||
(world-ip w)))
|
||||
|
||||
; TODO:
|
||||
; - read-file: FileName -> String
|
||||
; - string->program: String -> Program (filter of valid instructions)
|
||||
; - program->world: Program -> World (compute initial world state)
|
||||
; - big-bang:
|
||||
; - - - - - - inital state (make-world (list 0) 0 "" <program> 0)
|
||||
; - - - - - - on-tick fetch, decode, execute
|
||||
; - - - - - - on-key for ","
|
||||
; - - - - - - (on-mouse for stepper)
|
||||
; - - - - - - (draw-scene for output and tape)
|
Loading…
Reference in a new issue