S-Lang

Last updated
S-Lang
Developer(s) John E. Davis [1]
Stable release
2.3.3 [2]   OOjs UI icon edit-ltr-progressive.svg / 5 August 2022
Written inS-Lang scripting language
Operating system POSIX
Type Widget toolkit
License GPL-2.0-or-later [3]
Website www.jedsoft.org/slang/ OOjs UI icon edit-ltr-progressive.svg

The S-Lang programming library is a software library for Unix, Windows, VMS, OS/2, and Mac OS X. It provides routines for embedding an interpreter for the S-Lang scripting language, and components to facilitate the creation of text-based applications. [4] The latter class of functions include routines for constructing and manipulating keymaps, an interactive line-editing facility, and both low- and high-level screen/terminal management functions. It is distributed under the terms of the GNU General Public License.

Contents

Brief history

The S-Lang programming library was started in 1992 by John E. Davis, considering that functions he wrote for a text editor might be useful in other programs. [5] The earliest version of the library contained input/output routines for interacting with computer terminals and an implementation of a simple stack-based interpreter with a PostScript-like syntax that he developed for use in a scientific plotting program. The JED text editor was the first program to both embed the interpreter and use the terminal I/O components of the library.

Interpreter

The interpreter makes up most of the S-Lang library, and is also where most of the development takes place. Although the original syntax supported by the interpreter resembled PostScript, the syntax has evolved to be much more C-like, with additional support for object-oriented style constructs. As a reflection of Davis's background in physics and professional interest in scientific computing, the language natively supports many vectorized array-based operations similar to MATLAB and IDL. [6]

Until version 2.0, the interpreter was not a standalone program. Instead, Davis advocated embedding it into applications to make them extensible. Using the interpreter meant either embedding it in a C program, or using it in the context of another application (e.g., the JED editor). The S-Lang shell, slsh, was a demonstration program capable of little more than running scripts. Version 2.0, released in 2005, made slsh interactive, and it has evolved into an application in its own right, with a number of external modules for use by it. As such, it has become the S-Lang interpreter.

Screen management

In the mid-1990s while porting the sc spreadsheet to the S-Lang library, Davis developed the library's screen management facility.[ citation needed ] This component was designed to optimize screen output (by minimizing the number of characters sent to the terminal), and provide a simple way to support a variety of terminals through an extra layer of abstraction between the application code and the terminal. The slrn newsreader was the first application to make full use of this interface.[ citation needed ] Since then, a number of other programs (e.g., Mutt [7] ) have taken advantage of this feature of the library, and it has become arguably the most used aspect of the library, as this component is considered to be an alternative to curses. [8] [9] Since version 2.0, the screen management routines have had transparent support for UTF-8.

Example source code

#! /usr/bin/env slsh% The program below solves the following problem:%    Sort an input file that consists of lines like this%%        var1=23 other=14 ditto=23 fred=2privatevariableKeys,Values;privatedefinesort_fun(i,j){variables,a,b;s=Values[i]-Values[j];!if(s)returnstrcmp(Keys[i],Keys[j]);returns;}defineslsh_main(){variableline,len,i,vals;foreachline(stdin){% Split string into an array of strings %% by using white chars and = as delimite% line=strtok(line," \t\n=");len=length(line)/2;if(len==0)continue;% Even elements are keys, odd are values% The [0::2] is an array containing indexes with a 2 specifying step% and creating indexes from 0 to the length(line)Keys=line[[0::2]];vals=line[[1::2]];% The variable is declared aboveValues=atoi(vals);i=array_sort([0:len-1],&sort_fun);% There are different ways of writing the result.  Here is a% fast way that avoids a loop.% The empty parenthesis () denote variable declaration and specifies% that return value should be discarded()=printf("%s\n",strjoin(Keys[i]+"="+vals[i]," "));}}

See also

Related Research Articles

<span class="mw-page-title-main">AWK</span> Programming language

AWK is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems.

<span class="mw-page-title-main">Common Lisp</span> Programming language standard

Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ANSI INCITS 226-1994 (S2018). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived from the ANSI Common Lisp standard.

Forth is a stack-oriented programming language and interactive integrated development environment designed by Charles H. "Chuck" Moore and first used by other programmers in 1970. Although not an acronym, the language's name in its early years was often spelled in all capital letters as FORTH. The FORTH-79 and FORTH-83 implementations, which were not written by Moore, became de facto standards, and an official technical standard of the language was published in 1994 as ANS Forth. A wide range of Forth derivatives existed before and after ANS Forth. The free and open-source software Gforth implementation is actively maintained, as are several commercially supported systems.

MUMPS, or M, is an imperative, high-level programming language with an integrated transaction processing key–value database. It was originally developed at Massachusetts General Hospital for managing patient medical records and hospital laboratory information systems.

<span class="mw-page-title-main">Ruby (programming language)</span> General-purpose programming language

Ruby is an interpreted, high-level, general-purpose programming language. It was designed with an emphasis on programming productivity and simplicity. In Ruby, everything is an object, including primitive data types. It was developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan.

<span class="mw-page-title-main">Lua (programming language)</span> Lightweight programming language

Lua is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications. Lua is cross-platform, since the interpreter of compiled bytecode is written in ANSI C, and Lua has a relatively simple C API to embed it into applications.

HyperTalk is a discontinued high-level, procedural programming language created in 1987 by Dan Winkler and used in conjunction with Apple Computer's HyperCard hypermedia program by Bill Atkinson. Because the main target audience of HyperTalk was beginning programmers, HyperTalk programmers were usually called "authors" and the process of writing programs was known as "scripting". HyperTalk scripts resembled written English and used a logical structure similar to that of the Pascal programming language.

<span class="mw-page-title-main">Visual IRC</span> Open source Internet Relay Chat client

Visual IRC (ViRC) is an open-source Internet Relay Chat client for the Windows operating system. Unlike many other IRC clients, nearly all of the functionality in ViRC is driven by the included IRC script, with the result that the program's behavior can be extended or changed without altering the source code.

IDL, short for Interactive Data Language, is a programming language used for data analysis. It is popular in particular areas of science, such as astronomy, atmospheric physics and medical imaging. IDL shares a common syntax with PV-Wave and originated from the same codebase, though the languages have subsequently diverged in detail. There are also free or costless implementations, such as GNU Data Language (GDL) and Fawlty Language (FL).

xHarbour is a free multi-platform extended Clipper compiler, offering multiple graphic terminals (GTs), including console drivers, GUIs, and hybrid console/GUIs. xHarbour is backward-compatible with Clipper and supports many language syntax extensions, greatly extended run-time libraries, and extensive third party support.

Harbour is a computer programming language, primarily used to create database/business programs. It is a modernised, open source and cross-platform version of the older Clipper system, which in turn developed from the dBase database market of the 1980s and 1990s.

<span class="mw-page-title-main">AutoIt</span>

AutoIt is a freeware programming language for Microsoft Windows. In its earliest release, it was primarily intended to create automation scripts for Microsoft Windows programs but has since grown to include enhancements in both programming language design and overall functionality.

<span class="mw-page-title-main">Scala (programming language)</span> General-purpose programming language

Scala is a strong statically typed high-level general-purpose programming language that supports both object-oriented programming and functional programming. Designed to be concise, many of Scala's design decisions are intended to address criticisms of Java.

In computer programming, an anonymous function is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for constructing the result of a higher-order function that needs to return a function. If the function is only used once, or a limited number of times, an anonymous function may be syntactically lighter than using a named function. Anonymous functions are ubiquitous in functional programming languages and other languages with first-class functions, where they fulfil the same role for the function type as literals do for other data types.

IBM System/36 BASIC was an interpreter for the IBM System/36 midrange computer.

<span class="mw-page-title-main">Rexx</span> Command/scripting/programming language

Rexx is a programming language that can be interpreted or compiled. It was developed at IBM by Mike Cowlishaw. It is a structured, high-level programming language designed for ease of learning and reading. Proprietary and open source Rexx interpreters exist for a wide range of computing platforms; compilers exist for IBM mainframe computers.

<span class="mw-page-title-main">Command-line interface</span> Computer interface that uses text

A command-line interface (CLI) is a means of interacting with a computer program by inputting lines of text called command-lines. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternative to the non-interactive interface available with punched cards.

Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful. Tcl casts everything into the mold of a command, even programming constructs like variable assignment and procedure definition. Tcl supports multiple programming paradigms, including object-oriented, imperative, functional, and procedural styles.

Smart Pascal is a Object Pascal programming language that is derived from Delphi Web Script and is adapted for Smart Mobile Studio, commercial development JavaScript machine code.

<span class="mw-page-title-main">Nim (programming language)</span> Programming language

Nim is a general-purpose, multi-paradigm, statically typed, compiled high-level systems programming language, designed and developed by a team around Andreas Rumpf. Nim is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C, C++, Objective-C, and JavaScript, and supporting compiling to those same languages as intermediate representations.

References

  1. Davis, John (26 November 2017). "A little bit about me". John E. Davis Software. Archived from the original on 1 June 2020. Retrieved 1 June 2020.
  2. "slang releases".
  3. Davis, John (4 March 2018). "S-Lang Software License Information". John E. Davis Software. Archived from the original on 1 June 2020. Retrieved 31 May 2020.
  4. Linux Bible 2010 Edition: Boot Up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 13 Other Distributions, by Christopher Negus, Wiley, 2009, ISBN   978-0-470-48505-7, p.775
  5. "A Brief History of S-Lang" . Retrieved June 6, 2017.
  6. Getting more from your multicore: exploiting OpenMP from an open-source numerical scripting language, Noble, M. S., Concurrency and Computation: Practice and Experience Volume 20, Issue 16, pages 1877–1891, 2008, doi: 10.1002/cpe.1296
  7. "Mutt install guide" . Retrieved 2015-10-04.
  8. MySQL Developer's Library, by Paul Dubois, Pearson Education, 2009, ISBN   9780672329388, section 6.1
  9. Linux application development, by Michael K. Johnson and Erik W. Troan, Addison-Wesley, 2005, ISBN   9780321219145, p513