Tip for compiling small projects.

 new new list compose Reply to this message Top page
Attachments:
+ (text/plain)
+ (text/html)

Delete this message
Author: Kaz Kylheku
Date:  
To: TXR Users
Subject: Tip for compiling small projects.

Say you have little project with a file called main.tl, which looks like this:

(load "scanner")
(load "parser")
(load "logic")

(compile-only
  (startup-function))

Then this build script will compile it for you:

(flet ((comp (file)
         (if (compile-update-file file)
           (put-line `compiled @file.tl -> @file.tlo`))))
  (with-compilation-unit
    (comp "main")
    (with-stream (s (open-file "main.tl"))
      (whilet ((form (read s *stderr* nil)))
        (when-match (load @file) form
          (comp file))))))

Put that into a build.tl file and run with txr build.tl.

There is nothing to define anywhere; it looks for (load ...) forms in the file and compiles the indicated files.