S-Lang
From Wikipedia, the free encyclopedia
S-Lang is an interpreted programming language designed by John E. Davis to provide extensibility to applications written in other programming languages via language embedding. Created in 1992, its original syntax reflected its origins as a stack-oriented language, but the current syntax is very much like that of C. S-Lang is small, simple and dynamically typed. Because of its size and ease-of-embedding, S-lang has been embedded in programs such as slrn and JED.
The display routines which are provided by the S-lang library are also used in other applications than Davis's own slrn Usenet newsreader and JED editor. These include Mutt and Lynx as an alternative to curses or ncurses. Most applications that use the S-lang library use only these display routines. If they were a separate library, it would be smaller than most curses libraries. The display routines provide similar features to curses, but cannot be used interchangeably since they do not provide all of the features of curses, e.g., overlapping windows.
[edit] Example code
Here is how to implement the factorial function using S-Lang:
define factorial (); % declare it for recursion define factorial (n) { if (n < 2) return 1; return n * factorial (n - 1); }