A collection of example programs in Pre-Scheme

Andrew Whatson 8ed1788b54 Tidy up prime-sum demo преди 1 седмица
include 6a8db54831 Add game-of-life demo with ps-grid, ps-sdl2 libs преди 1 седмица
lib abe7797747 Add vector-fill! and ensure tail-calls преди 1 седмица
.dir-locals.el 4e376f986a Add a basic record demo преди 1 година
.envrc 1426f12be4 Improve the build system using Guix and Make преди 1 година
.gitignore 0633492526 Add prime-sum demo преди 1 седмица
COPYING febe0e7ae6 Add a license, BSD-3 just like Scheme 48 преди 1 година
Makefile b467af91e2 Build executables with -O2 преди 1 седмица
README.org 0633492526 Add prime-sum demo преди 1 седмица
append.c 93fdd02467 Update generated C sources преди 1 седмица
append.scm 1f1a9239df Add another demo, more advanced packages, generated code examples преди 1 година
btree.c 93fdd02467 Update generated C sources преди 1 седмица
btree.scm d7e7829fee Fix btree-equal? for eq? case преди 1 година
game-of-life.c 051dd62a37 Add generated C source for game-of-life преди 1 седмица
game-of-life.scm 6a8db54831 Add game-of-life demo with ps-grid, ps-sdl2 libs преди 1 седмица
hello.c 93fdd02467 Update generated C sources преди 1 седмица
hello.scm 1f1a9239df Add another demo, more advanced packages, generated code examples преди 1 година
manifest.scm 28993666bc Add missing texinfo dependency for scheme48-prescheme преди 1 седмица
packages.scm 8ed1788b54 Tidy up prime-sum demo преди 1 седмица
prime-sum.c 8ed1788b54 Tidy up prime-sum demo преди 1 седмица
prime-sum.scm 8ed1788b54 Tidy up prime-sum demo преди 1 седмица
recfun.c 93fdd02467 Update generated C sources преди 1 седмица
recfun.scm 4e376f986a Add a basic record demo преди 1 година
vecfun.c 02ff504123 Update generated C for vecfun преди 1 седмица
vecfun.scm 7821441213 Automate calling of static init procedures преди 7 месеца

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-utils.scm - utility macros
  • lib/ps-string.scm - string utility functions
  • lib/ps-vector.scm - vector functions based on SRFI-43
  • lib/ps-grid.scm - an ASCII grid data-type
  • lib/ps-sdl2.scm - minimal SDL2 bindings
  • 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
  • game-of-life.scm - Conway's Game of Life in Pre-Scheme with SDL2
  • prime-sum.scm - Sum of primes using Sieve of Eratosthenes

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://codeberg.org/prescheme/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.