1# purescm - Chez Scheme backend for PureScript
7* [`chezscheme`](https://cisco.github.io/ChezScheme/) - you should have the `scheme` command available in your `$PATH`.
8* [`libpcre2`](https://pcre2project.github.io/pcre2/) - `purescm` has a runtime dependency on the 16-bit variant of pcre2. Check your package manager for `pcre2` or `pcre2-16` or similar.
9* [`icu`](https://icu.unicode.org/) - `libicu` is used for locale-aware case conversions.
11You can install purescm with npm:
19The best way to use `purescm` is to use the [spago](https://github.com/purescript/spago) integration for alternative PureScript backends. In `spago.yaml` use the `backend` config like so:
29Then to compile your `purescm` project you can run:
35This will produce output under `output/`. You can run the compiled program with:
43Scheme files can be precompiled to a single Chez program:
49which generates a single file `output/main` which can be run with `scheme` or `petite`:
52scheme --program output/main
59To run all tests, run `npm run test`. This will run both the scheme runtime unit tests and the snapshot tests.
61To overwrite old snapshots with the latest output, run `npm run test -- -a "--accept"`.
62To add a new snapshot, create a file called `Snapshot.X.purs` where `X` indicates what is being tested.
63If a snapshot needs a dependency, install it by running `cd test-snapshots && spago install <packages...>`.
65### Vendored Dependencies
67In order to represent `Array` and record types in `purescm`, the backend has a runtime dependency on implementation of SRFI 214 (Flexvectors). This is due in part to how [vectors](https://cisco.github.io/ChezScheme/csug9.5/objects.html#./objects:h5) are more like "arrays" than "array lists".
69We vendor [chez-srfi](https://github.com/arcfide/chez-srfi) using the following steps:
711. Clone `chez-srfi` at the project root.
732. Navigate to `chez-srfi` and run `./install.chezscheme.sps ../lib`.
753. To verify, simply invoke the Scheme REPL:
77$ scheme --libdirs ./lib:
78Chez Scheme Version 9.5.8
79Copyright 1984-2022 Cisco Systems, Inc.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list