Reputation: 539
I'm having a look at XText within the Eclipse framework, and have a question about the arithmetics example. I seem to be able to parse expressions but not evaluate them and wonder if this should be so. This is my workflow:
Create a new Example projext. Choose XText Simple Arithmetics Example.
Open Arithmetics.xtext and choose Run -> External Tools -> Run as -> "Generate XText artifacts". No Error messages so far as. A bunch of info messages on the form:
119 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.xtext.example.arithmetics at 'file:/H:/2017/xtextworkspace/org.eclipse.xtext.example.arithmetics/'
119 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.eclipse.xtext.example.arithmetics.tests at 'file:/H:/2017/xtextworkspace/org.eclipse.xtext.example.arithmetics.tests/'
Open plugin.xml and click "Launch an Eclipse application". A second window now opens up and I can now create a new project and start typing expressions.
Create a new project and a new file calles a.calc with this content:
(I also seem to have to create a new Java project here which seems a bit counter-intuitive. Shouldn't it be possible in your new IDE to have a menu option here like "Create new Calc Project"?).
module A
def a:2;
def b:1;
a+b;
The editor seem to parse fine, content assist is working and it tells me if I do something wrong. But isn't it possible to actually run the program? I would like to have an option here similar to "Run -> Run as -> Calc application" Is this not included in the Arithmetics example? I feel like it should be because what else would be the purpose of the calculator.java class? How do I make it print out the value?
Upvotes: 0
Views: 102
Reputation: 11868
you get the expressions evaluated by typing "enter" inside the editor
module A
def a:2;
def b:1;
a+b;
// = 3
1+1;
// = 2
33*11;
// = 363
Upvotes: 1