-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcowgirl.scm
44 lines (40 loc) · 1.34 KB
/
cowgirl.scm
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; C O W G I R L ;;;
;;; or ;;;
;;; I N V A D E R ;;;
;;; ;;;
;;; 2016-01-03, drcz@o2.pl ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cond-expand
(gambit
(include "match.scm")
(include "srfi-excerpts.scm")
(define quit exit)
(define (iota n) (let loop ((i 0)) (if (< i n) (cons i (loop (+ i 1))) '()))))
(guile-2
(use-modules (ice-9 match)
(ice-9 pretty-print)
(srfi srfi-1))))
(include "preamble.scm")
(include "meta-sex.scm")
(include "abstract-eval.scm")
(include "configurations.scm")
(include "drive.scm")
(include "finalize.scm")
(let* ((pr (read)) ;; the code
(mstore (read)) ;; initial store's description <- TODO maybe get just the descriptions for each input, hm?
(init-pp (cadr pr))
(blockmap (cddr pr))
(process-tree (specialize #;drive
(mk-node (mk-config init-pp mstore) 'OPEN '())
blockmap))
(new-blockmap (finalize process-tree))
;; NB assumes first block in new-blockmap is the root, ie you know, init.
(new-init (caar new-blockmap))
(new-input-vars (map mvar->symbol (gather-all-cvars mstore)))
(new-program `(,new-input-vars
,new-init
. ,new-blockmap)))
(pretty-print new-program))
(quit)