+ (let ((bindings '()))
+ (define (create-binding! val)
+ "Create a new symbol, bind it to `val' and return it."
+ (let ((tmp-symbol (gen-lily-sym)))
+ (set! bindings (cons (cons tmp-symbol val) bindings))
+ tmp-symbol))
+ (define (remove-dollars! form)
+ "Generate a form where `$variable' and `$ value' mottos are replaced
+ by new symbols, which are binded to the adequate values."
+ (cond (;; $variable
+ (and (symbol? form)
+ (string=? (substring (symbol->string form) 0 1) "$")
+ (not (and (<= 2 (string-length (symbol->string form)))
+ (string=? (substring (symbol->string form) 1 2) "$"))))
+ (create-binding! (string->symbol (substring (symbol->string form) 1))))
+ (;; atom
+ (not (pair? form)) form)
+ (;; ($ value ...)
+ (eqv? (car form) '$)
+ (cons (create-binding! (cadr form)) (remove-dollars! (cddr form))))
+ (else ;; (something ...)
+ (cons (remove-dollars! (car form)) (remove-dollars! (cdr form))))))
+ (let ((lily-string (call-with-output-string
+ (lambda (out)