A collection of example programs in Pre-Scheme

Andrew Whatson 9cae221217 Mention recfun and btree in README пре 1 месец
lib bb2985632c Add zero-seed variant of vector-unfold пре 1 година
.dir-locals.el 4e376f986a Add a basic record demo пре 1 година
.envrc 1426f12be4 Improve the build system using Guix and Make пре 1 година
.gitignore db8a62a0a3 Add a btree example for recursive records пре 11 месеци
COPYING febe0e7ae6 Add a license, BSD-3 just like Scheme 48 пре 1 година
Makefile 46b4445399 Ensure vector routines are always inlined пре 1 месец
README.org 9cae221217 Mention recfun and btree in README пре 1 месец
append.c 5127d52168 Update generated C sources пре 1 месец
append.scm 1f1a9239df Add another demo, more advanced packages, generated code examples пре 1 година
btree.c 5127d52168 Update generated C sources пре 1 месец
btree.scm d7e7829fee Fix btree-equal? for eq? case пре 11 месеци
hello.c 5127d52168 Update generated C sources пре 1 месец
hello.scm 1f1a9239df Add another demo, more advanced packages, generated code examples пре 1 година
manifest.scm bf927dea2e Use clang-format to prettify generated C пре 1 месец
packages.scm db8a62a0a3 Add a btree example for recursive records пре 11 месеци
ps-init.h 7821441213 Automate calling of static init procedures пре 1 месец
recfun.c 5127d52168 Update generated C sources пре 1 месец
recfun.scm 4e376f986a Add a basic record demo пре 1 година
vecfun.c 46b4445399 Ensure vector routines are always inlined пре 1 месец
vecfun.scm 7821441213 Automate calling of static init procedures пре 1 месец

README.org

Pre-Scheme Demo Code

This repository contains some basic examples of Pre-Scheme code, and a simple Makefile for compiling these into native executables.

These examples are based on the one provided in "The Nearly Complete Scheme48 PreScheme Reference Manual" by Taylor Campbell: https://groups.scheme.org/prescheme/1.3/

Source files

  • packages.scm - package definitions
  • lib/ps-string.scm - string utility functions
  • lib/ps-vector.scm - vector functions based on SRFI-43
  • hello.scm - "Hello World" in Pre-Scheme, from the manual
  • append.scm - Yes, you can string-append in Pre-Scheme
  • vecfun.scm - Showing off Pre-Scheme polymorphism with vectors
  • recfun.scm - Simple demonstration of records (structs)
  • btree.scm - Example of a recursive record type

The generated C for each of the demo programs is also included, so you can review the code generation without needing to build anything.

How to build

The Guix manifest sets up all prerequisites for building the demos, and compilation is handled by the Makefile.

To build the demos yourself:


git clone https://notabug.org/flatwhatson/prescheme-demo.git
cd prescheme-demo
guix shell -m manifest.scm
make

License

This code is licensed under BSD-3-Clause, the same as Scheme 48 and the Pre-Scheme compiler. See COPYING for details.