Summary
The Lua programming language is an extension programming language, which holds special interest to me and anyone who is implementing any kind of interpreter.
Advertisement
I have been studying Lua for the last several days, as a possible engine for the HeronScript interpreter.
HeronScript is a strict subset of the Heron language. It is intended as a way for programmers to extend their applications on the fly, for debugging, testing, user-side scripting, etc. (yes, I was inspired by Smalltalk),
Implementing HeronScript is a lot of work, but I recently realized that I could save a lot of work by using Lua as a backend. What I am considering doing is converting HeronScript into Lua and calling the Lua C Api functions to do the work of managing variable and function names for me. The only major difference between HeronScript and Lua is that HeronScript is statically typed, but I can achieve the same effect by inserting type-checking function calls into the generated Lua source.
It seems to me that anyone who wants to implement a scripting language, might want to consider this approach of converting to Lua, and using the Lua interpreter as a back-end. The only thing I need to do now is figure out whether the work needed to convert HeronScript to Lua, is signficantly less than building an interpreter from scratch.
> If you like Lua, you need to look at Io. > > http://www.iolanguage.com/about/ > > It was inspired by Lua but it carries things in a far more > OO direction. It's the most interesting language I've > seen in a couple of years.
I appreciate you sharing the link, I hadn't considered IO at all. On a preliminary examination, I can't yet tell what advantages it might have over Lua, in your opinion are there any, and what might they be?
It's simpler. It doesn't have any keywords. Everything is an object including the local context. No statements, just expressions. The code reads well, and it does lazy evaluation of arguments which allows it simulate macro semantics with methods. It handles object inheritance in a very flexible and economical way, using something called differential prototype inheritance.