File: librep.texi

package info (click to toggle)
librep 0.90.2-1.4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,936 kB
  • ctags: 3,052
  • sloc: ansic: 32,948; lisp: 11,025; sh: 9,844; makefile: 545; sed: 93
file content (329 lines) | stat: -rw-r--r-- 10,444 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
\input texinfo  @c -*-Texinfo-*-
@setfilename librep.info
@settitle librep Manual
@footnotestyle end

@set EDITION 1.2
@set VERSION 0.13
@set UPDATED 2 May 2009
@set UPDATE-MONTH May 2009

@ifinfo
@dircategory Programming Languages
@direntry
* librep: (librep).		A flexible Lisp environment
@end direntry

This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The librep Manual}, for librep, Version @value{VERSION}.

Copyright 1999--2000 John Harper.

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

@ignore
Permission is granted to process this file through TeX and print the
results, provided the printed document carries copying permission
notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).
@end ignore

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
@end ifinfo

@titlepage
@title librep
@subtitle A LISP extension language
@subtitle Edition @value{EDITION}
@subtitle @value{UPDATE-MONTH}
@author John Harper
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1999--2000 John Harper.

Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
@end titlepage

@node Top, Copying, (dir), (dir)

@ifinfo
This document describes @code{librep}, a simple, but powerful, Lisp
dialect intended both as an embedded extension language, and as a
stand-alone programming language.

This is Edition @value{EDITION} of its documentation,
last updated @value{UPDATED} for librep version @value{VERSION}.
@end ifinfo

@menu
* Copying::                     Distribution conditions
* Introduction::                Brief introduction to librep

* Invocation::                  How to start the interpreter
* The language::                The Lisp dialect implemented
* The REPL::                    The interactive environment
* librep Internals::		Embedding librep in other programs

* Reporting bugs::              How to contact the maintainers

* News::                        History of user-visible changes

* Function index::              Menu of all documented functions
* Variable index::              All variables which have been mentioned
* Concept index::               Main index, references to all sections
@end menu


@node Copying, Introduction, Top, Top
@chapter Copying
@cindex Copying
@cindex Distribution conditions
@cindex Licence

@code{librep} is distributed under the terms of the GNU General Public
License, this basically means that you can give it to anyone for any
price as long as full source code is included; you also have the right
to distribute modified copies in the same way. For the actual legalese
see the file @file{COPYING} in the distribution (or
@pxref{(emacs)Copying}).

In case it isn't obvious, scripts written to use librep are not
considered derived works, and therefore may be licensed however the
author wishes. However, the ability of scripts to dynamically load
external libraries may complicate this situation.

The distribution includes the following code from other packages:

@itemize @bullet
@item
Henry Spencer's @code{regexp} implementation, with many modifications.
This is distributed under the terms of his copyright, see the file
@file{src/README.regexp} in the distribution.

@item
The public domain @code{sdbm} database library by Ozan Yigit.

@item
The backquote package from Emacs version 19, written by Rick Sladkey.

@item
The GNU @code{gettext} implementation for internationalized message
catalogues.
@end itemize

Be aware that there is absolutely NO WARRANTY for this program, you use
it at your own risk. Obviously I hope there are no bugs, but I make no
promises regarding the reliability of this software.


@node Introduction, Invocation, Copying, Top
@chapter Introduction
@cindex Introduction

@code{librep} is a dialect of Lisp, designed to be used both as an
extension language for applications and as a general purpose
programming language. It was originally written to be mostly-compatible
with Emacs Lisp, but has subsequently diverged markedly. Its aim is to
combine the best features of Scheme and Common Lisp and provide an
environment that is comfortable for implementing both small and large
scale systems. It tries to be a ``pragmatic'' programming language.

The author has used @code{librep} in its various forms in many projects
since 1993. This includes two large programs which use it as an
extension language, and many stand-alone programs.

@code{rep} stands for ``Read, Eval, Print'', the three main components of
any Lisp system.

Some of the features of @code{librep} are:

@itemize @bullet
@item Lexically scoped (with special variables from CL)

@item Clean module system

@item Tail-call elimination

@item Compiles to byte-code

@item First-class continuations

@item Uses GNU MP for fast bignums/rationals

@item Most Emacs Lisp functions, with others inspired by
Common Lisp and various Scheme implementations

@item Mostly-Perl-like regular expressions

@item Spawn and control subprocesses

@item Dynamically loads shared libraries (a.k.a. ``plugins'')

@item Extensible type, I/O, and file handling
@end itemize


@node Invocation, The language, Introduction, Top
@chapter Invocation
@cindex Invocation

The @code{rep} program may be used to launch the stand-alone
@code{librep} environment:

@example
usage: rep [@var{rep-options}@dots{}] [@var{script} [@var{script-options}@dots{]}]
@end example

@noindent
Where @var{rep-options} may be any of the following:

@table @samp
@item --init @var{file}
Use @var{file} to boot the Lisp system from, instead of @file{init.jl}.

@item --version
Print the current version number and exit

@item --batch
Tell the interpreter that it is running non-interactively, this reduces
the number of messages output to the console

@item --interp
Interpreted mode. Never load compiled Lisp files: this can be useful
when using the debugger.

@item --no-rc
Don't load the user's @file{~/.reprc} script, or the
@file{site-init.jl} script

@item -f @var{function}
Invoke the Lisp function @var{function} (with no arguments)

@item -l @var{script}
Try to load the Lisp file @var{script}, this is equivalent to evaluating
the form @samp{(load "@var{script}")}.

@item -q
Terminate the Lisp process and exit.
@end table

@vindex command-line-args
If @var{script} is given, it names the Lisp file to load, equivalent to
the @samp{-l} option, except that @samp{--batch-mode} is implied. Any
@var{script-options} will be made available to the script (in the
@code{command-line-args} variable).

After any arguments have been processed a banner message will be
displayed before entering an interactive read-eval-print loop, unless
@samp{--batch-mode} was specified, in which case the interpreter exits.

The read-eval-print loop simply reads complete Lisp forms (@pxref{The
Lisp Reader}), evaluates them, before printing the result back to the
console; this continues ad infinitum, or until you force an EOF (i.e.
enter @kbd{C-d}).


@subsubheading Implicitly Interpreting @code{rep} Scripts
@cindex Implicitly Interpreting @code{rep} scripts
@cindex Executing @code{rep} scripts
@cindex Scripts, executing implicitly

The @code{rep} interpreter also supports automatic invocation of
scripts, using the oeprating system's support for @samp{#!} interpreter
invocation (i.e. if the first line of an executable text file contains
@samp{#! @var{prog}}, the program @var{prog} is used to execute the
script.

However there is a problem with this method, in that the @code{PATH}
environment variable is not searched for the location of the
interpreter, and thus the full file name of the interpreter program
must be hard-coded into the script. To work around this problem
@code{rep} supports a slightly different method of invocation.

If the first two characters of a loaded Lisp file are @samp{#!}, then
everything is treated as a comment until the first occurrence of the
string @samp{!#}. This allows the first part of the script to be
executed as a shell script invoking the @code{rep} interpreter.

What this means, is that you want to put something like the following
at the start of any scripts you want to execute implicitly (and
@kbd{chmod +x} the file as well):

@example
#!/bin/sh
exec rep "$0" "$@@"
!#

;; Lisp code follows@dots{}
@end example


@node The language, The REPL, Invocation, Top
@include lang.texi


@node The REPL, librep Internals, The language, Top
@include repl.texi

@node librep Internals, Reporting bugs, The REPL, Top
@include interface.texi


@node Reporting bugs, News, librep Internals, Top
@chapter Reporting bugs
@cindex Reporting bugs
@cindex Bugs, reporting

If the @code{librep} interpreter crashes it's probably a bug (unless
you're using the @code{rep-gtk} binding, in which case creating invalid
GTK widget hierarchies can easily crash the Lisp system). If the
interpreter hangs such that sending it interrupt signals doesn't fix
the problem, that's probably also a bug.

To help me fix any bugs found please try to collect as much meaningful
information as possible. This will hopefully include stack backtraces
(of both the C and Lisp stacks if possible), what features are loaded,
what you did immediately before triggering the bug, a description of
your the system, etc@dots{}

Please send any bug reports to the mailing list:
@email{librep-list@@lists.sourceforge.net}. Alternatively, the author
may be contacted at: @email{jsh@@users.sourceforge.net}.


@node News, Function index, Reporting bugs, Top

@include news.texi


@node Function index, Variable index, News, Top
@unnumbered Function index

@printindex fn


@node Variable index, Concept index, Function index, Top
@unnumbered Variable index

@printindex vr


@node Concept index, , Variable index, Top
@unnumbered Concept index

@printindex cp

@contents
@bye