What is wwlisp? |
wwlisp is an interpreted programming language for application development and scripting which can be used for developing stand-alone programs, shells scripts or can be embedded in another program. wwlisp is a concise object oriented dialect of the Lisp language very loosely inspired by Common Lisp, Smalltalk, or even C++. wwlisp aims at solving specific categories of problems and hence the implementation does not comprise mechanisms intended to treat all the types of data traditional in Lisp or to implement theoretical concepts of software engineering or facilities dedicated to the management of large projects. Some syntactical forms related to the conservation of memory or the intricacies of the language were abandoned at the profit of a lighter syntax. To learn more on the language, just take a look at the wwlisp Syntax Primer. The wwlisp Project is hosted at SourceForge.net. To download wwlisp, go directly here. The project evolves, so to see what's new about wwlisp, look here. |
Applications, Plugins and Tools |
Yet another Lisp dialect just for the sake of it would probably not be worth the download, but just with the addition of a few supplementary libraries, the Lisp-like syntax and its peculiar object orientation begin to show quite productive results. Just take a look to the additional specialized libraries:
|
The
Interpreter |
The interpreter includes the traditional mechanisms and structures for this type of program. The memory is organized in four spaces: pointerspace - containing the car|cdr cells, the 64 bits integers (allowing 64 bits arithmetic independently of the 32 or 64 bits processor architecture) and 64 bits floating point, stringspace - containing the names of atoms and the character
strings, binaryspace containing structures, buffers, and API objects, and finally the dynamic stack for calling the functions. Pointer, string and binary spaces are pre-allocated at the startup of the interpreter and used gradually in the course of operation, while garbage collector algorithms recover space in case of exhaustion. The car and cdr pointers are full word (32 or 64 bits) variables, making possible the use of the maximum of the addressable space authorized for a process by the operating system and the processor. The version 8 interpreter has about 400 intrinsic compiled functions, as well as a library loaded at startup defining more than 60 additional functions dedicated mostly to debugging and edition. Moreover, the interpreter includes natively the following possibilities:
|
Command Line |
Although wwlisp is also suitable to be included as command or scripting interpreter in other applications like CAD-CAM, 3D game engine, etc... it is primarily useable as a command line utility or an interactive program. As command line utility, the interpreter can be used directly or in a normal bash shell script, and be supplied with options to control its initialization and execution, and also with applicative parameters which will be passed to the application program. The interpreter can also be used as shell interpreter replacing bash itself. In that case, all the coding can reside in just one file, the script file. Such a script can be used as cgi-bin for example. How to start the interpreter and dialog with it. |
Lexical Conventions |
Conventions used in this
manual, and special meanings for some characters in the language. |
Index of Classes and Classless Functions
|
|
Errors and Diagnostics |
Non-fatal errors and usual syntax faults, and ways to correct them. See also the list of the fatal errors of operation and the diagnostics to be posed. |
-b |
binary space size in bytes |
-C |
check consistency (only valid if compiled with -D_DEBUG) |
-d |
causes a minidump and thread abort while handling a SIGSEGV, allowing a better debug while running the interpreter as a daemon or service |
-g |
signal garbage collection by a message on stderr |
-G | tells the garbage collector to be more aggressive and recycle also the symbolic atoms which are not
bound, have no properties and are not referenced. This is useful when processing large symbolic streams, but still experimental in version 8.2. |
-h |
size in pointers (32
or 64 bits)
of the hash table of the base environment |
-i |
path and name of the
initialization file |
-j |
jump when abort
instead of
unwinding the stack |
-k |
keyboard history
size in lines |
-o |
ignore the stack
overflow
control, and thus crash if a Stack Overflows |
-p |
pointer space size
in bytes |
-s |
string space size in bytes |
-S |
stack space size in bytes |
-q |
interthread message
queue size
in 32 or 64 bits words |
-t |
maximum string
length in bytes |
-v |
verbose
initialization |
-V |
do not install the
SIGSEGV
handler, and thus crash if a Segmentation Violation occurs |
-x |
suppress banners,
trailers and
prompt, allowing a silent use as in a cgi-bin script |
#!/usr/local/bin/wwlisp -b20000000 -s20000000 (defun testfunc () (print 'Hello-World) (print(getargv 0)) (print(getargv 1)) (print(getargv 2)) (print(getargv 3)) (print(getargv 4)) ) (testfunc)The file is made executable by chmod u+x myscript and invoked by doing ./myscript scriptarg, which gives as result the following display:
Hello-World "/usr/local/bin/wwlisp" "-b20000000 -s20000000" "./myscript" "scriptarg" nilIn this case, (getargv 0) retrieves the path to the interpreter itself, (getargv 1) retrieves a string containing all the interpreter arguments given on the first line of the script, (getargv 2) retrieves the script name ./myscript, (getargv 3) retrieves the first of the arguments of the script itself: scriptarg, (getargv 4) retrieves the next argument of the script, which was nothing in this case. In this example the two arguments -b20000000 and -s20000000 will set the binary and string spaces to 20.000.000 bytes each.
(defun hello nil(prog nil))Then add all the desired forms in the function. Then save the file and quit the editor; the edited file shall be reloaded in the interpreter. By the way, the default editor will be kedit if KDE is the installed desktop environment, and vi otherwise. Any other editor can be chosen by customizing the file /usr/local/bin/init.lsp.
(hello)In case of error, press any key to enter the debugger. For help, just type ? or help or (help) or :help.
(.....)
|
left and right
parenthesis:
indicate the beginning and the ending of a list |
' |
simple quote: is a
shorter form
of the function (quote <something>), is implemented as a
read-macro |
"......"
|
double quotes mark
the beginning
and the ending of a string; use two double quotes to indicate a double
quote in the body of a string |
|......|
|
vertical bars mark
the beginning
and the ending of a weird atom, ie an atom of which the name embeds
whitespace characters; use two vertical bars to indicate a vertical bar
in the body of a weird atom name |
; |
semi-colon:
indicates that the
rest of the line up to the line-feed is a comment and must not be parsed |
whitespace
|
characters like
space,
horizontal and vertical tab, line-feed, carriage-return, form-feed;
they separate atoms except when found inside the body of a weird atom
name; they are used as normal characters when found in the body of a
string |
EOF |
when EOF is found
when reading a
symbolicstream or symbolicsocket, all the pending parenthesis are automatically
closed and a useable form is returned |
~ |
tilde: shorter form
of (eval
<something>) |