[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
31.3.2 Lazy compilation with SRFI-22
SRFI-22 can be used to implement lazy compilation. For instance, let us consider the following shell script:
$ cat > bgl #!/bin/sh SOURCEFILE=$1 case $SOURCEFILE in *.scm) OUTFILE=${SOURCEFILE%.scm} if ( bigloo -s -o $OUTFILE $SOURCEFILE ); then /bin/rm $OUTFILE.o shift ./$OUTFILE $@ fi ;; *) echo Error: need a \*.scm file! ;; esac
And the following Bigloo script:
#! /usr/bin/env ./bgl (module foo (main main)) (define (main argv) (print "foo: " argv))
When executed in the following way:
$ chmod u+x foo.scm $ ./foo.scm -| foo: (./foo.scm)
The Bigloo module foo.scm
will first be compiled and then executed.
Of course, one may consider more complex compiler drivers where it is
first checked that the module is not already compiled.
This document was generated on March 31, 2014 using texi2html 5.0.