File: theme-d-pcode-common.scm

package info (click to toggle)
theme-d 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 12,784 kB
  • sloc: lisp: 47,684; sh: 4,200; makefile: 455; ansic: 319
file content (48 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;; Copyright (C) 2008-2013 Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.


;; *** Pseudocode common ***


(import (rnrs exceptions)
	(srfi srfi-1)
	(th-scheme-utilities stdutils)
	(th-scheme-utilities hrecord))


(define (parse-address module decl)
  (assert (= (length decl) 5))
  (assert (eqv? (car decl) 'address))
  (let* ((mod1 (list-ref decl 1))
	 (mod
	  (cond
	   ((not mod1) #f)
	   ((not-null? mod1) mod1)
	   (else module))))
    (make-hrecord
     <address>
     mod
     (list-ref decl 2)
     (list-ref decl 3)
     (list-ref decl 4))))


(define (theme-compile-address address)
  (assert (hrecord-is-instance? address <address>))
  `(address
    ,(hfield-ref address 'module)
    ,(hfield-ref address 'number)
    ,(hfield-ref address 'source-name)
    ,(hfield-ref address 'toplevel?)))


(define (parse-type-variable module tvar)
  (let ((r-address (parse-address module tvar)))
    (make-type-variable r-address)))


(define (parse-type-variables module type-vars)
  (map (lambda (tvar) (parse-type-variable module tvar))
       type-vars))