Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XbaseInterpreter evaluation(Exception: feature was simple feature call but got receiver instead of null)
XbaseInterpreter evaluation [message #1265606] Thu, 06 March 2014 10:04
Ana Farcasi is currently offline Ana FarcasiFriend
Messages: 1
Registered: March 2014
Junior Member
Dear all,

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:

!STACK 0
java.lang.IllegalStateException: feature was simple feature call but got receiver instead of null. Receiver: 10
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:894)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:881)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:863)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:218)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:196)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:182)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:173)
at org.xtext.example.newplatoon.generator.Master.createMasterText(Master.java:469)
at org.xtext.example.newplatoon.generator.NewPlatoonGenerator.doGenerate(NewPlatoonGenerator.java:41)
...

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.

Best regards,
Ana.
Previous Topic:How I can create a generator project for my DSL in Xtext?
Next Topic:Problem with automatic update of a P2 repository
Goto Forum:
  


Current Time: Thu Oct 22 14:22:45 GMT 2020

Powered by FUDForum. Page generated in 0.01859 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top