The LScript language is a simple and small scripting language based on LISP. It is written in Java and could easily be used to customize applets or applications. It provides a simple extension mechanism which allows adding further capabilities by providing language plugins written in Java (similar to TCL/TK). Due to the nature of LISP (almost everything worth noting is a function), even new control structures could be added easily:
The LScript interpreter does not attempt to emulate large LISP systems like Common Lisp or Scheme. Instead, it provides a small and easy-to-use language which has inherited it's major character from LISP like languages. The basic LScript system comes with the following plugins:
For now you may take a look at the LScript Short Reference which gives an overview of the most important features.
java gk.lscript.LScript "(println 1)"creates the output:
1 <eof>To compute the sum from 1 to 100 one could use the following program sum.lsp:
(setq sum 0) (setq i 1) (while (<= i 100) (setq sum (+ sum i)) (setq i (add1 i))) (println "sum(1..100) = " sum)which is invoked using:
java gk.lscript.LScript @sum.lspThe output is:
sum(1..100) = 5050 <eof>To further demonstrate the capabilities of the LScript language, I wrote a simple Applet which executes LScript code given as an argument inside the paint() method. A simple GraphicPlugin provides AWT line drawing capabilites which are used to create a number of graphical effects. Switch to the example page to view some of the results. The LScript interpreter has some JDK 1.1 code in it so you need at least IE 4 or NS 4 to load the applets.