;;; -*-lisp-*- ;;; ;;; Code generator for effective methods ;;; ;;; (c) 2009 Straylight/Edgeware ;;; ;;;----- Licensing notice --------------------------------------------------- ;;; ;;; This file is part of the Simple Object Definition system. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; SOD is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with SOD; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (cl:in-package #:sod) ;;;-------------------------------------------------------------------------- ;;; Temporary names. ;;;-------------------------------------------------------------------------- ;;; Instructions. ;;;-------------------------------------------------------------------------- ;;; Instruction types. ;; Top level things. ;;;-------------------------------------------------------------------------- ;;; Code generator objects. (defgeneric emit-inst (codegen inst) (:documentation "Add INST to the end of CODEGEN's list of instructions.") (:method )) (defgeneric emit-insts (codegen insts) (:documentation "Add a list of INSTS to the end of CODEGEN's list of instructions.") (:method)) (defgeneric ensure-var (codegen name type &optional init) (:documentation "Add a variable to CODEGEN's list. The variable is called NAME (which should be comparable using EQUAL and print to an identifier) and has the given TYPE. If INIT is present and non-nil it is an expression INST used to provide the variable with an initial value.") (:method)) (defgeneric codegen-push (codegen) (:documentation "Pushes the current code generation state onto a stack. The state consists of the accumulated variables and instructions, i.e., what is representable by a BASIC-CODEGEN.") (:method)) (defgeneric codegen-pop (codegen) (:documentation "Pops a saved state off of the CODEGEN's stack. Returns the newly accumulated variables and instructions as lists, as separate values.") (:method)) (defgeneric codegen-add-function (codegen function) (:documentation "Adds a function to CODEGEN's list. Actually, we're not picky: FUNCTION can be any kind of object that you're willing to find in the list returned by CODEGEN-FUNCTIONS.") (:method )) ;;;-------------------------------------------------------------------------- ;;; Code generation idioms. ;;;----- That's all, folks --------------------------------------------------