Burgercamp
Jump to navigation
Jump to search
Burgercamp is an accumulator-based output-only esoteric programming language based on Deadfish.
Commands
i increments 7 d decrements 3 m multiplies by 5 o outputs number
Strange behaviour of m
The number 25 should turn into 0, like Deadfish turning 256 into 0. That means that:
ididdm
Should turn into 0.
Interpreter tests
ididdmo
Should output 0,
iiiiiimo
Should output 210, and
iiidiiidmo
Should output 55.
Interpreter
The following implementation is realized in the language Common Lisp:
(defun interpret-Burgercamp (&optional (initial-code "" initial-code-supplied-p)) "Launches the Burgercamp accumulator, contingently commencing with the INITIAL-CODE, and repeatedly queries the standard input for commands, until a completely empty line of length zero is issued, finally returning no value." (declare (type string initial-code)) (declare (type T initial-code-supplied-p)) (let ((accumulator 0)) (declare (type integer accumulator)) (flet ((process-commands (commands) (declare (type string commands)) (loop for command of-type character across commands do (case command (#\i (incf accumulator 7)) (#\d (decf accumulator 3)) (#\m (setf accumulator (* accumulator 5))) (#\o (format T "~d " accumulator)) (otherwise (terpri))) (when (= accumulator 25) (setf accumulator 0))) (values))) (loop initially (when initial-code-supplied-p (process-commands initial-code)) for input of-type (or null string) = (prog2 (format T "~&>> ") (read-line *standard-input* NIL "") (clear-input)) until (or (null input) (zerop (length input))) do (process-commands input)))) (values))