mes: resurrect running MesCC: update info interface.
* module/language/c99/info.mes (type?, global?, local?): New function. (make-global): Remove name parameter. * module/nyacc/lang/c99/pprint.mes: New file.
This commit is contained in:
parent
761ea8b23f
commit
448b167c09
1
make.scm
1
make.scm
|
@ -551,6 +551,7 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
|
||||||
"module/nyacc/lalr.mes"
|
"module/nyacc/lalr.mes"
|
||||||
"module/nyacc/lang/c99/cpp.mes"
|
"module/nyacc/lang/c99/cpp.mes"
|
||||||
"module/nyacc/lang/c99/parser.mes"
|
"module/nyacc/lang/c99/parser.mes"
|
||||||
|
"module/nyacc/lang/c99/pprint.mes"
|
||||||
"module/nyacc/lang/calc/parser.mes"
|
"module/nyacc/lang/calc/parser.mes"
|
||||||
"module/nyacc/lang/util.mes"
|
"module/nyacc/lang/util.mes"
|
||||||
"module/nyacc/lex.mes"
|
"module/nyacc/lex.mes"
|
||||||
|
|
|
@ -96,22 +96,24 @@
|
||||||
(cons <continue> continue)))))
|
(cons <continue> continue)))))
|
||||||
|
|
||||||
(define (make-type type size pointer description)
|
(define (make-type type size pointer description)
|
||||||
(list type size pointer description))
|
(list 'type* type size pointer description))
|
||||||
|
(define (type? o) (and (pair? o) (eq? (car o) 'type*)))
|
||||||
|
(define type:type cadr)
|
||||||
|
(define type:size caddr)
|
||||||
|
(define type:pointer cadddr)
|
||||||
|
(define caddddr (compose cadddr cdr))
|
||||||
|
(define type:description caddddr)
|
||||||
|
|
||||||
(define type:type car)
|
(define (make-global type pointer value)
|
||||||
(define type:size cadr)
|
(list 'global* type pointer value))
|
||||||
(define type:pointer caddr)
|
(define (global? o) (and (pair? o) (eq? (car o) 'global*)))
|
||||||
(define type:description cadddr)
|
(define global:type cadr)
|
||||||
|
(define global:pointer caddr)
|
||||||
(define (make-global name type pointer value)
|
(define global:value cadddr)
|
||||||
(cons name (list type pointer value)))
|
|
||||||
|
|
||||||
(define global:type car)
|
|
||||||
(define global:pointer cadr)
|
|
||||||
(define global:value caddr)
|
|
||||||
|
|
||||||
(define (make-local type pointer id)
|
(define (make-local type pointer id)
|
||||||
(list type pointer id))
|
(list 'local* type pointer id))
|
||||||
(define local:type car)
|
(define (local? o) (and (pair? o) (eq? (car o) 'local*)))
|
||||||
(define local:pointer cadr)
|
(define local:type cadr)
|
||||||
(define local:id caddr)
|
(define local:pointer caddr)
|
||||||
|
(define local:id cadddr)
|
||||||
|
|
38
module/nyacc/lang/c99/pprint.mes
Normal file
38
module/nyacc/lang/c99/pprint.mes
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
;;; -*-scheme-*-
|
||||||
|
|
||||||
|
;;; Mes --- Maxwell Equations of Software
|
||||||
|
;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
;;;
|
||||||
|
;;; 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/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(mes-use-module (mes guile))
|
||||||
|
(mes-use-module (mes optargs))
|
||||||
|
;;(mes-use-module (srfi srfi-1))
|
||||||
|
;;(mes-use-module (nyacc lang util))
|
||||||
|
;;(mes-use-module (sxml match))
|
||||||
|
;;(mes-use-module (mes pretty-print))
|
||||||
|
|
||||||
|
;;(include-from-path "nyacc/lang/c99/pprint.scm")
|
||||||
|
|
||||||
|
;; mes does not have (sxml match), short-circuit me
|
||||||
|
(define* (pretty-print-c99 tree
|
||||||
|
#:optional (port (current-output-port))
|
||||||
|
#:key ugly per-line-prefix (basic-offset 2))
|
||||||
|
(write tree port))
|
Loading…
Reference in a new issue