xyzzy
2010-12-11
Introduction
This program is about as simple as it gets. It shows what a basic program looks like, and can be used to test the compiler or interpreter.
Discussion
Simple as this program is, it illustrates some basics of Scheme syntax.
Comments
The first line in the file is a comment. Comments start in a semicolon (;) and extend to the end of the line. Their purpose is to clarify the program to a human reading it – the computer ignores them.
Procedure Calls
Procedure calls consist of a pair of paretheses enclosing the procedure name and the arguments. The first procedure call supplies one argument, the second one does not supply any arguments.
Although the above program contains one procedure call per line, it is possible to write multiple procedure calls per line, or spread one procedure call over multiple lines. The parser knows where the procedure call ends because of the parentheses.
String Literals
String literals start and end with a double quote
character ("). If you want to embed a double quote character in
the string, you can do so by escaping it with a backslash. A backslash
can be inserted in the string by escaping it with a
backslash, too. For example: "\\\""
is a string consisting of
one backslash followed by one double quote. Most Scheme implementations
support a broader range of escape sequences borrowed from C (e.g.
\n for newline and \t for tab), but these are not
defined by the standard.