vx-scheme

A Scheme interpreter for VxWorks.

[ Home ]

Download

The easy-to-build source distribution is available here:

You can contact me at scheme@colin-smith.net with any questions or observations. For all I know, I'm the only person out there who's interested in Scheme and VxWorks simultaneously. If you are too, drop me a note!

Installation Notes

For VxWorks:

Just unpack the archive anywhere you like. A Tornado workspace containing two projects is provided in tornado/vx-scheme.wsp. The first project, "target-shell", will build a VxSim executable that has enough C++ features selected to host the Scheme interpreter. The second is the interpreter itself. Build them both.

Note: For the present, vx-scheme only runs on the target shell: starting it from windsh will only confuse things.

Start the simulator you just built. Once it's launched you can use a script in ../startup that will load the Scheme image. (The startup script is in the parent directory of the directory where the sim starts in case you define new builds on your own.)

-> <../startup
cd "../../vx-scheme/SIMNTgnu"
value = 0 = 0x0
ld < vx-scheme.out
value = 30727944 = 0x1d4df08 = _dtors + 0x14
cd "../../../testcases"
value = 0 = 0x0
->

For UNIX:

For UNIX-like systems (FreeBSD, Cygwin, etc.) there's an ordinary Makefile in the unix directory of the distribution. Just say make or gmake (whatever it takes to launch GNU make on your system) in that directory. This will build a "vx-scheme" executable configured for use on your host system. I've tested the build on GCC versions 2.95.x and 3.2 (for both Cygwin and FreeBSD).

Test Suite

For VxWorks:

To run the test suite on VxWorks, follow the installation steps above and then, in your simulator window, do

-> scheme
=> 

The prompt changes to => when reading Scheme expressions. The startup script set the working directory to the place where the test suite lies so now we need only say:

=> (load "vx-test.scm")
PASS: pi
PASS: sieve
PASS: cf
PASS: r4rstest
PASS: series
PASS: ack

Note: Running the test suite defines a lot of symbols. In particular, "i" is defined, which masks the VxWorks definition. It's probably best to ^X the simulator and start over after running the suite.

For UNIX:

To run the test suite for UNIX: after building with make (or gmake) in the unix directory, just go to the "testcases" directory and run the "./runtest" shell script found there.

Note: The "good" files are slightly different for VxWorks: in that case, expected to fail the "mult-float-print-test" on VxWorks and the "good" file contains these failures, so the suite will "pass". But as explained elsewhere we just take what the native I/O system gives us.

To-Do List

I don't know if I'll try any of these things, but there numerous ways this code could be improved.

  • Make it more of a "real" shell

    (this involves allowing for editing keys, ctrl-C, etc.).

  • Choose a reentrancy model and implement it.

    The most fun one would let VxWorks tasks carry Scheme continuations. Such a system could be used to model distributed systems. This would just involve protecting the system table from concurrent access and wiring up a few multitasking and communication primitives.

  • Make the "magic cell" thunking method work on UNIX.

    It might make sense to allow for calling functions with struct* arguments by using an analogue of Perl's "pack" technique. Such a system would allow vx-schemes on different hosts to exchange information with sockets.

  • Byte-code or IL compilation

    It might be interesting to pursue the byte-code generation model that SICP proposes. Vx-scheme is currently a pure interpreter; it processes syntax through every iteration of a loop, for example. It's not easy to determine where the biggest speedup would lie!

Copyright © 2002 Colin Smith.