mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
;;; -*-scheme-*-
|
|
|
|
|
|
|
|
;;; Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
;;; Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
;;;
|
|
|
|
;;; This file is part of Mes.
|
|
|
|
;;;
|
|
|
|
;;; Mes 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 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; Mes 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 Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
;;; info.scm defines [Guile] record data types for compiler.mes
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(define-module (language c99 info)
|
|
|
|
#:use-module (ice-9 optargs)
|
2017-07-14 19:26:35 +00:00
|
|
|
#:use-module (srfi srfi-9)
|
|
|
|
#:use-module (srfi srfi-9 gnu)
|
mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
#:export (<info>
|
|
|
|
make
|
2017-07-14 19:26:35 +00:00
|
|
|
make-<info>
|
mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
info?
|
|
|
|
|
|
|
|
.types
|
|
|
|
.constants
|
|
|
|
.functions
|
|
|
|
.globals
|
|
|
|
.locals
|
|
|
|
.function
|
|
|
|
.text
|
|
|
|
.break
|
2017-07-15 08:40:31 +00:00
|
|
|
.continue
|
|
|
|
|
2017-07-15 09:24:14 +00:00
|
|
|
make-type
|
|
|
|
type?
|
2017-07-15 08:40:31 +00:00
|
|
|
type:type
|
|
|
|
type:size
|
|
|
|
type:pointer
|
2017-07-15 09:24:14 +00:00
|
|
|
type:description
|
|
|
|
|
|
|
|
make-global
|
|
|
|
global?
|
|
|
|
global:type
|
|
|
|
global:pointer
|
2017-07-15 09:46:13 +00:00
|
|
|
global:value
|
|
|
|
|
|
|
|
make-local
|
|
|
|
local?
|
|
|
|
local:type
|
|
|
|
local:pointer
|
|
|
|
local:id))
|
mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
|
|
|
|
(cond-expand
|
|
|
|
(guile-2)
|
|
|
|
(guile
|
2018-01-03 07:33:55 +00:00
|
|
|
(use-modules (ice-9 syncase))
|
|
|
|
(use-modules (ice-9 optargs)))
|
2018-01-01 21:21:15 +00:00
|
|
|
(mes
|
2018-01-02 20:35:55 +00:00
|
|
|
(mes-use-module (mes optargs))))
|
mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
|
2017-07-14 19:26:35 +00:00
|
|
|
(define-immutable-record-type <info>
|
|
|
|
(make-<info> types constants functions globals locals function text break continue)
|
|
|
|
info?
|
|
|
|
(types .types)
|
|
|
|
(constants .constants)
|
|
|
|
(functions .functions)
|
|
|
|
(globals .globals)
|
|
|
|
(locals .locals)
|
|
|
|
(function .function)
|
|
|
|
(text .text)
|
|
|
|
(break .break)
|
|
|
|
(continue .continue))
|
mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it. (<info>, <types>,
<constants>, <functions>, <globals>, <locals>, <function>, <text>,
<break>, <continue>, make, info?, .info, .types, .constants,
.functions, .globals, .locals, .function, .text, .break, .continue):
Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-14 18:42:26 +00:00
|
|
|
|
|
|
|
(define* (make o #:key (types '()) (constants '()) (functions '()) (globals '()) (locals '()) (function #f) (text '()) (break '()) (continue '()))
|
2017-07-14 19:26:35 +00:00
|
|
|
(make-<info> types constants functions globals locals function text break continue))
|
2017-07-15 08:40:31 +00:00
|
|
|
|
|
|
|
(define-immutable-record-type <type>
|
|
|
|
(make-type type size pointer description)
|
|
|
|
type?
|
|
|
|
(type type:type)
|
|
|
|
(size type:size)
|
|
|
|
(pointer type:pointer)
|
|
|
|
(description type:description))
|
2017-07-15 09:24:14 +00:00
|
|
|
|
|
|
|
(define-immutable-record-type <global>
|
|
|
|
(make-global type pointer value)
|
|
|
|
global?
|
|
|
|
(type global:type)
|
|
|
|
(pointer global:pointer)
|
|
|
|
(value global:value))
|
2017-07-15 09:46:13 +00:00
|
|
|
|
|
|
|
(define-immutable-record-type <local>
|
|
|
|
(make-local type pointer id)
|
|
|
|
local?
|
|
|
|
(type local:type)
|
|
|
|
(pointer local:pointer)
|
|
|
|
(id local:id))
|