pi

Pi is a scheme interpreter.

SYNOPSIS
pi [file] [arguments]

Pi executes ordinary read-eval-print loop if invoked without any arguments. It exits when expression (exit) is evaluated.
If invoked with command line arguments, pi considers the first argument as file name, and loads named file before entering read-eval-print loop. Subsequent arguments may be used to give parameters to application program. To get command line arguments from program, use global variable *invocation-arg* or procedure rp:command-line-arguments.

*invocation-arg* global variable
Initially, this holds command line arguments as a list. In interpreter pi, this list begins with first argument (loaded prorgram). In compiled program, this list begins with zeroth argument (name of load module). In any case, arguments to program begins from second element, so the same logic may be applied to retrieve command line arguments regardless to whether program is run under interpreter or is compiled.
Notice that this is a usual variable and may be assigned to change value at will.

(rp:command-line-arguments) procedure
Returns command line as a vector. This is a whole command line in any situation. No method is provided to change the value of this procedure, aside from overwriting the procedure itself.

EXAMPLE

$ cat arg.scm
(display "*invocation-arg* is               ")
(write *invocation-arg*)
(newline)
(display "rp:command-line-arguments returns ")
(write (rp:command-line-arguments))
(newline)
(exit)
$ pi arg.scm foo bar baz
*invocation-arg* is               ("arg.scm" "foo" "bar" "baz")
rp:command-line-arguments returns #("pi" "arg.scm" "foo" "bar" "baz")
$ pisc arg.scm
$ pisl arg
gcc -O2 -m486 -I/u/qfwfq/lib/rhizome -c arg.c
gcc -O2 -m486 -I/u/qfwfq/lib/rhizome -c a.c
gcc -L/u/qfwfq/lib/rhizome a.o arg.o -lrhzscm -lrhzpi -lrhizome -lm
$ ./a.out foo bar baz
*invocation-arg* is               ("./a.out" "foo" "bar" "baz")
rp:command-line-arguments returns #("./a.out" "foo" "bar" "baz")

pisc

Pisc is a scheme compiler that converts scheme program to program in C language.

SYNOPSYS
pisc -help
Outputs brief summary of command line syntax.
pisc [options] file
Converts file to program in C language.

OPTIONS

-module module-identifier
Gives module name module-identifier. Module name is a name you specify to pisl when creating executable. This must be a valid identifier in C language. Default is the name of source file without ".scm" suffix (if the file name had one.)
-output filename
Specifies file name of output. Defualt is module name with ".c" suffix.
-mpath dir
Add dir to search path of rp:use-macro-package. This option may be used multiple times.
-load filename
Loads named file into the environment of compiler befor reading source file. This may be used in the purpose of defining macros at compile time. This option may be used multiple times.

pisl

Pisl compiles programs in C language generated by pisc and links with run time libraries to generate executable file.

SYNOPSYS
pisl -help
Outputs brief summary of command line syntax.
pisl [options] module-specifier ...
Binds modules specified by module-specifier together and generates executable file.

OPTIONS

-cc cc-command-line
Specify command line of C compiler. Default is printed in the output of `pisl -help'.
-ld ld-command-line
Specify command line of linker. Default is printed in the output of `pisl -help'.
-nold
Supress execution of linker.
-nolib
Supress linking with default run time library. Default library specification is printed in the output of `pisl -help'.
-o filename
Specify the name of executable file generated. If this option is not specified, linker determines the name of executable.
-s filename
Specify the name of file that contains startup code (the code wich calls each initialization routines of linked modules.) This file will be the first modules passed to linker. Default is, if -o option is specified, the value of it prepended "s_" and appended ".c", "a.c" othewise.
-xm module
Omit specified standard module from executable. Module shall be one of the following.
expand Hygienic macro feature with syntax-case. Some syntaxes will change its behavior slightly if this is omitted, though this should not affect normal programs.
stdmacro Standard marcros. In rhizome/pi, basic syntax kyewords such as define, lambda are impremented as macros, so omitting stdmacro disables usage of them. If application has no feature to evaluate arbitrary expression specified at run time, you can safely omit this.
debugger Debugging features.
stdproc Built in procedures implemented in scheme code at rhizome/pi. Consult to the source to see what will be unusable if this is omitted :-) Debugger will be omitted automatically if stdproc is omitted.

This option may be used multiple times.
-aux string
Add string to the command line of linker. This may be used in the purpose of specifying a module wich is already in an object file. This option may be used multiple times.
Format of module-specifier

Specify names you specified at -module option to pisc as module-specifier.
If tha name of file which contains the module is not the module name appended ".c", specify the file name after ':'. If the module is already in object file, specify null string after ':' and specify object file using -aux option.

EXAMPLE
Assume creating a executable from source files x.scm, y.scm, z-0.scm. The following is one sample of compiling process.

pisc x.scm				# generates x.c
pisl -nold x				# generates x.o
pisc y.scm				# generates y.c
pisc -module zz -output z-0.c z-0.scm	# generates z-0.c with module name zz
pisl -aux x.o x: y zz:z-0.c		# generates executable
Running generated executable results in the same effact as loading each source files to the interpreter in the same sequence of module specification to pisl. In the above example, assuming the contents of a.scm is
	(load "x.scm")
	(load "y.scm")
	(load "z-0.scm")
the result will be same with doing
	pi a.scm [arguments]
If compiled program is written to accomplish (exit) after some uninteractive operation, resulting executable will be an uninteractive program. On the other hand, compiling program which only includes some definitions of procedures, resulting executable will be a scheme interpreter extended with the predefined procedures. Note, however, if you want the same behaviour with pi, namely loading its first argument, you must describe such behaviour in your program (linking with pi/interprt/pi.pi is sufficient. In fact, pi itself can be reprodeced by "pisc -module pi pi.pi; pisl -o pi pi".)
indexes