Advertisement

My scirpting language...

Started by February 27, 2000 09:18 PM
2 comments, last by Mike 24 years, 6 months ago
I'm working on a scripting language and I would apriciate some criticism on the work I've done thus far. I'm writting it in C++, and it is intended to be a general purpose scripting language. I'm not to taribly far along yet (onlye 1500 line of code into the project), but I figure that if I get some advice now I can make the changes. To abtain the source code goto: mike010.hypermart.net Please let me know what you think of the web page (Once you go there you will see the humor in this sentence). Edited by - Mike on 2/27/00 9:21:34 PM
I made a scripting language a few weeks ago... It was really basic... (something akin to PBASIC). I had two main classes: command and variable. I derived all the different possible commands from the command class. When the file was loaded by the script enterpreter, the appropriate command object was created by a "compiler" function, and then stored in a linked list. This has the advantage of very easy implementing of goto and gosub(). Then, at run time, you just need to call the Execute() member function of the currently executing command, and because of polymorphism, bingo! Instant scripting language... sorta.

--------------------


"Very funny Scotty, now beam down my clothes."
www.trak.to/rdp

Yanroy@usa.com

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Advertisement
Interesting implementation. What ever you do there are two places where you will live and die by your implementation. The first is when the script is parsed into commands. These commands are usually put into some sort of list. From there your other problem spot will be the execution of these commands in the list.

The only other thing you might want to do in your language is have it return error codes. If it does then having some way to look up what those codes mean is another place that you could find a bottleneck. Though, this will only occur after your error codes list begins to get longer. Good luck.

Kressilac
Derek Licciardi (Kressilac)Elysian Productions Inc.
kressilac, are you saying that i have an interisting implementation or that Yanroy does?

i''m pretty sure i''ve got the exicution down (although i''m currently hearing an arguement that suggests otherwise); however the parsing is my trouble. I''m thinking that I will have the lexer go through the actual text file and build the symbol trees that I will need and creating a "token" stream at the same time. The parser will then take to token stream and put the tokens into a syntax tree in the correct order. getting the "tokens" into the syntax tree in the right order is the challenge.

This topic is closed to new replies.

Advertisement