;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.excosy) ;;;;;; ;;; object (def class* object () ((name :type string :documentation "A unique name of this object.") (reader-function :type symbol :documentation "A function that reads an instance of this object from a sequence of characters.") (printer-function :type symbol :documentation "A function that prints an instance of this object into a sequence of characters.") (interpreter-function :type symbol :documentation "") (memory-location-function :type symbol :documentation "A function that provides the memory location for an instance of this object.")) (:documentation "Objects are the most basic building blocks in the system. In fact, everything is an object.")) ;;;;;; ;;; value-type (def class* value-type () ((name :type symbol) (reader-function :type symbol) (printer-function :type symbol) (interpreter-function :type symbol) (memory-location-allocator-function :type symbol))) (def class* actual-value () ((value-type :type value-type) (memory-location :type integer))) (def function make-value-type (name) (make-instance 'value-type :name name :reader-function (format-symbol :hu.dwim.excosy "READ-~A" name) :printer-function (format-symbol :hu.dwim.excosy "PRINT-~A" name) :interpreter-function (format-symbol :hu.dwim.excosy "INTERPRET-~A" name) :memory-location-allocator-function (format-symbol :hu.dwim.excosy "INTERPRET-~A" name))) (def function make-value-type/nothing () (make-value-type 'boolean)) (def function make-value-type/boolean () (make-instance 'value-type :reader-function :printer-function :interpreter-function :memory-location-allocator-function)) (def function make-value-type/native-integer () (make-instance 'value-type :reader-function 'read-native-integer :printer-function 'print-native-integer :interpreter-function 'interpret-native-integer :memory-location-allocator-function)) (def function make-value-type/tagged-integer () (make-instance 'value-type :reader-function :printer-function :interpreter-function :memory-location-allocator-function))