|XbaseInterpreter evaluation [message #1265606]
||Thu, 06 March 2014 10:04
| Ana Farcasi
Registered: March 2014
I am working on a DSL for platoons of Lego mindstorms. I am generating code in NXC from the DSL model. In the models I have a command that instructs the robots to move forward for a certain distance. I have a working version of the DSL where the distance is an integer.
Now I switched to a new version of the DSL, where I use the partial language Xbase for the distance attribute of the forward command. In this new language, I the distance is of type XExpression. So, when the user types "forward(10 + 2)" in the DSL, I want to generate code in NXC that moves the robots forward with 12 units.
I have modified the grammar accordingly and I injected the xbase interpreter into the generator. Then I simply used the evaluate method with the XExpression argument on the interpreter. When I type a simple integer as a distance in the forward command, then the Xbase interpreter correctly outputs the integer as a result of the evaluation, but when I write "10 + 2" as the distance in the foward command, I obtain the following exception:
java.lang.IllegalStateException: feature was simple feature call but got receiver instead of null. Receiver: 10
In another version I also injected the evaluation context provider and the interpreter, and I used the evaluate method on the interpreter with the XExpression and IEvaluationContext arguments, but I obtain the same exception.
I followed the stack trace and I am not able to grasp the exact problem. I think I am using the interpreter in a wrong way. If anyone could please give me any hints on where the problem could be, I would be really grateful.
Powered by FUDForum
. Page generated in 0.01859 seconds