Fair enough.
What about the spec for ECMA Script (what used to be called Java script)
which uses an interpreter
Im not sure about the ECMA standard...
But netscape/mozillia compiles into byte code and then uses a stack machine(?)
for a VM.
And Yes I wrote one of these for JS in C++.
Works really well.
But it for a C++ only byte code 3D engine and I don't want to make
it a RB plug in.
Plus my game engine is actually a 2D Game IDE.
Out side of visual programing systems BASIC a light version of
basic seems to be the easiest for none programmers to pick up.
I really prefer JS as a language compared to BASIC.
I guess what I was suggesting was since you mentioned you had preparsed the
script into a byte code style format that something along the lines of how
Java's VM interprets the byte codes would be appropriate from a style (but
not implementation) point of view.
They do similar styles of things in which operators are assigned a
particular byte code, and given that you know what the parameters and their
parsings are.
Heck, Excel does this for its cell expressions but these are a lot simpler
than a full blown interpreter.
This is actually what I am suggesting I do.
Take the Tokens/strings and turn them into number/bytecode/objects.
This would eliminate the string comparisons of most interpreters
and bring make it more of a byte code interpreter...
Which would be different from a compiler and stack machine like java.
In java etc you compile the script first and catch all your
syntax errors then.
Most interpreted languages would only give errors at run time.
So if part of the code never runs... you don't know there are errors etc.
Techincally the best implementation/fastest would be a byte code compiler
and VM/Stack mahcine of some sort.
From: Chris Dillman <chrisd at plaidworld dot com>
Reply-To: "REALbasic Network Users
Group"<realbasic-nug at lists dot realsoftware dot com>
Date: Tue, 29 May 2001 08:03:06 -0500
To: "REALbasic Network Users Group" <realbasic-nug at lists dot realsoftware dot
com>
Subject: Re: More On BASIC interpreter
well ... take a look at something like the spec for the java virtual
machines which has a lot of the byte code design you are thinking
of ... and
there's no reason you couldn't do something similar ...
I have and and I have made similar things. Example I have a
Java Script Byte code compiler and virtual stack machine done in C++
using ANTLR among other things.
Thats not what im looking for.
I wrote and interpreter this time cause I thought it would be easier.
Java style byte code needs a compiler
Then a stack machine etc to run it on.
That would be a total rewrite of what I have now.
From: Chris Dillman <chrisd at plaidworld dot com>
Reply-To: "REALbasic Network Users
Group"<realbasic-nug at lists dot realsoftware dot com>
Date: Tue, 29 May 2001 00:21:35 -0500
To: "REALbasic Network Users Group" <realbasic-nug at lists dot realsoftware dot
com>
Subject: More On BASIC interpreter
Ok thanks everyone.
I looked over theo's notes.
That helped a bit.
I don't think the string plug in will help at all.
I started speed testing the interpreter today.
It is really not to slow for a lot of uses.
It is just that I am using it for scripting behaviors for games.
For a few sprites on screen at a times it is great.
For 300 sprites all calling a behavior at 30 FPS
making 9000 script calls it is slow.
Adding MidB instead of Mid helped a bit.
The interpreter currently preprocess the scripts into tokens (strings).
Im thinking of doing more preprocessing and or possibly
turning the tokens into a kind of byte code of numbers....
aka IF would equal 1 etc.
I could modify the interpreter to use only numbers
this would cut out all the string comparisions...
Trade off the code would get kind of ugly fast
>>> with out a lot of comments.
It would probably be worth it.
Any other thoughts?
--
===========================================================
Technical Editor for http://www.idevgames.com
Support Programmer for http://www.desoftware.com
Owner, Plaid World Studios, http://www.plaidworld.com
Software Engineer for http://www.riskwise.com, Part of LexisNexis
A one-question geek test. If you get the joke, you're a geek:
Seen on a California license plate on a VW Beetle: "FEATURE"
============================================================
---
---
--
===========================================================
Technical Editor for http://www.idevgames.com
Support Programmer for http://www.desoftware.com
Owner, Plaid World Studios, http://www.plaidworld.com
Software Engineer for http://www.riskwise.com, Part of LexisNexis
A one-question geek test. If you get the joke, you're a geek:
Seen on a California license plate on a VW Beetle: "FEATURE"
============================================================
---
---
--
===========================================================
Technical Editor for http://www.idevgames.com
Support Programmer for http://www.desoftware.com
Owner, Plaid World Studios, http://www.plaidworld.com
Software Engineer for http://www.riskwise.com, Part of LexisNexis
A one-question geek test. If you get the joke, you're a geek:
Seen on a California license plate on a VW Beetle: "FEATURE"
============================================================
|