Slashdot Mirror


Lightweight Scripting/Extension Languages?

Andy Tai asks: "Extension languages are designed to be embedded in applications to support customization of the application behavior. Common scripting languages, like Perl and Python, are fairly 'large' with powerful run-time engines and libraries and are widely available and 'script' writers usually assume their stand-alone existences in the deployment environment. However, if one is looking for a language that's small enough so its source can be embedded in the distribution of and built as part of the application, Python and Perl may be 'overweight.' For the real lightweight choices there are Lua and Tinyscheme. Are there others? What are people's preferences and opinions regarding lightweight extension languages?"

13 of 176 comments (clear)

  1. Guile by crmartin · · Score: 3, Informative

    God knows the words "lightweight" and "Gnu" don't generally go together, but how about Guile?

  2. TinyTCL by the_womble · · Score: 3, Informative
    what about Tiny TCL

    Its easy to learn and use (very good if the people using our embeded language are not programmers). Its mature, supposed to be extensible, and if you decide you need something more powerful later on even the current full verion is not that bloated.

    1. Re:TinyTCL by Twylite · · Score: 4, Informative

      Tcl/Tk proper is not a bad idea either. If one does not need the GUI part (Tk) then Tcl is relatively easy to integrate into a project, and is under 200k.

      HowToEmbed from the Tcl Wiki is a good starting point, and MkTclApp may help.

      Tcl has very consistent and simple syntax (although it can get rather confusing at times), and it is very simple to add new command into your application that are exposed via Tcl. One of the nicest aspects of Tcl is that is it seriously multi-platform.

      Of course this all depends on the requirements: how powerful does the language need to be, what functions must it provide, what types do you need it to be able to handle, how small is "lightweight", etc.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    2. Re:TinyTCL by ianezz · · Score: 4, Informative
      One of the nicest aspects of Tcl is that is it seriously multi-platform.

      Another nice aspect of Tcl is that it can easily evaluate code in a different stack frame (example: in the caller's context), and source code can be easily passed to procedures as strings between braces (as it is usually done), so extending/reimplementing the language control structures is as simple as writing a new procedure (and no special/ugly syntax is required).

      That's as close to Lisp macros as you can get.

  3. REBOL by the_greywolf · · Score: 3, Informative

    didn't see anyone else mention it, so i thought i would.

    REBOL is a ridiculously simple and easy-to-learn web-oriented language. so easy, in fact, that i wrote a fully-functional IRC dice bot in under 400 lines, overnight. and if that weren't impressive, then might i add that i was running on ZERO caffeine, learning the language for the first time, learning IRC Client protocol for the first time, and came up with a few unusually witty statements and insults to boot?

    now the bad part: REBOL is not open source. poo. (i really was a bit disappointed.) but REBOL/Core is free (for any use, i gather), and the license fees for View and Command seem rather reasonable.

    the nice part: it has been ported to and runs on about 43 platforms, last i checked, and is light enough that the executable weighs in at around 250kb for the win32 release. (haven't used the other platforms, so no comment.)

    it runs on just about every unix i've heard of, on every relatively common configuration, and works beautifully and seamlessly. and, after a quick glance, i see it runs on serveral major embedded systems, including WinCE, QNX, and Linux, and will even run on my friend's dated Amiga.

    enjoy and happy coding. :)
    --
    grey wolf
    LET FORTRAN DIE!
    1. Re:REBOL by swdunlop · · Score: 3, Informative

      I had a very guilty love for REBOL, but it hasn't changed much in the last three years.. Many of the warts on REBOL/View are still there, and it's still not fully documented. They also haven't finished their port to OS X, so it isn't as perfectly cross platform as I would like..

      And.. Finally.. How does one embed REBOL in an open source application?

  4. Developing for windows? by KILNA · · Score: 4, Informative
    --
    Error: PANTS NOT FOUND. Press <F1> to continue.
  5. Object Forth? by samjam · · Score: 4, Informative

    ficl.sourceforge.net

    A portable object oriented forth at less than 100K for a full implementation, able to handle calls from your apps as well as call your apps fgunctions or other dll's.

    Under a BSD-ish license.

    The upside:
    1) Its tiny
    2) The forth code you write will be tinier

    Downsides:
    1) You need to learn forth (I mean properly) to appreciate it.

    Forth is unlike most other languages, it was designed to avoid the debug, recompile cycle that is so common.

    Sam

  6. How about JavaScript? by Rich · · Score: 5, Informative

    I've been working on a system for embedding JS in KDE apps (amongst other reasons it is a about 1/10 the size of a python interpreter). You can find lots of information at http://xmelegance.org/kjsembed. The interpreter in KDE has no dependency on KDE/Qt or anything else so you might find it usable in your app.

  7. Copy of an advogato article by DavidNWelton · · Score: 3, Informative

    I guess atai must have submitted the same question here as well, but the "original" discussion took place on advogato:

    http://www.advogato.org/article/735.html

    It would be useful if he could state what his requirements and limits are, in detail, because that's a very necessary part of evaluating what would work.

  8. Re:Javascript! by Anonymous Coward · · Score: 5, Informative
    Mozilla implementation of JavaScript in C is available at http://www.mozilla.org/js/ and pure Java implementation is at http://www.mozilla.org/rhino/

    And btw, ECMAScript/JavaScript can be pure functional as well.

  9. Consider Ruby by urbangipsy · · Score: 3, Informative

    What about Ruby (ruby-lang.org). It's easy to learn, powerful and has a reasonable set of classes and methods built-in. It's also quiet widespread nowadays, lightweight compared to Python and easy to embed via libruby.so
    see the Ruby book (section Embedding a Ruby Interpreter

  10. Check out Ferite by FireChipmunk · · Score: 4, Informative

    Ferite is a scripting language and engine all in one managable chunk. It is designed to be easily extended in terms of API, and to be used within other applications making them more configurable and useful to the end user. It has a syntax similiar to a number of other langauges but remains clean and it's own language.

    I love that it was designed from the Start to be Thread Safe and Embeded, unlike PHP or Python.