diff options
author | Case Duckworth | 2024-06-05 09:21:25 -0500 |
---|---|---|
committer | Case Duckworth | 2024-06-05 09:21:25 -0500 |
commit | 423ac382f9e73bf1ca7fc6b400f98db087cd7d22 (patch) | |
tree | 1992e3dc7e71cd40eb7cdbc0b6d0c3cdf82c4332 /lib/main.scm | |
parent | Update README, add COPYING (diff) | |
download | jimmy-423ac382f9e73bf1ca7fc6b400f98db087cd7d22.tar.gz jimmy-423ac382f9e73bf1ca7fc6b400f98db087cd7d22.zip |
Write executable
This involved moving `src' to `lib' and making `bin'. `bin' holds the program, which only imports `jimmy.main' from lib.
Diffstat (limited to 'lib/main.scm')
-rw-r--r-- | lib/main.scm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/main.scm b/lib/main.scm new file mode 100644 index 0000000..b97d66a --- /dev/null +++ b/lib/main.scm | |||
@@ -0,0 +1,19 @@ | |||
1 | (declare (module (jimmy main))) | ||
2 | |||
3 | (import scheme (chicken base) | ||
4 | (chicken port) | ||
5 | (jimmy util) | ||
6 | (jimmy read) | ||
7 | (jimmy emit) | ||
8 | (jimmy wrap)) | ||
9 | |||
10 | (define-public (jimmy #!optional file template) | ||
11 | (parameterize ((current-input-port | ||
12 | (if file | ||
13 | (open-input-file file) | ||
14 | (current-input-port)))) | ||
15 | (let ((doc (parse)) | ||
16 | (post-proc (if template | ||
17 | (cut wrap-with <> template) | ||
18 | emit-string))) | ||
19 | (post-proc doc)))) | ||