Forums

Small embeddable and OSI compliant language?

Started by Michael Zedeler September 6, 2007
Hi everybody.

This may be slightly off topic - I am looking for an embeddable script
interpreter or VM. If you know of any more appropriate groups to post
to, please let me know. It should have the following features:

 - Stand alone interpreter (or VM) should have very small memory
footprint (less than 500k on Windows).
 - Reasonably high level programming language (on par with python/Java/
Ruby).
 - Available on all Windows platforms since Windows 98 as well as
Linux and Mac OS X.
 - Must be available under an Open Source license.
 - Actively developed by well established community or organization.
 - A reasonable number of extra modules available.
 - Must be possible to deploy stand alone applications written in the
language without requiring cumbersome install processes.
 - A small "Hello world" program including interpreter (or VM) and
nessecary libraries for deployment should take up no more than
approximately 500k.

Things that would be nice to have:

 - Bindings to GTK, TK or other cross platform GUI library.
 - POSIX sockets.
 - Some kind of IDE. Eclipse/Visual Studio integration would be best.

So far, my best take is Lua. I had a look at Caml Light, but it looks
somewhat academic and outdated. Most larger script languages (such as
perl, python) has all of the features above, except that the final
payload quickly reaches 2M which is too large.

Regards,

Michael.

> This may be slightly off topic - I am looking for an embeddable script > interpreter or VM. If you know of any more appropriate groups to post > to, please let me know. It should have the following features: > > - Stand alone interpreter (or VM) should have very small memory > footprint (less than 500k on Windows).
Half a Meg heh? Gee, that is small.
> - Reasonably high level programming language (on par with python/Java/ > Ruby). > - Available on all Windows platforms since Windows 98 as well as > Linux and Mac OS X. > - Must be available under an Open Source license. > - Actively developed by well established community or organization. > - A reasonable number of extra modules available. > - Must be possible to deploy stand alone applications written in the > language without requiring cumbersome install processes. > - A small "Hello world" program including interpreter (or VM) and > nessecary libraries for deployment should take up no more than > approximately 500k. >
<snip> Wow - you are not asking for much then. Did you take a look at Pawn? It might do some of what you want, but definitely not all. I'm not to familiar with it myself but you didn't mention it as one of the options you had investigated so it might be worth a look. I know people use it with FreeRTOS.org. http://www.compuphase.com/pawn/pawn.htm -- Regards, Richard. + http://www.FreeRTOS.org 13 official architecture ports, 1000 downloads per week. + http://www.SafeRTOS.com Certified by T&#2013265948;V as meeting the requirements for safety related systems.
Michael Zedeler <michael@zedeler.dk> wrote:
> Hi everybody. > > This may be slightly off topic - I am looking for an embeddable script > interpreter or VM. If you know of any more appropriate groups to post > to, please let me know. It should have the following features: > > - Stand alone interpreter (or VM) should have very small memory > footprint (less than 500k on Windows). > - Reasonably high level programming language (on par with python/Java/ > Ruby). > - Available on all Windows platforms since Windows 98 as well as > Linux and Mac OS X. > - Must be available under an Open Source license. > - Actively developed by well established community or organization. > - A reasonable number of extra modules available. > - Must be possible to deploy stand alone applications written in the > language without requiring cumbersome install processes. > - A small "Hello world" program including interpreter (or VM) and > nessecary libraries for deployment should take up no more than > approximately 500k.
Lua might be what you are looking for. From the site http://www.lua.org: What is Lua? ------------ Lua is a powerful, fast, light-weight, embeddable scripting language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. Lua is written in almost 100% ansi C, and thus runs on about every piece of hardware with a few hunderd Kb of ram.
> Things that would be nice to have: > > - Bindings to GTK, TK or other cross platform GUI library. > - POSIX sockets. > - Some kind of IDE. Eclipse/Visual Studio integration would be best.
Those are all available, although not in the base lua install. You'll need 3d party libraries for that.
> So far, my best take is Lua. I had a look at Caml Light, but it looks > somewhat academic and outdated. Most larger script languages (such as > perl, python) has all of the features above, except that the final > payload quickly reaches 2M which is too large.
Oops, so you found Lua already. Note to self: first read, then type. Is there any reason why Lua can't do the job for you? -- :wq ^X^Cy^K^X^C^C^C^C
On Sep 6, 8:32 am, Michael Zedeler <mich...@zedeler.dk> wrote:
> Hi everybody. > > This may be slightly off topic - I am looking for an embeddable script > interpreter or VM. If you know of any more appropriate groups to post > to, please let me know. It should have the following features: > > - Stand alone interpreter (or VM) should have very small memory > footprint (less than 500k on Windows).
Sounds like this is not for an embedded microcontroller or processor, but rather for a PC application, right? Lua and Pawn are terrific choices, bur rhere are many choices when it comes to a PC running Windows. It depends on what you feel comfortable with, and what is most likely to fit with your implementation language (probably C?). The target language of Pawn is more like C, and Lua is more like BASIC, but both are implemented in C. Of course, you can use a real Basic interpreter if you want. Eric
On Sep 6, 8:32 pm, Michael Zedeler <mich...@zedeler.dk> wrote:
> Hi everybody. > > This may be slightly off topic - I am looking for an embeddable script > interpreter or VM. If you know of any more appropriate groups to post > to, please let me know. It should have the following features: >
Personally I'd recommend Tcl. This is what it was originally designed to do and has been highly successful in the CAD/CAM market.
> - Stand alone interpreter (or VM) should have very small memory > footprint (less than 500k on Windows).
On-disk footprint on windows is roughly 500k though RAM footprint is 1.5M. If low memory is really important you could look at older interpreters especially in the Tcl7 family. I've seen one running with only around 500-600k of RAM. All Cisco routers have Tcl7 installed instead of the current Tcl8 probably due to low memory footprint requirements.
> - Reasonably high level programming language (on par with python/Java/ > Ruby).
Tcl fits the bill.
> - Available on all Windows platforms since Windows 98 as well as > Linux and Mac OS X.
Tcl runs on IBM mainframes and AS/400s, Windows NT, 95, 98, ME, XP, Windows/CE, OS/2, Novell Netware, Cray supercomputers, Digital's VMS, Tandem Guardian, HP MPE/ix, Mac OS, and all flavours of Unix, as well as dozens of smaller operating systems like Acorn RISCOS, Amiga and Atari ST.
> - Must be available under an Open Source license.
BSD license.
> - Actively developed by well established community or organization.
In addition by being actively developed by the Tcl Core Team, Tcl is also actively supported by ActiveState.
> - A reasonable number of extra modules available.
Depends on what "reasonable" means. Tcl certainly has more third party extensions/modules out there than Lua but not nearly as much as Perl.
> - Must be possible to deploy stand alone applications written in the > language without requiring cumbersome install processes.
Google "freewrap" and "starpack". They basically append your script to the end of an interpreter's executable.
> - A small "Hello world" program including interpreter (or VM) and > nessecary libraries for deployment should take up no more than > approximately 500k.
As I've said, the on-disk footprint of Tcl (as a dll) is roughly 500k. The interpreter executable is around 20k. I'd expect a statically linked interpreter to therefore be around 550-600k.
> Things that would be nice to have: > > - Bindings to GTK, TK or other cross platform GUI library.
Tcl is the natural choice for Tk. Though Tk adds around 500k to both memory and on-disk footprint. It should be noted that most languages that binds to Tk does it by first binding to Tcl. This is because the default Tk distribution uses Tcl heavily for startup scripts. Indeed experience from Perl shows us that Tk when used with Tcl can lead to much *smaller* memory footprint than Tk without Tcl (this may seem counter-intuitive but that's what happened). So if you decide to use Tk with another scripting language like Lua or Perl you'll actually end up running *two* interpreters -- the scripting interpreter you're using and Tcl running in the background servicing Tk. So I'd suggest cutting out the third wheel and use Tcl/Tk directly.
> - POSIX sockets.
Only TCP/IP. There is an extension that supports UDP/IP but I don't know of any extension that supports the full family (Unix domain sockets, raw sockets etc..).
> - Some kind of IDE. Eclipse/Visual Studio integration would be best. >
Eclipse has Tcl support. Though I'd strongly suggest checking out ActiveState's Komodo IDE (the Komodo editor is free but the full fledged IDE costs $$).
> So far, my best take is Lua. I had a look at Caml Light, but it looks > somewhat academic and outdated. Most larger script languages (such as > perl, python) has all of the features above, except that the final > payload quickly reaches 2M which is too large. >
I typically deploy my code by "freewrapping" them into a single executable. Freewrap IS quite heavy at 1.2M (this includes Tk by the way) but bear in mind that freewrap also statically links the dde, registry, zlib/zvfs and winico (for icon manipulations under windows) extensions. If I need to distribute on floppies (yes, clients do still use them) I use older versions of freewrap which comes in under 1M.