Changeset 12784 in project for release/3/nemo/trunk/nemo-utils.scm


Ignore:
Timestamp:
12/05/08 08:36:44 (13 years ago)
Author:
Ivan Raikov
Message:

Completed functor code; some bug fixes in code generator identifier names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/nemo/trunk/nemo-utils.scm

    r12685 r12784  
    3434(declare
    3535 (lambda-lift)
    36  (export  lookup-def binding? bind
    37           enum-bnds enum-freevars sum subst-term
     36 (export  lookup-def enum-bnds enum-freevars sum
    3837          if-convert let-enum let-elim let-lift
    3938          s+ sw+ sl\ nl spaces ppf
     
    7776             ((x . rest) `(+ ,x ,(sum rest))))))
    7877
    79 
    80 (define (subst-term t subst k)
    81   (match t
    82          (('if c t e)
    83           `(if ,(k c subst) ,(k t subst) ,(k e subst)))
    84 
    85          (('let bs e)
    86           (k `(let ,(map (lambda (b) `(,(car b) ,(k (cadr b) subst))) bs) ,(k e subst))
    87              subst))
    88 
    89          ((f . es)
    90           (cons (k f subst) (map (lambda (e) (k e subst)) es)))
    91 
    92          ((? symbol? )  (lookup-def t subst t))
    93 
    94          ((? atom? ) t)))
    95 
    96 (define (binding? t) (and (list? t) (eq? 'let (car t)) (cdr t)))
    97 
    98 (define (bind ks vs e) `(let ,(zip ks vs) ,e))
    9978
    10079(define (if-convert expr)
     
    164143
    165144(define (transitions-graph n open transitions state-name)
    166   (let* ((subst-convert  (subst-driver (lambda (x) (and (symbol? x) x)) binding? identity bind subst-term))
     145  (let* ((subst-convert  (subst-driver (lambda (x) (and (symbol? x) x))
     146                                       nemo:binding? identity nemo:bind nemo:subst-term))
    167147         (g          (make-digraph n (string-append (->string n) " transitions graph")))
    168148         (add-node!  (g 'add-node!))
     
    220200
    221201(define (state-lineqs n transitions lineqs state-name)
    222   (let* ((subst-convert  (subst-driver (lambda (x) (and (symbol? x) x)) binding? identity bind subst-term))
     202  (let* ((subst-convert  (subst-driver (lambda (x) (and (symbol? x) x))
     203                                       nemo:binding? identity nemo:bind nemo:subst-term))
    223204         (state-list     (let loop ((lst (list)) (tlst transitions))
    224205                           (if (null? tlst)  (delete-duplicates lst eq?)
Note: See TracChangeset for help on using the changeset viewer.