Scripting languages are used in everything from games and Web pages to operating-system shells and general applications, as well as standalone scripts. They allow the harried developer to do his or her job without engaging in the full compile-test-edit lifecycle; with a script, it’s just edit-and-run.
For more programming jobs, click here.
Wren is a class-based concurrent open-source scripting language written in about 5,000 lines of C by ex-games programmer Bob Nystrom, author of the Games Programming Pattern book. Wren is intended to improve on the Lua scripting language via its class-based architecture. It’s small and fast and has a simple C API with less than ten function calls (it also requires a C99 compiler). Wren’s scripting language is compiled to bytecode and run by the Wren virtual machine; Bob’s benchmarks suggest it is quite a nippy beast.
IO.print(“Flying to “, city)
CandleScript is another single-developer scripting language. Developed by Henry Luo, Candle was built to solve issues with processing any hierarchical data. It treats markup data as a built-in data type and provides processing capabilities.
Candle has its own markup based on XML but with a cleaner data model; it supports not only Candle Markup but XML, XHTML, HTML, MIME messages, JSON and CSV. If you are into XSLT, XQuery, and the like, then this is one to check out.
Another thing to note: Candle goes beyond functional programming and includes procedural programming, so that it can provide flow control statements. Expressions are always functional.
let var = 123;
“Outer var: ” var <br/>
let var = 345;
“Inner var: ” var <br/>
Fancy is a general purpose, dynamic, object-oriented programming language heavily inspired by Ruby, Smalltalk and Erlang that runs on the Rubinius VM. Developed by Christopher Bertels, it is based on a message-sending system between objects; anyone familiar with Objective-C or Smalltalk should feel at ease with it. In an unusual twist for a Ruby-like language, there is built-in support for tuples. Here’s an example that calculates the 15th Fibonacci number:
case 0 -> 0
case 1 -> 1
case _ -> self – 1 fib + (self – 2 fib)
15 times: |x|
x fib println
Fancy is targeted at the Rubinius’s bytecode VM, which can use all of the CPU cores to run Ruby code fast. Rubinus runs on Mac OS X and many flavors of Unix/Linux, with Windows support coming soon.
Developed by Robert Osterlund, Pikt (short for Problem Informant/Killer Tool) is software for the monitoring and configuration management of Unix and Linux systems. A PIKT script looks more like a make file rather than a programming language; each script has one or more sections (init, begin, rule, end), and then individual lines are run. Below is a script that reports changes in crontab:
task “Report changes in (u) crontabs”
input proc “if [ -e =hstdir/log/(u).crontab.bak ];
then =diff =hstdir/log/(u).crontab.bak =hstdir/log/(u).crontab
else =cat =hstdir/log/(u).crontab 2>/dev/null; fi”
doexec wait “=crontab -u (u) -l > =hstdir/log/(u).crontab”
output mail $inlin
doexec wait “=mv =hstdir/log/(u).crontab =hstdir/log/(u).crontab.bak”
If you’re a system admin, Pikt is handy for reporting and fixing problems, scanning log files on single or networked systems, system configuration and more. There’s a bit of a learning curve, but that’s true of any powerful system. As with all of the scripting languages described here, it’s open source.
Following a name change from Obix, PPL is a cross-platform language that targets JVM, generating .jar or .class files. Created by developer Christian Neumanns to improve on Java with 100 percent null safety and reliability, the compiler checks for potential null pointer errors and flags them as a compile error. Other reliability features include Design by Contract, integrated unit testing, immutable objects by default, static typing and fail fast, which means detecting as many errors as possible at compile time. It plays nicely with Java, and scripts can include Java source code within them.
The example below shows a simple input/output and includes integrated unit testing:
in string type:string end
out result type:string end
o_result = i_string & i_string // simply return twice the input string
test // start of test script
test “a” // call co_double_string with i_string = “a”
verify v_result =v “aa” // verify result is “aa”
verify result =v “foofoo”
Although the language is a work in progress, the compiler, development environment and libraries are all PPL, so it has a fair degree of maturity and stability. Overall development status is definitely at alpha, but a beta isn’t likely too far off. You can use PPL to write small executable scripts, command line utilities and simple/complex Web applications using Java JSP/Servlet technology or PPL’s PAIOM (Practical Application Input/Output Manager), which provides application interface layers such as rich user interfaces for the Web, command line utilities and application-to-application communication.
See original article –