A collection of libraries and programs written for Chez Scheme.
libs folder contains a number of repackaged libraries, SRFIs and R7RS-large libraries, plus some new libraries under the
robin subfolder. For more on these, see the documentation here.
There are two moderately interesting programs here:
ferretis a trigram-based tool for detecting similarity in groups of text documents or program code.
procjavais an interpreter for a procedural subset of Java syntax. The
examplessubfolder illustrates the accepted syntax.
At the top level is a bash script, named 'chez'. This is a convenience script I use for building and testing Scheme programs.
To use the script, copy it to somewhere on your PATH and make it executable. Edit the two variables at the top:
CHEZBINis the path to the scheme executables. It should be on your PATH. Installed programs will end up here, and can be called from the command-line.
CHEZLIBSis the path to the folder containing your libraries. Currently, I simply point this at the 'libs' folder in this repository.
How to use the script?
$ chez help chez is a script to help run/compile/test Chez Scheme source code. Usage: chez command [filename] Commands: clean deletes compiled files in current directory and libraries compile filename compiles the program "filename" and dependent files help this message install filename compiles and installs the program "filename" into bin/ run filename runs the given filename test [filename] runs all test files "NAME-test.ss", or the given filename version prints Chez Scheme version
For example, using the
procjava program, we could run all the tests in this and child folders:
$ cd procjava $ chez test %%%% Starting test lexer (Writing full log to "lexer.log") # of expected passes 89 %%%% Closing log file %%%% Starting test parser (Writing full log to "parser.log") # of expected passes 121 %%%% Closing log file
We can then run the parser on an example program:
$ chez run procjava.ss examples/hello.java Running: examples/hello.java Hello World
Finally, let's install the interpreter as a standalone program; this step compiles the program into a .prg file, and creates a script to call it, copying both to your CHEZBIN folder.
$ chez install procjava.ss compiling procjava.ss with output to procjava.so compiling lib/interpreter.sls with output to lib/interpreter.so compiling lib/lexer.sls with output to lib/lexer.so compiling lib/parser.sls with output to lib/parser.so creating executable script: bin/procjava $ ls -l ~/Software/bin/procjava* -rwxrwxr-x 1 peter peter 62 Nov 27 23:23 /home/peter/Software/bin/procjava -rw-rw-r-- 1 peter peter 81420 Nov 27 23:23 /home/peter/Software/bin/procjava.prg
The program can now be called from the command line:
$ cd examples $ procjava hello.java Running: hello.java Hello World
- Chez Scheme requires the libraries to be added to a .prg file in a sorted order, based on dependency (any required library must be added before the current one). This order is not respected in the script.
- CHEZLIBS in the script only holds one library path. The script could instead use CHEZSCHEMELIBDIRS.
Clone and view this fossil repository using the following commands:
$ fossil clone https://chiselapp.com/user/pcl/repository/chez-code chez-code.fossil $ mkdir chezcode_folder $ cd chezcode_folder $ fossil open ../chez-code.fossil $ ls ... shows all the files $ fossil ui ... opens the repository in your browser
Peter Lane (email@example.com)