OpenLisp explained

OpenLisp
Screenshot Caption:OpenLisp running inside Emacs
Paradigms:Multi-paradigm

functional, procedural, object-oriented, reflective, meta

Family:Lisp
Designer:Christian Jullien
Developer:Christian Jullien
Developers:-->
Latest Release Version:11.7.0
Typing:Dynamic, strong
Programming Language:C, OpenLisp
Platform:x86, x86-64, IA-64, SPARC, PowerPC, MIPS, Alpha, PA-RISC, ARM, AArch64, RISC-V, Loongson
Operating System:Windows, most Unix-based, Linux, macOS, FreeBSD, OpenBSD, NetBSD, Solaris, HP-UX, AIX, QNX, DOS, OS/2, Pocket PC, OpenVMS, z/OS, Cygwin
License:Proprietary
File Formats:-->
Influenced By:Lisp, ISLISP

OpenLisp is a programming language in the Lisp family developed by Christian Jullien[1] from Eligis. It conforms[2] [3] [4] to the international standard for ISLISP published jointly by the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC), ISO/IEC 13816:1997(E),[5] [6] revised to ISO/IEC 13816:2007(E).[7]

Written in the programming languages 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) and other libraries (network socket, regular expression, XML, Portable Operating System Interface (POSIX), SQL, Lightweight Directory Access Protocol (LDAP)).[8]

OpenLisp includes an interpreter associated to a read–eval–print loop (REPL), a Lisp Assembly Program (LAP) and a backend compiler for the language C.

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 (via Java Native Interface (JNI)). A callback mechanism is used to communicate with the external program. Other goals are to be usable as scripting language or glue language and to produce standalone program executables.

License

Despite its name, OpenLisp is proprietary software. Its interpreter is available free of charge for any noncommercial use.

User interface

OpenLisp mainly runs in console mode: [[cmd.exe]] on Microsoft Windows, and terminal emulator on Unix-based systems.

;; OpenLisp v11.x.y (Build: XXXX) by C. Jullien [Jan 01 20xx - 10:49:13] ;; Copyright (c) Eligis - 1988-20xx. ;; System 'sysname' (64-bit, 8 CPU) on 'hostname', ASCII. ;; God thank you, OpenLisp is back again! ? (fib 20) ;; elapsed time = 0.003s, (0 gc). = 6765 ? _

Alternate solutions include running OpenLisp from Emacs via setting up Emacs inferior-lisp-mode, or using an integrated development environment (IDE) which supports OpenLisp syntax. LispIDE by DaanSystems does so natively.

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 garbage collection 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 32-bit, 5 bits tag on 64-bit) for fast type checking (small integer, float, symbol, cons, string, vector). Small integers (28 bits on 32-bit, 59 bits on 64-bit) are unboxed, large (32/64-bit) integers are boxed. As required by ISLISP, arbitrary-precision arithmetic (bignums) are also implemented. Characters (hence strings) are either 8-bit (ANSI, EBCDIC) or 16/32-bit if Unicode support is enabled.

Evaluator and compiler

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

History

In 1988, the very first motive behind OpenLisp was to implement a Lisp subset to extend EmACT, an Emacs clone. ISLISP became an obvious choice quickly. Further development ensued.

OpenLisp milestones[9] !Year!Version!Main feature
19881.0OpenLisp begun as a toy language named MLisp (Minimal Lisp) to experiment with ideas from ISLISP standards process
19933.3First port on 64-bit machine (DEC Alpha OSF/1); name change from MLisp to OpenLisp
19944.0First commercial use
19954.5Socket streams support
19975.7OpenLisp is first Lisp to implement ISLISP ISO/IEC 13816:1997(E) standard.[10]
19985.8Unicode optional support
20006.6Lisp to LAP compiler; LAP is interpreted by a virtual machine embedded in OpenLisp; speed improved about 2x
20037.5Lisp to C backend; able to compile an application with many Lisp files to a standalone executable; speed improved from 10x to 20x
20078.7Changes to match ISO/IEC 13816:2007(E) revision
20109.2Native integer arbitrary-precision arithmetic support
202111.2Added complete CLtL format extension; improve heap detection
202211.4Rework of activation blocks makes interpreter around 15% faster. Experimental ASDF clone.
202211.5Generic function calls are ~3x faster. Improved regex internal module.
202211.6Add type and related BIT functions similar to CLtL equivalent.
202211.7Current version

Ports

OpenLisp claims to be extremely portable, it runs on many operating systems including: Windows, most Unix and POSIX based (Linux, macOS, FreeBSD, OpenBSD, NetBSD, Solaris, HP-UX, AIX, Cygwin, QNX), DOS, OS/2, Pocket PC, OpenVMS, z/OS. The official website download section contains over 50 different versions.

Standard libraries

Connectors

OpenLisp can interact with modules written in C using foreign function interface (FFI), ISLISP streams are extended to support network socket (./net directory includes samples for Hypertext Transfer Protocol (http), JavaScript Object Notation (JSON), Post Office Protocol 3 (POP3), Simple Mail Transfer Protocol (SMTP), Telnet, Rss), a simplified Extensible Markup Language (XML) reader can convert XML to Lisp. A basic SQL module can be used with MySQL, Odbc, SQLite, PostgreSQL. A comma-separated values (CSV) module can read and write CSV files.

Tools

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

Algorithms

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

Origin of name

The prefix Open refers to open systems not to the open-source model.[11]

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

OpenLisp programming language is different than OpenLISP, a project begun in 1997 to implement Locator/Identifier Separation Protocol.

Compiler

This section describes how a compiler transforms Lisp code to C.

Source code

The Fibonacci number 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)

Style guide

Line length

OpenLisp accepts lines having unlimited length. The recommended style is that each line of text in 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[12] [13] as one of its programming languages available online.

Bricsys uses OpenLisp to implement AutoLISP in its Bricscad computer-aided design (CAD) system.[14]

MEVA [15] is entirely written with OpenLisp.

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

External links

Notes and References

  1. Web site: [ftp://std.dkuug.dk/ftp.anonymous/jtc1/SC22/def/n3170.html JTC1/SC22 N3170 ]. 2000 . Parquier . Pierre . ISO/IEC . 11 March 2012 .
  2. Web site: Islisp – faq . Simonsen . Keld . ISO/IEC . 13 March 1999 . 11 November 2016.
  3. Interpreter and Compiler of the ISO Standard Lisp ISLISP . 1999 . Nobuto . Izumi (Tohoku Univ., Grad. Sch.) . Takayasu . Ito (Tohoku Univ., Grad. Sch.) . Transactions- Information Processing Society of Japan . Transactions of Information Processing Society of Japan . 17 June 2013 . 0387-5806 . 26 August 2018 . https://web.archive.org/web/20180826183028/http://sciencelinks.jp/j-east/article/200003/000020000399A0922596.php . dead .
  4. Web site: ISLISP . 2010 . McJones . Paul . Software Preservation Group . 18 March 2012.
  5. Web site: ISO/IEC 13816:1997(E) . International Organization for Standardization . 11 November 2018.
  6. Web site: ISO/IEC JTC1 SC22 WG16 N177 – DIS vote . 1996 . Parquier . Pierre (JTC1 SC22 WG16 Convenor) . ISO/IEC . 15 March 2012.
  7. Web site: ISO/IEC 13816:2007(E) . International Organization for Standardization . 11 November 2018.
  8. Web site: OpenLisp v9.8.0 Reference Manual . 2011 . Jullien . Christian . Eligis . 14 March 2012.
  9. Web site: OpenLisp ChangeLog . 2011 . Jullien . Christian . Eligis . 15 March 2012.
  10. Web site: JTC1/SC22 N2969 . Rinehuls . William . ISO/IEC . 4 August 1999 . 11 November 2016.
  11. Web site: OpenLisp FAQ . 2011 . Jullien . Christian . Eligis . 15 March 2012.
  12. Web site: 7.2 Languages on SDF . 2005 . Stover . Gene Michael . SDF Public Access Unix System, Inc. . 14 March 2012.
  13. Web site: Hosting companies . ALU (Association of Lisp Users) . 18 March 2012 . https://web.archive.org/web/20110209220501/http://wiki.alu.org/Lisp-friendly%20Web%20Hosting?v=6 . 9 February 2011 . dead .
  14. Web site: Bricscad News . 2009 . Bricscad . 20 March 2012.
  15. Web site: Competitive Intelligence and Decision Problems . 2013 . Amos Davis . 30 September 2014.
  16. Web site: Corso di Informatica Teorica . 2013 . Università degli Studi di Palermo . 22 March 2013.