Jump to content

OpenLisp

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 160.80.180.142 (talk) at 10:55, 9 July 2018 (Adoption: Capitalisation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

OpenLisp
Original author(s)Christian Jullien
Initial releaseApril 1988; 36 years ago (1988-04)
Stable release
10.3.0 / March 5, 2017; 7 years ago (2017-03-05)
Written inC and OpenLisp
Operating systemWindows, Linux, MacOS, Solaris, HP-UX, AIX, OpenBSD, FreeBSD, NetBSD, PocketPC, QNX, VMS, Z/OS, Cygwin
Platformx86, x86_64, ia64, sparc, sparcv9, PowerPC, mips, alpha, parisc, ARM, AArch64
TypeCompiler, runtime
LicenseProprietary license
Websitewww.eligis.com

OpenLisp is a programming language in the LISP family developed by Christian Jullien.[1] It conforms[2][3][4] to ISLISP International Standard, ISO/IEC 13816:1997(E)[5] revised by ISO/IEC 13816:2007(E), published by ISO.

Written in C and Lisp, it runs on most common operating systems. OpenLisp is designated an ISLISP implementation, but also contains many Common Lisp-compatible extensions (hashtable, readtable, package, defstruct, sequences, rational numbers) as well as other libraries (network socket, regular expression, XML, Posix, SQL, LDAP).[6]

OpenLisp includes an interpreter associated to a REPL, a Lisp Assembly Program (LAP) and a C backend compiler.

Goals

The main goal of this Lisp version is to implement a fully compliant ISLISP system (when launched with -islisp flag, it is strictly restricted to ISO/IEC 13816:2007(E) specification). The secondary goal is to provide a complete embeddable Lisp system linkable to C/C++ or Java (with help of JNI). A callback mechanism is used to communicate with the external program. Other goals are to be usable as script language or glue language and to produce standalone executables

License

Despite its name, OpenLisp is proprietary software. Its interpreter is available free of charge for any non-commercial usage.

User interface

OpenLisp mainly runs in console mode (Cmd on Microsoft Windows, Terminal emulator on Unix-based systems).

 ;; OpenLisp v9.x.y (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
 ? _

An alternate solution is to set up Emacs inferior-lisp-mode to run OpenLisp from Emacs. DaanSystems LispIDE has native support for OpenLisp syntax.

Technology

Memory manager

Internally, OpenLisp uses virtual memory to allocate and extend objects automatically. Small objects of the same type are allocated using a Bibop (BIg Bag Of Pages) memory organization. Large objects use a proxy which point to the real object in Lisp heap. The conservative GC is a "mark and sweep" with coalescing heap (sweep phase can be configured to use threads).

Data types

OpenLisp uses tagged architecture (4 bits tag on 32bit, 5 bits tag on 64bit) for fast type checking (small integer, float, symbol, cons, string, vector). Small integers (28 bits on 32bit, 59 bits on 64bit) are unboxed, large (32bit/64bit) integers are boxed. As required by ISLISP, bignums are also implemented. Characters (hence strings) are either 8bit (ANSI, EBCDIC) or 16/32bit if Unicode support is enabled.

Evaluator and compiler

The Lisp Kernel, native interpreter and basic libraries are hand coded in C, LAP intermediate language produced by the compiler is then translated to C by the C backend code generator.

History

OpenLisp milestones.[7]
Year Version Main feature
1988 1.0 OpenLisp started its life as toy language named MLisp (Minimal Lisp) to experiment ideas from ISLISP standardization process.*
1993 3.3 first port on 64bit machine (DEC Alpha OSF/1). Name changed from MLisp to OpenLisp.
1994 4.0 first commercial use.
1995 4.5 socket streams support.
1997 5.7 OpenLisp is the first to implement ISLISP ISO/IEC 13816:1997(E) standard.[8]
1998 5.8 optional Unicode support.
2000 6.6 Lisp to LAP compiler. LAP is interpreted by a virtual machine embedded in OpenLisp. Speed improvement is about 2x.
2003 7.5 Lisp to C backend. It was able to compile an application with many lisp files to a standalone executable. Speed improvement is from 10x to 20x.
2007 8.7 changes to match ISO/IEC 13816:2007(E) revision.
2010 9.2 native integer arbitrary-precision arithmetic support.
2017 10.3 current version (2017-03-05).

* In 1988 the very first intention was to implement a LISP subset to extend EmACT, an Emacs clone. ISLISP quickly became an obvious choice.

Ports

OpenLisp claims to be extremely portable, it runs on numerous operating systems: Microsoft Windows, most Unix-based, QNX, MS-DOS, OS/2, Pocket PC, OpenVMS, and z/OS. The official website download section contains more than 50 different versions.

Standard libraries

Connectors

OpenLisp can interact with modules written in C using FFI, ISLISP streams are extended to support Network socket (./net directory includes samples for Http, Json, Pop3, Smtp, Telnet, Rss), a simplified XML reader can convert XML to Lisp. A basic SQL module can be used with MySQL, Odbc, SQLite, PostgreSQL. A CSV module can read and write CSV files.

Tools

Developer tools include data logging, pretty-printer, profiler, contract programming, and unit tests.

Algorithms

Some well known algorithms are available in ./contrib directory (simplex algorithm, Dijkstra's algorithm, Ford Fulkerson). Modules are shipped using BSD license.

Origin of name

The prefix Open refers to open system not to open source.[9]

The name was chosen in 1993 to replace MLisp internal code name which was already used by Gosling Emacs (as successor of Mocklisp).

OpenLisp computer language should not be confused with OpenLISP, a project started in 1997 to implement Locator/ID Separation Protocol.

Compiler

This section describes how compiler transforms Lisp code to C.

Source code

The Fibonacci function (this classic definition used in most benchmarks is not the most efficient way to compute fib)

(defun fib (n)
   (cond ((eq n 1) 1)
         ((eq n 2) 1)
         (t (+ (fib (- n 1)) (fib (- n 2))))))

LAP intermediate code

Lisp compiler translates Lisp source code to the following intermediate code. It is followed by a peephole optimization pass that uses this intermediate format to analyze and optimize instructions. After optimization, final LAP code is:

  ((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 translation

Finally, C code generator uses LAP code to translate instructions in C.

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 );
}

Style Guide

Line Length

OpenLisp accepts lines having unlimited length. The recommended style is that each line of text in your code should have at most 80 Characters per line.

Adoption

It has been chosen by SDF Public Access Unix System nonprofit public access UNIX systems on the Internet[10][11] as one of its programming languages available online.

Bricsys uses OpenLisp to implement AutoLISP in its Bricscad CAD system.[12]

MEVA [13] is entirely written with OpenLisp.

Università degli Studi di Palermo uses OpenLisp to teach Lisp.[14]

References

  1. ^ Pierre Parquier (2000). "JTC1/SC22 N3170". ISO/IEC. Retrieved 11 March 2012.
  2. ^ Keld Simonsen. (13 March 1999). "Islisp - faq". ISO/IEC. Retrieved 11 November 2016.
  3. ^ IZUMI NOBUTO (Tohoku Univ., Grad. Sch.) ITO TAKAYASU (Tohoku Univ., Grad. Sch.) (1999). "Interpreter and Compiler of the ISO Standard Lisp ISLISP". Transactions of Information Processing Society of Japan. ISSN 0387-5806. Retrieved 17 June 2013.{{cite web}}: CS1 maint: multiple names: authors list (link)
  4. ^ Paul McJones (2010). "ISLISP". Software Preservation Group. Retrieved 18 March 2012.
  5. ^ Pierre Parquier (JTC1 SC22 WG16 Convenor) (1996). "ISO/IEC JTC1 SC22 WG16 N177 - DIS vote". ISO/IEC. Retrieved 15 March 2012.{{cite web}}: CS1 maint: numeric names: authors list (link)
  6. ^ C. Jullien (2011). "OpenLisp v9.8.0 Reference Manual". Eligis. Retrieved 14 March 2012.
  7. ^ C. Jullien (2011). "OpenLisp ChangeLog". Eligis. Retrieved 15 March 2012.
  8. ^ William Rinehuls. (4 August 1999). "JTC1/SC22 N2969". ISO/IEC. Retrieved 11 November 2016.
  9. ^ C. Jullien (2011). "OpenLisp FAQ". Eligis. Retrieved 15 March 2012.
  10. ^ Gene Michael Stover (2005). "7.2 Languages on SDF". SDF Public Access UNIX System, Inc. Retrieved 14 March 2012.
  11. ^ "Hosting companies". ALU (Association of Lisp Users). Retrieved 18 March 2012.
  12. ^ "Bricscad News". Bricscad. 2009. Retrieved 20 March 2012.
  13. ^ "Competitive Intelligence and Decision Problems". Amos Davis. 2013. Retrieved 30 September 2014.
  14. ^ "Corso di Informatica Teorica". Università degli Studi di Palermo. 2013. Retrieved 22 March 2013.
1958 1960 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020
 LISP 1, 1.5, LISP 2(abandoned)
 Maclisp
 Interlisp
 MDL
 Lisp Machine Lisp
 Scheme  R5RS  R6RS  R7RS small
 NIL
 ZIL (Zork Implementation Language)
 Franz Lisp
 Common Lisp  ANSI standard
 Le Lisp
 MIT Scheme
 XLISP
 T
 Chez Scheme
 Emacs Lisp
 AutoLISP
 PicoLisp
 Gambit
 EuLisp
 ISLISP
 OpenLisp
 PLT Scheme  Racket
 newLISP
 GNU Guile
 Visual LISP
 Clojure
 Arc
 LFE
 Hy
 Chialisp