1. Petite Chez Scheme
This page describes using Petite Chez Scheme at Bryn Mawr College.
To start up Petite Chez:
[yourid@bubo yourid]$ petite Petite Chez Scheme Version 6.0a Copyright (c) 1998 Cadence Research Systems >
The less-than symbol is Petite's prompt.
You can enter expressions at the prompt. Try some of these, and experiment:
Let's see some expressions that evaluate to themselves:
> 5 5 > 1265 1265 > a Error: variable a is not bound. Type (debug) to enter the debugger.
This last one shows that you can't type in letters, or any "word" that contains letters. You'll have to 'quote' it first:
> 'a a
What about more complex expressions:
> (+ 100 50) 150 > (* 3 4) 12 > (* (+ 7 8) 3) 45
Scheme uses prefix notation for expressions: the operator always comes first.
2. Emacs and Petite
Very quickly, you'll get tired of typing long expressions over and over inside Petite Scheme. To help this situation, we'll run Petite inside Emacs the editor.
To make this as easy as possible, create a file named .emacs (that's dot emacs) in your home directory, and put the following in the file:
;; Petite Scheme mode Starts here:
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "Switch to interactive Scheme buffer." t)
(setq auto-mode-alist (cons '("\\.ss" . scheme-mode) auto-mode-alist))
(custom-set-variables '(scheme-program-name "petite"))
;; Petite Scheme mode ends here
You can open the .emacs file with emacs, like this:
[yourid@bubo yourid]$ emacs .emacs
and paste the code in Emacs from this web browser. Save the file (C-x C-s) and exit from emacs. From now on, when you open a file that ends in .ss, it will automatically go into scheme-mode. In addition, you can run Scheme from inside Emacs with "Meta x run-scheme".
3. EOPL
When using Petite in Programming Languages, we may need some definitions from the book EOPL. These extensions can be found here:
http://dangermouse.brynmawr.edu/cs245/eopl.tgz
To use these, download them and untar them:
tar xfz eopl.tgz
This will create a directory named eopl. To use them:
% cd eopl
% petite
Petite Chez Scheme Version 6.0a
Copyright (c) 1998 Cadence Research Systems
> (load "chez-init.scm")
You then have access to define-datatype etc.
