Not able to complete the tutorial
Hi, I have a newbie question.
I am currently walking through the calculator language tutorial. I nearly completed the "Implementing generator" section. I have come into trouble in the place where it says "Now, let's generate our language and take a look at what happens with the sandbox model. As you can see, MPS generates exactly the code that we wanted". Actually, it does not (and that is the problem). I probably made a mistake somewhere.
Here is the generated code of the update() method:
Not surprisingly, the error message says:
calculator/sandbox/sandbox/MyCalc.java : Syntax error on token "=", delete this token (line: 57)
Could please anybody give a tip where things could go wrong? As far as I can see, my code (is it code in MPS? I do not know) looks the same as it does on the images from the tutorial.
BTW, I really have no idea what is that "reduction rule" for InputFieldReference and what is the purpose of that code fragment {int i; i = 1 + <TF ->$[i] TF}. I did that rule anyway.
I have MPS 2.0.1.
Best regards,
Dmitry
I am currently walking through the calculator language tutorial. I nearly completed the "Implementing generator" section. I have come into trouble in the place where it says "Now, let's generate our language and take a look at what happens with the sandbox model. As you can see, MPS generates exactly the code that we wanted". Actually, it does not (and that is the problem). I probably made a mistake somewhere.
Here is the generated code of the update() method:
int i_a = 0;
int i_b = 0;
int i_c = 0;
try {
= Integer.parseInt(inputField_a.getText());
= Integer.parseInt(inputField_b.getText());
= Integer.parseInt(inputField_c.getText());
} catch (NumberFormatException e) {
}
outputField_a.setText("" + (2 + 3 + 9 + ));
Not surprisingly, the error message says:
calculator/sandbox/sandbox/MyCalc.java : Syntax error on token "=", delete this token (line: 57)
Could please anybody give a tip where things could go wrong? As far as I can see, my code (is it code in MPS? I do not know) looks the same as it does on the images from the tutorial.
BTW, I really have no idea what is that "reduction rule" for InputFieldReference and what is the purpose of that code fragment {int i; i = 1 + <TF ->$[i] TF}. I did that rule anyway.
I have MPS 2.0.1.
Best regards,
Dmitry
Please sign in to leave a comment.
Best regards,
Dmitry