The easiest way to use the pregexp code is to simply load the
file pregexp.scm into your Scheme.
If you use Common Lisp, load pregexp.lisp.
Alternatively, if your Scheme dialect is either PLT Scheme, Gauche, Guile, or Scsh, you can exploit your dialect’s module facility. A module-ized pregexp has two advantages:
-
It makes the interface to the pregexp code cleaner, as the module hides implementation details and avoids polluting the global namespace.
-
Portions of the pregexp code are rewritten to take advantage of the dialect’s extensions.
Use the scmxlate package to configure pregexp for these dialects. scmxlate is available from https://github.com/ds26gte/scmxlate.
Start Scheme in the pregexp directory, and load the file
scmxlate/scmxlate.scm, using the correct relative or full
pathname. You will be asked your Scheme dialect’s name: answer
plt, gauche, guile, or scsh as appropriate.
For PLT, the generated file is pregexp.ss, which can be loaded
using the require syntax. If you place pregexp.ss in a standard
PLT library location, you can load it with
(require (lib "pregexp.ss"))
without worrying about its pathname.
For Gauche, the generated file is gauchelib/pregexp.scm. If you
place it in one of the directories in *load-path*, you can do
(use pregexp)
without worrying about its pathname.
For Guile, the generated file is ice-9/pregexp.scm (i.e., the file
pregexp.scm in the subdirectory ice-9). If you place
pregexp.scm in an ice-9 subdirectory in your
%load-path, you can load it with
(use-modules (ice-9 pregexp))