Jump to content
  • Advertisement
Sign in to follow this  
winplusx

Angel Script BNF grammar

This topic is 4871 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

Advertisement
I don't have this fully written down. Part of it can be seen in the as_parser.h file, but it's been a while since I updated it.

It is pretty similar to the way C or C++ works though, so maybe you can use the BNF grammar for one of them as base.

What do you need it for?

Share this post


Link to post
Share on other sites
Pointers were removed from the AngelScript language as of version 2.0.0. Objects can use object handles instead, which are similar to pointers, but are reference counted (which is why only objects can use them).

What kind of application do you use that needs to generate rules? Is it some kind of editor?

I'll try to write a document with the complete BNF grammar, though I can't say when that would be finished. If you are interested in helping out with that document, I would be grateful.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I plan to use angel script in an automatic stock trading system as trading rule- when to buy ,when to sell,etc. I am now testing the ability of angel script. I think it is very powerful. :)

how to access simple array in host c++ application, such as 'float *a'.

I wrote the program like this , but it does not work:
...
int a[100];
engine->RegisterObjectType("int[]", sizeof(int *), asOBJ_CLASS);
engine->RegisterGlobalProperty("int[] a",&a);
...

script:

a[0]=1;


Share this post


Link to post
Share on other sites
You have to register an array object. I just use the std::vector class for everything. Deyja has a class that will autmatically register it for various types.

Share this post


Link to post
Share on other sites
AngelScript arrays are not compatible with C++ arrays, since AngelScript needs to do bounds-checking, etc.

If you want to be able to pass arrays between C++ and AngelScript, you'll have to override AngelScripts built-in array type with a type that both AngelScript and C++ can understand.

As Rain Dog said, you can do this by registering the std::vector implementation, using Deyja's code. That code is available in the AngelScript zip file, under /tests/test_feature/source/stdvector.h.

Regards,
Andreas

PS. I'm not sure if I'd like to let a computer program do my stock exchange business' for me [wink], but even so it is an interesting project you have going there.

Share this post


Link to post
Share on other sites
If you need to pass pointers around between your script objects. I found that wrapping boost::any in a simple object with a templated get member function seems to work well and keep things relatively type-safe. Let me know if you are interested and I'll post the code here...

~Scott

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!