code/packages.lisp (2012 bytes)
1 ;;; The MIT License (MIT) 2 ;;;; Copyright (c) 2016 Spenser Truex 3 ;;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this brainfuck software and associated documentation files (the "Brainfuck Software"), to deal in the Brainfuck Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Brainfuck Software, and to permit persons to whom the Brainfuck Software is furnished to do so, subject to the following conditions: 4 5 ;;;; The above copyright notice and this permission notice shall be included in all copies or substantial portions of this Brainfuck Software. 6 7 ;;;; THE BRAINFUCK SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THIS BRAINFUCK SOFTWARE OR THE USE OR OTHER DEALINGS IN THIS BRAINFUCK SOFTWARE. 8 (in-package :cl-user) 9 (defpackage :brain 10 (:use :cl) 11 (:export :fuck ;Used to execute a brainfuck string directly 12 :*tape-size-default* ;Number of cells in the tape 13 :decf-byte ;The - operator 14 :incf-byte ;The + operator 15 :read-this-byte ;The , operator 16 :print-this-byte ;The . operator 17 :right-shift ;The > operator 18 :left-shift ;The < operator 19 20 ;;Function called to loop over each character in the code 21 :one-off-fuck 22 23 :*separators* ;Characters that terminate #F brainfuck code 24 25 ;; Returns the value of the current byte, most probably the one 26 ;; that the code finished executing over 27 :byte-value 28 29 :*tape* ;contains the entire byte tape. Useful to view contents. 30 :*pointer* ;The current position in the byte tape. Useful with byte-value 31 ))