File: primop.scm

package info (click to toggle)
scsh-0.6 0.6.7-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 15,124 kB
  • ctags: 16,788
  • sloc: lisp: 82,839; ansic: 23,112; sh: 3,116; makefile: 829
file content (33 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (6)
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
; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING.

; Primops.

(define-record-type primop :primop
  (make-primop name type closed compilator)
  primop?
  (name primop-name)
  (type primop-type)
  (closed primop-closed)
  (compilator primop-compilator))

(define-record-discloser :primop
  (lambda (primop)
    `(primop ,(primop-name primop))))

(define primop-table (make-symbol-table))

; This is used to add definitions of the primitives to a package.

(define (walk-primops proc)
  (table-walk (lambda (name primop)
		(proc name (primop-type primop) primop))
	      primop-table))

(define (define-compiler-primitive name type compilator closed)
  (table-set! primop-table
	      name
	      (make-primop name (or type value-type) closed compilator)))

(define (get-primop name)
  (or (table-ref primop-table name)
      (error "unknown compiler primitive" name)))