about summary refs log tree commit diff stats
path: root/README.md
blob: df53a19bd3dfd3bf2cb4768659cded0bbe71f038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# CHICKEN-SCRATCH --- heredocs for CHICKEN

written by Case Duckworth <acdw@acdw.net> off an idea by evhan

Licensed under BSD-3.  See COPYING for details.

CHICKEN has "[Multiline string constants with embedded expressions][multiline]"
syntax, which is basically shell here-doc syntax but schemier and with a real
programming langugage to embed. evhan's [beaker tool][beaker] (which is great,
btw) uses this facility to do a quick-and-dirty templating for wiki generation.
I realized that I could use the same facility for the same kind of heredoc-style
templating I have done in various other SSGs like [unk][] and [vienna][], but
with scheme. Thus, CHICKEN-SCRATCH was born.

[multiline]: http://wiki.call-cc.org/man/5/Extensions%20to%20the%20standard#multiline-string-constant-with-embedded-expressions
[beaker]: https://git.sr.ht/~evhan/beaker
[unk]: https://git.acdw.net/unk/
[vienna]: https://git.acdw.net/vienna/

## Usage

### Library: `chicken-scratch`

`expand-string` is the main entry point to this module. It takes a string and
returns a string with all `#( ... )` forms expanded according to the CHICKEN
rules. `expand-port` is a port version of `expand-string`.

To enable truly invisible definitions within the expanded string, the `def`
macro is provided which performs a `set!` on its variables, then returns a
string guaranteed not to be in the input string, which is then filtered out
in the expanded string.

Finally, to enable CHICKEN-SCRATCH to be used in a shebang, if the first line
of the input string begins with `#!`, it's deleted from the input.

### Executable: `chicken-scratch`

Run `chicken-scratch FILENAME ...` on the command line.  In a future version I'll include a few compile flags and the ability to read from standard input.

## Installation

Running `make` in this directory will call `chicken-install -n`, leaving you with a `chicken-scratch` binary.  Run `make install` to install the program to `$PREFIX`, or `make chicken-install` to run `chicken-install` without the `-n` flag.  Or, you know, run those commands yourself.