[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Why I selected Lua
- From: Quinn Tyler Jackson <quinn-j@...>
- Date: Sun, 04 Jul 2004 23:47:55 -0700
Some time ago, I incorporated Lua into my parsing engine as the reduction
callback language of choice.
I thought I would mention here why I did so.
This is what appears in the documentation's FAQ:
Q:
"Why was Lua chosen as the natively supported interpreted language of The
Grammar Forge?"
A:
The Lua programming language was chosen as the embedded interface language
of Meta-S parsing engine for several reasons:
* Lua is a highly dynamic, loosely-typed language designed to be easy to be
used by programmers with a wide range of skills (from amateur programmer to
coding guru). Those interested in parsing natural language, for instance,
should not have to be master C++ or C programmers to get real-world tasks
done when writing parsers. Writing Type 1 grammars is already complicated
enough without extra implementation-introduced artifacts making the matter
more unwieldy.
* Lua is garbage collected, thereby reducing implementation complexity in
parsing event code. This is particularly attractive given the sometimes
esoteric sequence of events that can occur during a parse and the complexity
of explicitly trying to keep track of memory allocations during a parse.
* The Lua interpreter is written in clean C and can be targeted to any
machine that supports a standard compliant C++ compiler. This is in keeping
with the philosophy followed throughout the implementation of the CLpm and
CShu hierarchy of classes: the engine should build on everything that
supports a decent C++ compiler, even in a world where "standard compliant"
does not always really mean "compliant".
* The Lua interpreter has a small footprint and therefore does not interfere
with the Meta-S parsing engine in any significant way.
* Lua and C++ interface well, with Lua's engine calling destructors for C++
objects that back their Lua façades. This is essential for proper memory
management, given that the Meta-S engine already takes advantage of
sophisticated memory management schemes that would likely break if the
interface language were not friendly.
* Lua's extensive debugging instrumentation made it very simple to implement
a visual debugger that integrates well with The Grammar Forge's IDE.
* Lua has a liberal license (see the Lua 5.0 license at the end of the
License Agreement).
* The Lua programming language has an active community of developers and
users.
--
Quinn Tyler Jackson
http://members.shaw.ca/qjackson/