The Game Creators
The Game Creators Home Online Shop Click to Login
  Hot: Christmas CompetitionNovember NewsletterModel Pack 36DB Pro Pack 2009DGS BonanzaCharacter PackFPS Creator Bonanza;
The Game Creators
WIP / JemSCRIPT

Go to the first page of this board Return to the Forum Menu Post Message
26 Messages - Page   of 1   
Bookmark and Share Search the Forum

Author Message
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 25th May 2007 17:27     Edited: 25th May 2007 18:59     | link | toggle

Hello everyone and I am finally back again with the new JemScript. I apologise for posting all those rediculous intrpreted versions, but hey, I learned alot from it.

Now I am back with a much better (but not yet finished) version of Jem. Actually, it is not linked in anyway with DBPro just now, because it's fully written in C++, but that doesn't matter, because I intend to make it a dll, so, heh.

Features:
- C-Style syntax
- Typed variables/functions
- Compiles to bytecode
- Virtual machine is provided to run the bytecode (pretty pointless if it wasnt)

That's about it for features. I guess I could add that it's alot faster than my last one because it's compiled, not interpreted.

This is currently what it looks like now:
+ Code Snippet
//Random function
void foo()
{
    
    float bleh = 3.14;
    print bleh;
}

//Main
void main()
{

    //Variable
    int lol[5];
    
    //Some if thing
    if ((3 + (6-2) < 10) && (5 >= 2))
    {

        //Stuff
        print ( lol[2] );
        endline;
    }
    
    //Call function
    foo();
    
    //End
    terminate "Done...";

}


Ofcourse, I soon intend to add classes. Ever since I got into C++ I haven't been able to program without OO

So yeah, post your comments and critiques, and we'll see how it goes!

Back to top
Report this message as abusive
Aaron Miller

User


Joined: Sat Feb 25th 2006
Location: Behind the trusty dumpster.
Posted: 26th May 2007 05:35           | link | toggle

Zotoaster you are some kind of a genius! I can't wrap my head across building a parser for something like THAT. Quite simply amazing. And as I said, if you need to build a DLL, you are most certainly welcome to use my Dev-C++ template for it. (Strip the DBP command section though, you won't need it)

Keep up the amazing work!

Cheers,

-db

Back to top
Aex.Uni Send AIM user a message
Report this message as abusive
Benjamin

User


Joined: Sun Nov 24th 2002
Location: France
Posted: 26th May 2007 05:42           | link | toggle

Sounds interesting, I'm also working on a scripting language. I'm quite proud of my tokenizer that can tokenize the FPSC game source code (27K lines) in 52ms, but that's just bragging.

I'm not sure of the point of making it too C-like, after all there are other scripting languages around that are. I think it's possible to simplify the syntax while still retaining the power and flexibility.

Anyway, looks like you've done well so far. Congratulations!

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 26th May 2007 07:21           | link | toggle

Thanks for the comments

The reason I decided to have such C syntax is because that the features I intend to add (pointers and classes mostly) arent that often used in BASIC, so I figure that more people would be happy with it like it is.

Once I have finished the preprocessor, I will make a set of defines that will give it a simpler syntax

Back to top
Report this message as abusive
Chris Franklin_

User


Joined: Thu Dec 21st 2006
Location: Home
Posted: 26th May 2007 14:34           | link | toggle

Very cool man, keep it up

Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 26th May 2007 14:57           | link | toggle

Thank you.

I'm just installing the DX SDK. Very soon (with some help from Kentaree ) you will be able to call DBP commands from the script, heh.

Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 26th May 2007 16:50           | link | toggle

I think you are right about the syntax thing. I am strongly considering doing something about that. Lol, it's really getting a neucance, well, only having types functions and variables.

You guys dont have a problem with just function foo() and var bar[] right?

Back to top
Report this message as abusive
zenassem

User


Joined: Mon Mar 10th 2003
Location: Long Island, NY
Posted: 26th May 2007 23:20           | link | toggle

I am really looking foward to this Zotoaster. As you can see with regard to my scripting inquiries and Python interest. I think that you could follow some of Pythons syntax. I can provide some examples from the book I have. It's a lot like c++ - the annoying factor.

Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 27th May 2007 05:47           | link | toggle

Zen, I think it's best that since it has alot of features like C++, to make it similar. Makes the majority of people comfortable with it.

But luckily, I have a very flexible parser. If you wanted, you could write it like this:

+ Code Snippet
`Random function
void foo()
open
    
    float bleh = 3.14;
    print bleh;
close

`Main
void main()
open

    `Variable
    int lol[5];
    
    `Some if thing
    if ((3 + (6-2) < 10) && (5 >= 2))
    open

        `Stuff
        print ( lol[2] );
        endline;
    close
    
    `Call function
    foo();
    
    `End
    terminate "Done...";

close


Not much different really, but it seems people dont really like {}s

Am I right in thinking that Python has forced indentation with no {}s? That would make it totally stack-less as far as I can see, something that's so needy in my scripting that it would mean I'd have to start from the begining again and completely redesign the bytecode and virtual machine Something that I think is a bad choise - sorry mate!

Any other requests, comments, critics?

Back to top
Report this message as abusive
Aaron Miller

User


Joined: Sat Feb 25th 2006
Location: Behind the trusty dumpster.
Posted: 27th May 2007 06:11           | link | toggle

I like the C++ way. But too be honest, I REALLY prefer to be able to give types to variables so I know what they are. Is it possible that you can keep "var" as an "any" type, and add in "float", "int", "char", etc?

Cheers,

-db

Back to top
Aex.Uni Send AIM user a message
Report this message as abusive
The Nerd

User


Joined: Sat Jun 5th 2004
Location: Denmark
Posted: 27th May 2007 06:15           | link | toggle

Looks promising Zotoaster Keep up the good work! And good luck with it.

Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 27th May 2007 06:17           | link | toggle

Thanks Nerd.

Alright DB User, I can give it another shot It just got really annoying most of the time, but hey, I'm sure I can work around it a little better this time.

Back to top
Report this message as abusive
Aaron Miller

User


Joined: Sat Feb 25th 2006
Location: Behind the trusty dumpster.
Posted: 27th May 2007 06:31           | link | toggle

ok.
Awsome to hear all this, keep up the good work. (Glad it's finally a WIP )

Cheers,

-db

Back to top
Aex.Uni Send AIM user a message
Report this message as abusive
Google Ad
Back to top
 
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 1st Jun 2007 19:17           | link | toggle

Just some news. Since the restart I have already improved on it quite a lot. The actual compilation stage isn't finished, but it's going well. As far as the virtual machine is concerned, it can now handle parameters (only be value so far), and return values, so using functions in equations works quite the thing. Really annoying having to type in every bytecode seperatally though, like 3 lines for a single-element variable (not an array in other words). Hopefully I'll have the compiler itself working enough by tomorrow so proper scripts can be run. Also virtual memory management has been improved, and it's not as low-level feeling (i.e. every piece of data in memory having to be an int), so that should make things alot easier to work with (for me anyway, heh).

As DB User recommended, I still keep typed variables, but not functions They were just annoying, and I think went a bit too C-ish.

I have also been able to clean up the actual code quite alot, seems to happen when I restart a project, but yeah, now it should probably run faster and be more efficient.

Here is a boring example just for the heck of it:
+ Code Snippet
function sqrt(float num)         <-- Function must be created before it's called
{
    float result;

    if (num > 0)
    {
        result = num ^ 0.5;
    }
    return result;              <-- Woo! Return values!
}

function main()                <-- Enta here
{
    print sqrt(25);            <-- Simple typecasting between int and float
}


Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 17th Jun 2007 18:38     Edited: 17th Jun 2007 18:41     | link | toggle

During yesterday and today I've been working to make a simpler, less buggy, scripting language, but added some features.

It has no types, and doesnt support arrays (they were a bitch to work), but it does work more stably, and I have decided to add tables, like Lua, but with [] instead of {}. I've also make working loops.

The reason I did this was to see if the features I wanted to add at first were even that useful. I only want functionality in my scripts, and even though flexibility is good, it is pointless unless you are using it to write anything big (ie the game engine). I only want to for things like AI, etc. So, no need for arrays, types variables, etc.

Here is a working, very stable (and fast) example, of using functions, parameters, variables and tables:
+ Code Snippet
//Database
database = [
    a = 3;
    node = [
        b = 4;
    ]
]


//Addition
function add(var a, var b)
{
    return a+b;
}


//Main function
function main()
{

    var a = getTable("database.a");
    var b = getTable("database.node.b");
    print add(a, b);
    
}


Obviously, that wont be very good in a game, but using the features here, it can be.

I think this will do for JemSCRIPT to be perfectly honest. All I have to do is add a few operands (like ++), get the ability to read table values directly from C++, make it call DBPro commands, then just make it a dll. Tada! Problem is, I don't have a clue how to do the last two.. I'm sure I'll figure it out though

P.S. Forgot to mention that just like the last one, this one compiles to bytecode too.

Back to top
Report this message as abusive
MartinS

User


Joined: Thu Dec 15th 2005
Location: Rochester, NY
Posted: 18th Jun 2007 04:22           | link | toggle

Hands down, this thing is sweet! The database functionality is a real improvement, and it kills XML. Quick question: Rather than doing + Code Snippet
if (something=somethingelse)
{
   dothis
}
, is it possible to do + Code Snippet
if (something=somethingelse) {
   dothis
}
?

Keep up the good work!
G2L

Back to top
MartinS\' Music
Report this message as abusive
MartinS

User


Joined: Thu Dec 15th 2005
Location: Rochester, NY
Posted: 18th Jun 2007 04:23           | link | toggle

Oh, and can you do block comments? e.g.+ Code Snippet
/*
a block comment
another commented line
etc.
*/


Back to top
MartinS\' Music
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 18th Jun 2007 09:23     Edited: 18th Jun 2007 10:11     | link | toggle

G2L,

You can set out the syntax however you like Also, it should be ==, not =

As for block comments, I forgot to add them, but I might aswell just do that now, heh.

Thanks for the comments


[edit]
Just got rid of the annoying "getTable()" function thing. Now you can just do something like:
+ Code Snippet
database = [
   a = 42;
   answer = database.a;
]

function main()
{
   print database.answer;
}


Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 18th Jun 2007 18:43     Edited: 18th Jun 2007 19:12     | link | toggle

*Bump*

I decided to re-add the getTable() function (but obviously still keep the other method), because the fact that it used strings was pretty useful. It means you can loop through a table, sorta like an array.

So you may have guessed that already I have made some typecasting. There are 3 typecasting functions, string(), int() and float(). I'm sure you know what each does. Each one takes all types apart from it's own.

Here's an example of looping through a table and printing the data:
+ Code Snippet
//Player database
players = [

    player1 = [
        name = "Starsky";
    ]
    
    player2 = [
        name = "Hutch";
    ]

]




//Main function
function main()
{

    //First player
    var plr = 0;

    //Loop through names
    do
    {
    
        //Increase player
        plr = plr + 1;
        
        //Display data
        print getTable("players.player" + string(plr) + ".name");
        
        //Exit
        if (plr > 2){ break; }
    
    }
    
    
}


Back to top
Report this message as abusive
Xenocythe

User


Joined: Thu May 26th 2005
Location: You Essay.
Posted: 18th Jun 2007 20:23           | link | toggle

Going awesome man. Looks really nice. Keep up the great work

Back to top
XenMedia.org
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 22nd Jun 2007 15:50           | link | toggle

Thanks Xeno.

Small update:

Again, I restarted, as usual, for better table functionality. Even though I havent actually started making the tables yet, I have done something that I haven't in all my last implementations... an "else" statement!!!

Demo:
+ Code Snippet
/*
Multi
line
comments
work
too
btw
*/
//Max
function max(var a, var b)
{
    if (a > b)
    {
        return a;
    }
    else
    {
        return b;
    }
}


//Main
function main()
{
    var a = 10;
    var b = 4;
    print max(a,b);
    endl;
}


Back to top
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 23rd Jun 2007 08:21           | link | toggle

Bump:

Table's semi-working. Still have to make instancing, then we have OOP!!

+ Code Snippet

players = [

    player1 = [

        var _name;
        var _age;
        function set(var Name, var Age)
        {
            _name = Name;
            _age = Age;
        }

    ]

]

function main()
{
    players.player1.set("Zotoaster", 102);
    print players.player1._name; endl;
    print players.player1._age; endl;
}





Back to top
Report this message as abusive
MartinS

User


Joined: Thu Dec 15th 2005
Location: Rochester, NY
Posted: 23rd Jun 2007 08:29           | link | toggle

Looking good. Do you have an expected release date?

G2L

Back to top
MartinS\' Music
Report this message as abusive
Zotoaster

User


Joined: Mon Dec 20th 2004
Location: Scotland
Posted: 23rd Jun 2007 08:36           | link | toggle

Well, once I get tables finished, and when I get it to call DBP commands, and then figure out how to make it a DLL, then I'll release it

Back to top
Report this message as abusive
Blue Rogue

User


Joined: Fri Jul 6th 2007
Location: Cyberspace
Posted: 9th Jul 2007 20:46           | link | toggle

hey good work. Im currently writing a scripting engine thats really more of an interpreter. But I would love to take it to the next level as you have done here. Do you have any good online sources you may be willing to share so I can investigate going about creating something similar to ByteCode.
Back to top
Report this message as abusive
Blue Rogue

User


Joined: Fri Jul 6th 2007
Location: Cyberspace
Posted: 9th Jul 2007 20:54           | link | toggle

scrub that post.. just found a site. but thanks anyway.
Back to top
Report this message as abusive

Go to the first page of this board Return to the Forum Menu Post Message
26 Messages - Page   of 1   
Search the Forum

Sorry, but it has been so long since anyone replied to this Thread that it has been automatically locked.
You may read it but not reply.

Forum Search

Enter a word or phrase to search our Forum for:

Thread Subject Search
Search Phrase:
Search Scope: Entire forum
Just this board
 
Google Forum Search
Search Phrase:
 
Apollo v2.02


Dark Game Studio
Privacy Policy AUP Top of Page