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:
Jan Nieuwenhuizen 2017-11-20 23:17:50 +01:00
parent 761ea8b23f
commit 448b167c09
3 changed files with 57 additions and 16 deletions

View file

@ -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/lang/c99/cpp.mes"
"module/nyacc/lang/c99/parser.mes"
"module/nyacc/lang/c99/pprint.mes"
"module/nyacc/lang/calc/parser.mes"
"module/nyacc/lang/util.mes"
"module/nyacc/lex.mes"

View file

@ -96,22 +96,24 @@
(cons <continue> continue)))))
(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 type:size cadr)
(define type:pointer caddr)
(define type:description cadddr)
(define (make-global name type pointer value)
(cons name (list type pointer value)))
(define global:type car)
(define global:pointer cadr)
(define global:value caddr)
(define (make-global type pointer value)
(list 'global* type pointer value))
(define (global? o) (and (pair? o) (eq? (car o) 'global*)))
(define global:type cadr)
(define global:pointer caddr)
(define global:value cadddr)
(define (make-local type pointer id)
(list type pointer id))
(define local:type car)
(define local:pointer cadr)
(define local:id caddr)
(list 'local* type pointer id))
(define (local? o) (and (pair? o) (eq? (car o) 'local*)))
(define local:type cadr)
(define local:pointer caddr)
(define local:id cadddr)

View 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))