View Full Version : A few questions about scripting languages...

06-03-2007, 12:09 PM
I was just wondering how scripting languages work. Are the commands in a scripting language just functions from a higher level language like C++, C, or something of the sort or am I completely wrong?

06-03-2007, 12:23 PM
Something tells me I'm not going to get an answer to this question...

06-03-2007, 02:09 PM
Certainly not in 14 minutes, obviously. Maybe a bit of patience is warranted...?

However, from what I've seen, the scripting language is C-like, and most of the scripts I've seen others write are strictly their own creation.

06-03-2007, 02:16 PM
What I was saying was that this type of question isn't normally answered when I ask it, but thank you!!:)

06-03-2007, 03:53 PM
I'll answer with an example that I know how to do.

In Java you can use BeanShell as a scripting language. BeanShell is based on Java, but is not compiled, it is interpreted at the time its run, so that makes it slower but easier to tweek and test.

In the Java code you invoke an instance of Beanshell and pass it a reference to an object from the Java code.

So the Java code can start BeanShell scripts.


The code in BeanShell can read and send information to the Java classes/methods using the reference it was given.

06-03-2007, 06:49 PM
So, for instance, if I were to write a scripting language based off C++ would I use functions to define the commands and then design the program to interpret it in real-time?

06-03-2007, 07:04 PM
Yes, more or less.

You have to write a parser that reads and parses the lines and acts on command words that you make up. Way too much trouble really since there are piles of languages you can use as script languages.

Its one of those things where if you have have to ask, its not worth doing it :)

Programmers with time to kill enjoy doing stuff like this. 3D artists model their favorite LW book. :)

06-05-2007, 07:49 AM
Indeed there are many scripting languages. Lua, Python, Pearl, Ruby, JavaScript, etc. Most people do not need to worry about writing their own scripting language though (why re-invent the wheel?). Instead, most coders will be binding their C or C++ code to the scripting languages already out there, as function calls, or classes, etc.

The main reason for binding compiled code to scripting languages is to separate the core application from the rest. That way if you want to change the content you will not have to recompile the program. Instead you can edit the script on the fly, and see the changes instantly in your application.

Think of it like what Fprime does for rendering..

Of course you can use most scripting languages on their own. I use them every day to write tiny little helper scripts to help maintain the system here at work.

And recently I've used XML and LUA in a game I was working on with some friends.

06-05-2007, 02:56 PM
Thanks, I have a few books here on C++ and after I am done reading them I'm planing a writing an application of pretty good size and was going to test myself by making a scripting language for it. Thanks for the info.:thumbsup: