- addressing events - this includes events itself and their attributes which can be primitive types, collection, dictionaries, other events ...
we use a "." notation for this e.g. Event1.Attr1.Attr2 can be used to address the Attribute "Attr1" of Event1 which in this case again is a Event where the Attribute "Attr2" is evaluated. For Collections we use the Syntax Attr1 and for Dictionaries Attr1["Test"]
- Constant values (e.g. Strings "Test", integer 12, float 12.5f, boolean true|false, ...)
- calculation at least we need to calculate +,-,+,/ and % (modulo)
- boolean expressions AND, OR, XOR, NOT
- comparison expressions =, if possible chained
Now you can do things like this:
Event1 ev1 = new Event();
ev1["Attr1"] = 12;
ev1["Attr2"] = 15;
ev1["Attr3"] = 1;
EAExpression expr = EAExpression.Compile("Attr1 < Attr2 + Attr3");
bool val = (bool)expr.Evaluate(ev1);
This is just a very simple example where the first 4 lines shows how an event is created.
We have learned several things while building the language:
- don't be afraid to create one for a specific purpose - some times it is really useful to do it
- it was much less work than I expected, because there are several tools out there that can help you
- the language you build should be as simple and easy as possible. Don't try to do fancy stuff or allow several ways to do the same thing. This will be more confusing than helpful to users.
- in the end we needed to introduce defined functions e.g. Now() for the DateTime. Now in C# which was a little bit tricky
- Autocompletition and syntax highlighting for user inputs within the GUI - I will post as soon as we have it and how we will solve it because i think it is a very important part of languages for business folks.