Translated Common Lisp

From Esolang
Jump to navigation Jump to search

Step 1:

(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))

Step 3:

(Disable comment-bergerkamp (and optional (source code""
The specified source code is P))
"Launch burgercamp if necessary
   Standard command input for entering and re-querying source code
Until a completely empty zero-length string is returned, finally
The value is not returned."
(Ads (enter the initial line of code))
(Ad (enter t, enter source code P))
((Battery 0))
(Ads (input integer disk))
(Run (edit command
(Report (enter a string command))
(Enter a sequence of command-type characters in the do command
(
Command (#\m (incf7 disk))
(#\D (decf3 disk))
(#\M (setfdrive (*Drive5))).
                (#\O (disk format "~d"))
(Otherwise (allow)))
              (When (=disk 25
(Installation disk 0)))
            (Consumption)))
      (Cycle
        For the first time
          (When entering the source code-P
            (Source code of the processing command).
Introduction
          Enter (or an empty string)
= (Program 2
                    (Format "~ & > > " t)
(Reading the string * standard input * null"").
(Actual introduction))
(Or (input null) (null (long input))).
        Do (entering the processing command))))
(Cost)).