Deadfuck
Jump to navigation
Jump to search
Introduction
Beadfuck is brainfuck without the - instruction and other instructions are replaced with DFS's instructions, but still works like brainfuck.
This esolang is created by User:None1.
Instructions
Deadfuck brainfuck i + d , s . o < O > l [ L ]
Example Programs
Hello World
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisiiiiiiiiiiiiiiiiiiiiiiiiiiii ii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iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Cat Program
ildsL
Truth-machine
The following truth-machine example exploits the wrapping of the octet-valued cells at the extrema in its pursuit to simulate the decrementing operation's lacuna:
Oiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii od s iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiii lOsoL
Interpreter
Common Lisp
A simple implementation in Common Lisp follows:
(defun build-jump-table () "Builds a jump table which connects the matching forward jump (\"l\") and back jump (\"L\") points in the CODE, stores these in the JUMP-TABLE, and returns ``NIL." (declare (special code) (special jump-table)) (clrhash jump-table) (loop :with start-points :of-type list := NIL :for position :of-type fixnum :from 0 :below (length code) :if (char= (char code position) #\l) :do (push position start-points) :else :if (char= (char code position) #\L) :do (let ((end-point (or (pop start-points) (error "Unterminated jump end.")))) (declare (type fixnum end-point)) (setf (gethash position jump-table) end-point (gethash end-point jump-table) position)) :finally (when start-points (error "Unterminated jump starts.")))) (defun interpret-Deadfuck (code &aux (jump-table (make-hash-table :test #'eql))) "Interprets the piece of Deadfuck source CODE and returns ``NIL." (declare (special code) (special jump-table) (type string code) (type hash-table jump-table)) (build-jump-table) (let ((memory (make-hash-table :test #'eql)) (cell-pointer 0)) (declare (type hash-table memory) (type integer cell-pointer)) (flet ((current-cell () (the (unsigned-byte 8) (gethash cell-pointer memory 0))) ((setf current-cell) (new-value) (declare (type integer new-value)) (the (unsigned-byte 8) (setf (gethash cell-pointer memory 0) (mod new-value 256))))) (loop :with ip :of-type fixnum := 0 :while (< ip (length code)) :do (case (char code ip) (#\i (incf (current-cell))) (#\d (setf (current-cell) (char-code (read-char *standard-input* NIL 0))) (clear-input)) (#\s (write-char (code-char (current-cell)))) (#\o (decf cell-pointer)) (#\O (incf cell-pointer)) (#\l (when (zerop (current-cell)) (setf ip (gethash ip jump-table)))) (#\L (unless (zerop (current-cell)) (setf ip (gethash ip jump-table)))) (otherwise NIL)) (incf ip)))))