OpenLisp is a programming language from the Lisp family of languages developed by Christian Julien. [1] It complies with [2] [3] [4] the ISO ISLISP standard ( ISO / IEC 13816: 1997 (E) [5] revised by ISO / IEC 13816: 2007 (E) , published by ISO ).
| Openlisp | |
|---|---|
OpenLisp running in Emacs | |
| Type of | Compiler , interpreter |
| Author | Christian Julien |
| Written on | C and OpenLisp |
| operating system | Windows, Linux, MacOS, Solaris, HP-UX, AIX, OpenBSD, FreeBSD, NetBSD, PocketPC, QNX, VMS, Z / OS, Cygwin |
| First edition | 1988-4-13 |
| Hardware platform | x86, x86_64, ia64, sparc, sparcv9, PowerPC, mips, alpha, parisc, ARM, AArch64 |
| Latest version | 10.3.0 ( 2017-03-05 ) |
| License | Proprietary Software |
| Site | eligis.com |
The kernel is written in C and Lisp, runs on most operating systems. OpenLisp is an implementation of the ISLISP standard, but it also contains a number of extensions compatible with Common Lisp (hash tables, reading tables, packages, structures, sequences, rational numbers) and a number of libraries ( sockets , regular expressions , XML , Posix , SQL , LDAP ) . [6]
OpenLisp includes an interactive development interpreter ( REPL ), a compiler in the Lisp Assembly Program (LAP), and a code generator that converts LAP to C code.
Content
Development Goals
The goals of creating this Lisp dialect were:
- Implementation of a fully compatible ISLISP system. (Strict compliance with the ISLISP ISO / IEC 13816: 2007 (E) specification is ensured by running the interpreter with the
-islisp.) - Creating an embedded Lisp system that interacts with C / C ++ and Java code. Interaction with Java code is supported through the Java Native Interface . Callback- mechanism allows you to organize bidirectional interaction with external programs.
- Suitability for use as a scripting language .
- The ability to generate full-fledged executable modules for the target platform.
Dialect Name
The original language had the internal name MLisp. In 1993, this name was replaced by OpenLisp, as it turned out that MLisp was already used in Gosling Emacs .
In the early 1990s, the word “open” in the application to information technology was more often used to refer to systems that implement open specifications for interfaces, services and data formats, which makes it possible to use these systems without artificial restrictions, to create compatible and / or software that interacts with them (it is in this sense that the term is used in the definition of an “ open computer system ”). This understanding of “openness” is consistent with the goal of developing OpenLisp (see above), as well as the fact that it implements the ISLISP standard. [7]
Thus, the name of the language is intended to symbolize its openness for use, but it is not related either to the Open Source Initiative or to free software in general. OpenLisp has always been released and continues to be released under a proprietary license . Part of the source code is closed.
OpenLisp should not be confused with the OpenLISP project, launched in 1997 to implement the Locator / Identifier Separation Protocol .
License and terms of distribution
OpenLisp is a proprietary software . The interpreter is available free of charge for non-commercial use.
Some of the source code of the system is available under free licenses (GNU GPL, BSD) or is in the public domain . The source texts necessary for embedding OpenLisp into C / C ++ systems are separately licensed and provided for a fee.
User Interface
The OpenLisp interpreter is initially launched in console mode (in Cmd on Microsoft Windows or from under the terminal emulator on Unix-like systems).
;; OpenLisp v9.xy (Build: XXXX) by C. Jullien [Jan 01 20xx - 10:49:13]
;; Copyright (c) Eligis - 1988-20xx.
;; System 'sysname' (64bit, 8 CPU) on 'hostname', ASCII.
;; God thank you, OpenLisp is back again!
? ( fib 20 )
;; elapsed time = 0.003s, (0 gc).
= 6765
? _
It is also possible to run REPL under Emacs (you need to initialize the inferior-lisp-mode variable by the binary file of the OpenLisp interpreter). DaSystems LispIDE has built-in OpenLisp syntax support.
Implementation Details
Memory manager
OpenLisp uses a virtual memory mechanism to automatically allocate and modify the memory of objects. Small objects of the same type are placed using BIBOP technology (BIg Bag Of Pages). To place large objects, proxy objects are used that point to the real object in the Lisp heap . The conservative garbage collector uses the mark and sweep technique and can be configured to support multithreading .
Data Types
OpenLisp uses a tag architecture (4-bit tag on 32-bit, 5-bit tag on 64-bit word) for quick type checking (small integer, float, symbol, cons, string, vector). Short integers (28 bits on a 32-bit, 59 bits on a 64-bit word) are stored unpacked, long integers (32 bits / 64 bits) are stored unpacked. In accordance with ISLISP requirements, bignums are also implemented. Characters (and therefore strings) can be either 8-bit ( ANSI , EBCDIC ), or 16/32-bit if Unicode support is enabled.
Interpreter and compiler
The kernel, interpreter, and core libraries are hand-written in C. The compiler converts the source text into an intermediate LAP language , which is then translated by a code generator in C , which, in turn, can be compiled by any C-translator of the target platform.
History
| Year | Version | Major changes |
|---|---|---|
| 1988 | 1.0 | The project was launched as a research language called MLisp (Minimal Lisp) for experimenting with ideas from the emerging ISLISP standard. In 1988, the main motive was the implementation of Lisp for the expansion of EmACT , a clone of Emacs . ISLISP has proven to be the most suitable choice. |
| 1993 | 3.3 | The first port on a 64-bit architecture ( DEC Alpha OSF / 1). Name change to OpenLisp. |
| 1994 | 4.0 | First commercial use. |
| 1995 | 4.5 | Implemented socket support. |
| 1997 | 5.7 | OpenLisp was the first implementation of the ISLISP ISO / IEC 13816: 1997 (E) standard. [9] |
| 1998 | 5.8 | Implemented Unicode support. |
| 2000 | 6.6 | Compiler in LAP. LAPs are interpreted by the virtual machine that is part of the system. Performance is doubled. |
| 2003 | 7.5 | Implemented the back end “Lisp in C”. Compilation of multi-file Lisp programs into an executable module has become available. The speed increased by 10-20 times. |
| 2007 | 8.7 | Changes are made in connection with the release of the new standard ISO / IEC 13816: 2007 (E) . |
| 2010 | 9.2 | Implementation of whole arithmetic with unlimited accuracy. |
| 2017 | 10.3 | Current version (2017-03-05). |
Porting
OpenLisp is easy to port, it can run on many operating systems: Microsoft Windows , most systems based on Unix , QNX , MS-DOS , OS / 2 , Pocket PC , OpenVMS , z / OS . More than 50 different versions are available on the official website.
Standard Libraries
Input-output and interaction with other software
OpenLisp can interoperate with C modules using FFI , ISLISP I / O streams are expanded to support network sockets. The ./net directory in a deployed system includes examples for working with Http , Json , Pop3 , Smtp , Telnet , Rss . A simple XML reader can convert XML to Lisp lists. The basic SQL module can be used to access MySQL , Odbc , SQLite , PostgreSQL . The CSV module provides reading and writing files in CSV format.
Developer Tools
Development support tools include logging, code formatting, profiler , support for contract programming and unit testing .
Algorithms
Implementations of some well-known algorithms are available in the ./contrib directory ( simplex algorithm , Dijkstra algorithm , Ford-Fulkerson algorithm, and others). Modules are provided under the BSD license .
Compilation
This section describes the sequence of transforming Lisp code into C code in OpenLisp.
Source Code
As an example, we use the recursive function fib , which performs the calculation of the nth Fibonacci number (this classic definition used in many benchmarks is not the most efficient for real calculations).
( defun fib ( n )
( cond (( eq n 1 ) 1 )
(( eq n 2 ) 1 )
( t ( + ( fib ( - n 1 )) ( fib ( - n 2 ))))))
LAP
The compiler translates the source code in Lisp into an intermediate code in a list LAP format, which is subjected to local optimization ( English peephole optimization ). After optimization, the resulting LAP code looks like this:
(( fentry fib 1 0 0 )
( param 0 )
( jeq _l004 '1 )
( jneq _l003 '2 )
( move a1 '1 )
( return )
_l003
( gsub1 a1 )
( recurse 1 )
( move a2 a1 )
( param 0 )
( gsub a1 '2 )
( recurse 1 )
( gadd a2 a1 )
_l004
( return )
( end ))
C code generation
Finally, the code generator converts the LAP code into C instructions.
static POINTER
OLDEFCOMPILED1 ( olfib_00 , p1 )
{
POINTER a1 ;
POINTER VOLATILE a2 ;
ollapenter ( SN_OLFIB_00 );
a1 = p1 ;
if ( eq ( a1 , olmakefix ( 1 ) ) ) goto _l004 ;
if ( ! eq ( a1 , olmakefix ( 2 ) ) ) goto _l003 ;
ollapleave ( SN_OLFIB_00 );
return ( olmakefix ( 1 ) );
_l003 :
a1 = ollapgsub ( a1 , olmakefix ( 1 ) );
a2 = olfib_00 ( a1 );
a1 = ollapgsub ( p1 , olmakefix ( 2 ) );
a1 = olfib_00 ( a1 );
a1 = ollapgadd ( a2 , a1 );
_l004 :
ollapleave ( SN_OLFIB_00 );
return ( a1 );
}
The above snippet contains only the generated C code itself. To obtain an executable file, this code must be embedded in the appropriate environment and compiled with the libraries included in the OpenLisp environment.
Performance
According to the data on the system’s author’s page (however, outdated - the materials cited refer to version 7.9, whereas the current version for 2018 is 10.3), in comparison with two other ISLISP OpenLisp implementations, it is on the same level or somewhat faster in the interpretation mode and significantly ( 10-20 times) faster in the speed of compiled applications.
Application
- The non-profit organization SDF (also known as freeshell.org), which provides Internet access to the UNIX shell, [10] [11] OpenLisp is used as one of the programming languages available on the network.
- Bricsys uses OpenLisp to implement its AutoLISP version of Bricscad CAD . [12]
- MEVA [13] is entirely written in OpenLisp.
- The University of Palermo uses OpenLisp as an educational language. [14]
Notes
- ↑ Pierre Parquier. JTC1 / SC22 N3170 unspecified . ISO / IEC (2000). Date of treatment March 11, 2012. (unavailable link)
- ↑ Keld Simonsen. Islisp - faq . ISO / IEC (13 March 1999). Date of treatment November 11, 2016.
- ↑ IZUMI NOBUTO (Tohoku Univ., Grad. Sch.) ITO TAKAYASU (Tohoku Univ., Grad. Sch.). Interpreter and Compiler of the ISO Standard Lisp ISLISP. . Transactions of Information Processing Society of Japan (1999). Date of treatment June 17, 2013.
- ↑ Paul McJones. ISLISP unspecified . Software Preservation Group (2010). Date of treatment March 18, 2012.
- ↑ Pierre Parquier (JTC1 SC22 WG16 Convenor). ISO / IEC JTC1 SC22 WG16 N177 - DIS vote . ISO / IEC (1996). Date of appeal March 15, 2012.
- ↑ C. Jullien. OpenLisp v9.8.0 Reference Manual . Eligis (2011). Date of treatment March 14, 2012.
- ↑ C. Jullien. OpenLisp FAQ unspecified . Eligis (2011). Date of appeal March 15, 2012.
- ↑ C. Jullien. OpenLisp ChangeLog unspecified . Eligis (2011). Date of appeal March 15, 2012.
- ↑ William Rinehuls. JTC1 / SC22 N2969 unspecified . ISO / IEC (4 August 1999). Date of treatment November 11, 2016.
- ↑ Gene Michael Stover. 7.2 Languages on SDF . SDF Public Access UNIX System, Inc. (2005). Date of treatment March 14, 2012.
- ↑ Hosting companies (inaccessible link) . ALU (Association of Lisp Users). Date of treatment March 18, 2012. Archived February 9, 2011.
- ↑ Bricscad News . Bricscad (2009). Date of treatment March 20, 2012.
- ↑ Competitive Intelligence and Decision Problems . Amos Davis (2013). Date of appeal September 30, 2014.
- ↑ Corso di Informatica Teorica . Università degli Studi di Palermo (2013). Date of treatment March 22, 2013.
Links
- eligis.com - official site of OpenLisp
- Lisp Compilers and Interpreters in the Open Directory Project Link Directory (dmoz)
- ISLISP on Software Preservation Group