The Idle Scripting Language
NEWS: the second beta version has been released on 1st of May 08.
top of page
By far the most significant change for this second beta is the addition of textual macros to Idle (similar to the C preprocessor). A macro can be a simple text replacement like this:
__DEFINE(JAMES_BOND,0x007) print(JAMES_BOND) --> prints 7
Or it can be more complex, with parameters:
__DEFINE(IF2(cnd,var,vtrue,vfalse),if cnd then var=vtrue else var=vfalse end) -- Later on, a call like this... IF2(i>5,n,i*i,j+j) -- ... expands to 'if i>5 then n=i*i else n=j+j end'
Macros can also be nested:
IF2(i>5,n,JAMES_BOND*i,JAMES_BOND+j)
Other than macros, there are a couple of new functions and a few minor changes. Please see the list of changes for a short description of those.
So what is Idle, then?
top of page
Idle is a simple but powerful scripting language, in basically the same vein as the venerable Perl or Python languages. It is, however, a much more lightweight application. At the core of Idle sits a tweaked and enhanced version of Lua. Idle inherits from Lua its elegant and powerful language definition as well as a highly-optimised interpreter kernel (an extremely fast compiler is included as well). Idle, like Lua, is readily extended with additional functions and libraries (which can be written either in C/C++ or in Idle itself).
This small language kernel is complemented by an extensive collection of runtime libraries, almost all of which are squeezed into a single DLL (with a size of around 200 KB) plus a few supporting Idle modules.
The most basic Idle setup consists of just three files:
- idle.exe: this is the Idle interpreter. It reads and executes both .idle script files and .idol compiled byte code chunks (.idol is short for IDle Object Library).
- idlec.exe: this is the Idle compiler. It compiles a .idle script file either into an .idol byte code file or into a standard Windows executable. If compiling to a .exe file the compiler supports the GUI and console subsystems as well as compression and encryption. The compiler produces relatively small executables: a minimum Idle script like
print('.')
will produce a .exe file with a size of roundabout 9 KB. Even relatively big Idle scripts of, say, 80 KB length will typically compile to a .exe file of 40 KB or less.
- idle03.dll: this is the Idle runtime library. The DLL is already UPX compressed: attempts to shrink it any further will need some serious work.
More complex Idle scripts may well need further components of the Idle runtime library (for instance the networking module). However, the Idle compiler can easily integrate all required modules into the executable: such an .exe file only requires the DLL runtime. This makes it possible to deploy an Idle application simply by copying two files, the compiled .exe and the runtime DLL (idle03.dll).
Besides the Idle standard runtime module there are a few other modules, notably for networking and database/SQL connectivity. There are also direct interfaces to Perl and Tiny C.
Who needs another scripting language?
top of page
See the Idle FAQ for an answer to that and a few other questions.
The Idle documentation
top of page
The documentation for Idle comes in four main parts:
- Details about the Idle language itself (people already familiar with Lua may want to skim this file or skip to the main differences to Lua)
- The functions in the Idle runtime library and the additional modules
- How to use the Idle interpreter and compiler
- And finally some FAQs about Idle
If you want to get in touch about any aspect of Idle (I am especially interested in bug reports and feature suggestions), you can do so via either of the following channels:
- (preferred) send an email to idle.script@gmail.com or idle.script@thomaslauer.com
- or post a message via my website's contact page
- for most queries concerning the actual language core you could also try the Lua mailing list
Well, give all this a whirl and tell me what works and what, if anything, doesn't!