Angel Script BNF grammar
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?
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?
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
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
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;
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;
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.
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.
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.
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
~Scott
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement