Jump to content
  • Advertisement
Sign in to follow this  
Kochol

Cyrus Script is now open source

This topic is 2752 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all
Today I decide to make my script language available to others as open source.

About Cyrus Script
Cyrus Script is a script language similar to C written in C++ The main feature of Cyrus Script is its speed, It is really fast. In the early test it was just 15% slower than C++ and Its design is unique and you can bind it to your project very easily.

It has not any virtual machine and it use pointer to functions, pointer to member functions and pointer to members to run your script commands so it doesn't need stack :D or anything that slow the script languages.

It language features is not very much yet but I open sourced this in hope to get some help to improve this script language.

Here is the project page on sf.net
https://sourceforge.net/projects/cyrusscript/

The only way that you can get it is from svn.
svn co https://cyrusscript.svn.sourceforge.net/svnroot/cyrusscript cyrusscript

Here is the official site for the script language.
http://cyrusscript.com/

[Edited by - Kochol on December 28, 2010 2:41:03 AM]

Share this post


Link to post
Share on other sites
Advertisement
On your cyrusscript page it says:
Quote:

Taken from http://cyrusscript.com/about/
It has not any virtual machine and it use pointer to functions, pointer to member functions and pointer to members to run your script commands so it doesn't need stack or anything that slow the script languages.

But you may not have a virtual machine class, but you do have a lot of the functionality. You do have the instructions, you do have data. Most script languages have a virtual machine class. In cyrusscript, the script/instruction stream is the VM itself. It's a quite interesting idea.

You say 'In the early test it was just 15% slower then C++.', Not to criticize, but those are early test, wait till you implement script functions, structures, classes, etc. The performance will drop. But it's still very good that you're at such a performance.

But then how do you keep record of data if you don't use a stack, I can't seem to find this in your source code. How do you pass variables/operands to functions.

I must say, some of the implementation techniques used in cyrusscript are very nice.

assainator

Share this post


Link to post
Share on other sites
Quote:
Original post by assainator
On your cyrusscript page it says:
Quote:

Taken from http://cyrusscript.com/about/
It has not any virtual machine and it use pointer to functions, pointer to member functions and pointer to members to run your script commands so it doesn't need stack or anything that slow the script languages.

But you may not have a virtual machine class, but you do have a lot of the functionality. You do have the instructions, you do have data. Most script languages have a virtual machine class. In cyrusscript, the script/instruction stream is the VM itself. It's a quite interesting idea.

But then how do you keep record of data if you don't use a stack, I can't seem to find this in your source code. How do you pass variables/operands to functions.

assainator


Thanks for your interest in Cyrus Script

The first thing that I want to say is that the cyrus script is in early production and it's an idea just works :D

In my current game project I start to search for a script to bind it to my project but the bindings was difficult and the speed was low.

So I start to code my own script language that uses pointer to functions then I create Cyrus Scripts.

The problem that I had was when you have a function that the return type is not a pointer.
for solving this problem I add a temp buffer that copy an instance from returned function value and store it to the buffer so if your functions returns pointers then your scripts can run even faster.


//! Call the function and return its return
virtual void* InCallRet()
{
Treturn t = (*m_pObj.*m_pFun)(*_arg1);

return m_pPool->PushBack((void*)&t, m_iSize);
} // InCallRet


For now my script dose not support functions
But I add a syntax that you can call another script from current script but your script can't call itself.

here is an example
we have a scriptTest1 then we set its n parameter which is an integer to 15

scriptTest1.set("n", 15);
scriptTest1.Run();
int a = scriptTest1.get("n");

Share this post


Link to post
Share on other sites
Quote:
Original post by Kochol

The problem that I had was when you have a function that the return type is not a pointer.
for solving this problem I add a temp buffer that copy an instance from returned function value and store it to the buffer so if your functions returns pointers then your scripts can run even faster.


//! Call the function and return its return
virtual void* InCallRet()
{
Treturn t = (*m_pObj.*m_pFun)(*_arg1);

return m_pPool->PushBack((void*)&t, m_iSize);
} // InCallRet



I'm sorry, but this is a stack, you temporary store data witch is pushed and popped in a last on, first of method.

May I ask what books/articles you have read about the subject?

assainator

Share this post


Link to post
Share on other sites
Yes you are right.
It is a stack :D

I use this article for creating the script
http://www.flipcode.com/archives/Implementing_A_Scripting_Engine-Part_1_Overview.shtml

Share this post


Link to post
Share on other sites
Hey, I just downloaded and compiled your package. I thought I inform you about the error you get because of the missing "unistd.h" on windows.
It gets #included in lex.cpp, line 26.
Commenting that line out seems to have fixed the problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by mind in a box
Hey, I just downloaded and compiled your package. I thought I inform you about the error you get because of the missing "unistd.h" on windows.
It gets #included in lex.cpp, line 26.
Commenting that line out seems to have fixed the problem.


It is not always a guaranteed fix.. You just stuff it away to see if it works, unitstd.h is a header for accessing the POSIX API.

Has been discussed on stackoverflow as well:

http://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c

Share this post


Link to post
Share on other sites
Quote:
Original post by mind in a box
Hey, I just downloaded and compiled your package. I thought I inform you about the error you get because of the missing "unistd.h" on windows.
It gets #included in lex.cpp, line 26.
Commenting that line out seems to have fixed the problem.


I added an empty unistd.h file to the folder to solve this problem.
The lex.cpp is created by flex and you don't need unistd.h file under windows.
You can comment it.

If you have any question I will happy to help you.

Share this post


Link to post
Share on other sites
Cyrus Script speed becomes very low when you want to calculate some math on script. I think it disable CPU cache or others feature on CPU when it wants to calculate your math commands and it become very slower than C++.

I start a research on OpenCL to attach it to the Cyrus script to boost the performance on math calculations.

Do you think it's a good idea to add OpenCL to Cyrus script?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!