Related articles |
---|
Looking for scripting suggestions ev@hysar.frmul.com (2001-07-30) |
Re: Looking for scripting suggestions joachim_d@gmx.de (Joachim Durchholz) (2001-08-02) |
Re: Looking for scripting suggestions erictetz@yahoo.com (Eric Tetz) (2001-08-02) |
Re: Looking for scripting suggestions george.goffe@seagate.com (2001-08-02) |
Re: Looking for scripting suggestions jimbo@radiks.net (2001-08-02) |
Re: Looking for scripting suggestions joshualevy@yahoo.com (2001-08-02) |
Re: Looking for scripting suggestions Ron@Profit-Master.com (Ron Pinkas) (2001-08-02) |
Re: Looking for scripting suggestions plakal-nospam@nospam-cs.wisc.edu (Manoj Plakal) (2001-08-08) |
Re: Looking for scripting suggestions fmfab@chez.com (Fabrice Medio) (2001-08-15) |
[2 later articles] |
From: | "Eric Tetz" <erictetz@yahoo.com> |
Newsgroups: | comp.compilers |
Date: | 2 Aug 2001 02:32:20 -0400 |
Organization: | Cisco Systems Inc. |
References: | 01-07-166 |
Keywords: | interpreter |
Posted-Date: | 02 Aug 2001 02:32:20 EDT |
"Spam MeNot" <ev@hysar.frmul.com> wrote in message
> I'm looking for a scripting library that can be embedded in an
> application. What I want is fairly simple, but difficult to locate.
I recently went through the exact same search. I whole heartedly recommend
Lua. www.lua.org
> First, the syntax has to be simple and comfortable. I need for
> non-programmers to be able to generate these simple scripts.
Lua was designed to be easy for non-pros to use. Clean, Pascal-like syntax.
> Second, the language should be non-typed. This makes it easier for
> new users to pickup.
Lua.
> Next, and this one is a bit strange, I don't want it able to do a
> great deal of processing. The idea is that these scripts could do
> simple conditional checks and validations on data entry, but any
> serious processing would be delegated to a remote service.
Not Lua. :( Lua is a full featured language.
> Also, it needs to be embeddable and simply extendable. I will be
> wanting to add access to certain functions in the host environment
> that the script is running in. The main application is written in
> C/C++.
Lua was designed to be embedded and easily extensible.
> Finally, it should be small. I'm not looking for a "DO EVERYTHING"
> type language.
Well, Lua is small. Around 60Kb for the whole language, including it's
standard library. If you leave out the standard library (leaving only
application defined functions), and leave out the scanner/parser/code
generator (you would have to pre-compile scripts to byte-code), it can be as
small as 24Kb. Yet it is a full-featured language.
> As I started poking around, I thought perhaps JavaScript would do the
> job. It's syntax is familiar (to web developers and programmers) and
> has some of the other features. The SpiderMonkey version from
> Mozilla, but it was a bit cumbersom to use.
I liked JavaScript, too. Especially the way it uses associative arrays as
the uber-data structuring mechanism (it's similar to Lua in this regard).
But, as you discovered, it's a bit large. The Mozilla implementation will
add around 300KB to your application. The Mozilla implementation is not
very fast, either, though Microsoft's implementation flat-out *screams*
(must be JIT).
> I also though strongly of TCL. This is what it was originally
> designed for, but it is growing into a full platform of it's own.
> Also, though I like TCL, it's syntax is a bit odd.
TCL, besides being large and slow, also happens to be a pretty crappy
language IMHO. For details, including Richard Stallman's "Why you should not
use Tcl", see:
http://www.people.virginia.edu/~sdm7g/LangCrit/Tcl/
> Lastly I considered a flavour of BASIC. This one has potential. As I
> want the scripts to manipulate data fields and call other methods, I'm
> not certain I need any form of OO.
Lua is procedural, but has meta-mechanisms that allow one to do OO.
> So basically, if you were developing an application that could load
> different control pages (think of a web browser that loads different
> web pages) and you wanted to be able to embed simple
> control/validation scripting into the pages, what would you consider
> using for a language?
Lua is tiny, fast, and powerful, has highly portable source, is easy to
embed, and is easy for newbies to learn; it has been nothing but a pleasure
to use.
To see what the code looks like for your self, check out the Great Computer
Language Shootout.
http://www.bagley.org/~doug/shootout/
Besides the performance comparisons, this page has source for several
routines implemented in a dozen different languages. You can easily compare
Lua and Tcl source here.
Cheers,
Eric
Return to the
comp.compilers page.
Search the
comp.compilers archives again.