Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » LanExpressions
LanExpressions [message #1792265] Fri, 13 July 2018 16:23 Go to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Hello.
I am having difficulties with implementing expressions in my DSL.

I have read https://typefox.io/parsing-expressions-with-xtext multiple times but still I am struggling to get it right.

Attached, please find DSL's .text file and some sample statements that needs to be parsed by the DSL.

Special Note:
Assignments and Equality Comparisons HAVE to share the same operator "="

Request
Please help me,
[*] understand what I am doing wrong.
[*] modify the DSL to be able to correctly parse the examples.mydsl

Thanks,
Christoff
Re: LanExpressions [message #1792266 is a reply to message #1792265] Fri, 13 July 2018 16:25 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Apologies, for bad topic name.
Re: LanExpressions [message #1792267 is a reply to message #1792265] Fri, 13 July 2018 16:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

this is not a expression problem.

Atomic returns Expression:
	var=[VariableDef]		|
	val=[ConstDef]			|
	{IntConstant} value=INT	|
	{StringConstant} value=STRING
	;



is parsed as

Atomic returns Expression:
	var=ID		|
	val=ID			|
	{IntConstant} value=INT	|
	{StringConstant} value=STRING
	;



which is ambigous

=> you have 2 options
(1) introduce a diffent syntax for var and val references
(2) unify them into one reference

Atomic returns Expression:
	varorval=[VariableOrConstDef]		|
	{IntConstant} value=INT	|
	{StringConstant} value=STRING
	;

VariableOrConstDef: VariableDef | ConstDef; 


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: LanExpressions [message #1792299 is a reply to message #1792267] Sun, 15 July 2018 16:44 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
@Christian Dietrich, thanks for pointing out "VariableOrConstDef". Oops... My bad, silly mistake.

But, my problems are not yet over. :( . Refer to Parsing Errors below.

I have spent some time and:
1) Tried to debug the language using AntlrWorks,
as suggested by https://blogs.itemis.com/en/debugging-xtext-grammars-what-to-do-when-your-language-is-ambiguous.
To be honest, debugging of the Language got the better of me. I really need some help, thus Point (2) below.

2) Created a github project for my version of ExpressionDSL (github project link)

3) Created some initial Unit tests for the expected Parsing, refer ExpressionDSLParsingTest.xtend

4) Quick link to ExpressionDSL.xtext language definition

Request:
Please guide me on how to change the ExpressionDSL.xtext, to be able to succesfully pass the ExpressionDSLParsingTest.xtend unit tester.

Maven Install Error Log (extract):
Running org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest
log4j:WARN No appenders could be found for logger (org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser).
log4j:WARN Please initialize the log4j system properly.
Tests run: 15, Failures: 8, Errors: 0, Skipped: 0, Time elapsed: 1.59 sec <<< FAILURE! - in org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest
testExpressionOr(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.434 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:5 missing '(' at 'bC', XtextSyntaxDiagnostic: null:5 missing ')' at ';', XtextSyntaxDiagnostic: null:6 missing '(' at 'bB', XtextSyntaxDiagnostic: null:6 missing '(' at 'bC', XtextSyntaxDiagnostic: null:6 missing ')' at ';', XtextSyntaxDiagnostic: null:7 missing '(' at 'bC', XtextSyntaxDiagnostic: null:8 missing '(' at 'bB', XtextSyntaxDiagnostic: null:8 missing ';' at 'or', XtextSyntaxDiagnostic: null:8 missing ')' at 'bC', XtextSyntaxDiagnostic: null:8 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:8 mismatched input '<EOF>' expecting ')'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testExpressionOr(ExpressionDSLParsingTest.java:248)

testExpressionComparison(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.023 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:23 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:24 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:25 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:26 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:27 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:28 extraneous input '(' expecting ')'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testExpressionComparison(ExpressionDSLParsingTest.java:353)

testExpressionUnaryPlusOrMinus(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.019 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:1 mismatched input ':' expecting ';', XtextSyntaxDiagnostic: null:11 no viable alternative at input '-', XtextSyntaxDiagnostic: null:12 no viable alternative at input '+', XtextSyntaxDiagnostic: null:14 no viable alternative at input '-', XtextSyntaxDiagnostic: null:15 no viable alternative at input '+', XtextSyntaxDiagnostic: null:17 no viable alternative at input '-', XtextSyntaxDiagnostic: null:18 no viable alternative at input '+', XtextSyntaxDiagnostic: null:21 no viable alternative at input '-', XtextSyntaxDiagnostic: null:21 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:22 no viable alternative at input '+', XtextSyntaxDiagnostic: null:22 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:23 no viable alternative at input '-', XtextSyntaxDiagnostic: null:23 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:23 no viable alternative at input 'iA', XtextSyntaxDiagnostic: null:23 no viable alternative at input 'iB', XtextSyntaxDiagnostic: null:23 no viable alternative at input ')', XtextSyntaxDiagnostic: null:23 extraneous input ')' expecting ';', XtextSyntaxDiagnostic: null:25 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:26 mismatched input '(' expecting ';'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testExpressionUnaryPlusOrMinus(ExpressionDSLParsingTest.java:441)

testDeclarations(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.005 sec
testExpressionAtomic(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.005 sec
testFuncationCall01(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.003 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:2 no viable alternative at input ')'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testFuncationCall01(ExpressionDSLParsingTest.java:80)

testFuncationCall02(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.005 sec
testExpressionExponent(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0 sec
testExpressionAnd(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.012 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:5 missing '(' at 'bC', XtextSyntaxDiagnostic: null:5 missing ')' at ';', XtextSyntaxDiagnostic: null:6 missing '(' at 'bB', XtextSyntaxDiagnostic: null:6 missing '(' at 'bC', XtextSyntaxDiagnostic: null:6 missing ')' at ';', XtextSyntaxDiagnostic: null:7 missing '(' at 'bC', XtextSyntaxDiagnostic: null:8 missing '(' at 'bB', XtextSyntaxDiagnostic: null:8 missing ';' at 'and', XtextSyntaxDiagnostic: null:8 missing ')' at 'bC', XtextSyntaxDiagnostic: null:8 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:8 mismatched input '<EOF>' expecting ')'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testExpressionAnd(ExpressionDSLParsingTest.java:280)

testExpressionPrecedence(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0 sec
testAssignment01(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.014 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:23 mismatched input '=' expecting '(', XtextSyntaxDiagnostic: null:23 missing ';' at 'testfuncNoParmsReturnsINT', XtextSyntaxDiagnostic: null:23 no viable alternative at input ')', XtextSyntaxDiagnostic: null:24 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:25 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:26 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:27 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:28 mismatched input '(' expecting ';'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testAssignment01(ExpressionDSLParsingTest.java:172)

testExpressionFunctionExp(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.007 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:9 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:9 no viable alternative at input 'cA', XtextSyntaxDiagnostic: null:10 no viable alternative at input 'NOT', XtextSyntaxDiagnostic: null:10 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:10 no viable alternative at input 'cA', XtextSyntaxDiagnostic: null:12 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:14 mismatched input '(' expecting ';'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testExpressionFunctionExp(ExpressionDSLParsingTest.java:482)

testExpressionMulOrDiv(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0 sec
testExpressionBinaryPlusOrMinus(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0 sec
testExpressionPrimary01(org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest)  Time elapsed: 0.008 sec  <<< FAILURE!
java.lang.AssertionError: Unexpected errors: XtextSyntaxDiagnostic: null:6 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:8 missing ';' at 'bA', XtextSyntaxDiagnostic: null:8 missing '(' at 'not', XtextSyntaxDiagnostic: null:8 missing '(' at 'and', XtextSyntaxDiagnostic: null:8 missing '(' at 'bC', XtextSyntaxDiagnostic: null:8 missing ')' at ';', XtextSyntaxDiagnostic: null:9 missing '(' at 'and', XtextSyntaxDiagnostic: null:9 missing '(' at 'not', XtextSyntaxDiagnostic: null:9 mismatched input ')' expecting '(', XtextSyntaxDiagnostic: null:9 missing ')' at ';', XtextSyntaxDiagnostic: null:10 missing '(' at 'or', XtextSyntaxDiagnostic: null:10 missing '(' at 'bB', XtextSyntaxDiagnostic: null:10 missing ';' at 'and', XtextSyntaxDiagnostic: null:10 mismatched input 'not' expecting ')', XtextSyntaxDiagnostic: null:10 missing ')' at 'bC', XtextSyntaxDiagnostic: null:10 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:12 mismatched input 'bA' expecting ')', XtextSyntaxDiagnostic: null:12 no viable alternative at input '=', XtextSyntaxDiagnostic: null:12 mismatched input 'not' expecting ')', XtextSyntaxDiagnostic: null:12 missing ')' at ';', XtextSyntaxDiagnostic: null:13 mismatched input '(' expecting ')'
	at org.xtext.example.expressiondsl.tests.ExpressionDSLParsingTest.testExpressionPrimary01(ExpressionDSLParsingTest.java:522)


Results :

Failed tests: 
  ExpressionDSLParsingTest.testAssignment01:172 Unexpected errors: XtextSyntaxDiagnostic: null:23 mismatched input '=' expecting '(', XtextSyntaxDiagnostic: null:23 missing ';' at 'testfuncNoParmsReturnsINT', XtextSyntaxDiagnostic: null:23 no viable alternative at input ')', XtextSyntaxDiagnostic: null:24 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:25 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:26 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:27 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:28 mismatched input '(' expecting ';'
  ExpressionDSLParsingTest.testExpressionAnd:280 Unexpected errors: XtextSyntaxDiagnostic: null:5 missing '(' at 'bC', XtextSyntaxDiagnostic: null:5 missing ')' at ';', XtextSyntaxDiagnostic: null:6 missing '(' at 'bB', XtextSyntaxDiagnostic: null:6 missing '(' at 'bC', XtextSyntaxDiagnostic: null:6 missing ')' at ';', XtextSyntaxDiagnostic: null:7 missing '(' at 'bC', XtextSyntaxDiagnostic: null:8 missing '(' at 'bB', XtextSyntaxDiagnostic: null:8 missing ';' at 'and', XtextSyntaxDiagnostic: null:8 missing ')' at 'bC', XtextSyntaxDiagnostic: null:8 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:8 mismatched input '<EOF>' expecting ')'
  ExpressionDSLParsingTest.testExpressionComparison:353 Unexpected errors: XtextSyntaxDiagnostic: null:23 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:24 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:25 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:26 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:27 extraneous input '(' expecting ')', XtextSyntaxDiagnostic: null:28 extraneous input '(' expecting ')'
  ExpressionDSLParsingTest.testExpressionFunctionExp:482 Unexpected errors: XtextSyntaxDiagnostic: null:9 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:9 no viable alternative at input 'cA', XtextSyntaxDiagnostic: null:10 no viable alternative at input 'NOT', XtextSyntaxDiagnostic: null:10 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:10 no viable alternative at input 'cA', XtextSyntaxDiagnostic: null:12 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:14 mismatched input '(' expecting ';'
  ExpressionDSLParsingTest.testExpressionOr:248 Unexpected errors: XtextSyntaxDiagnostic: null:5 missing '(' at 'bC', XtextSyntaxDiagnostic: null:5 missing ')' at ';', XtextSyntaxDiagnostic: null:6 missing '(' at 'bB', XtextSyntaxDiagnostic: null:6 missing '(' at 'bC', XtextSyntaxDiagnostic: null:6 missing ')' at ';', XtextSyntaxDiagnostic: null:7 missing '(' at 'bC', XtextSyntaxDiagnostic: null:8 missing '(' at 'bB', XtextSyntaxDiagnostic: null:8 missing ';' at 'or', XtextSyntaxDiagnostic: null:8 missing ')' at 'bC', XtextSyntaxDiagnostic: null:8 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:8 mismatched input '<EOF>' expecting ')'
  ExpressionDSLParsingTest.testExpressionPrimary01:522 Unexpected errors: XtextSyntaxDiagnostic: null:6 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:8 missing ';' at 'bA', XtextSyntaxDiagnostic: null:8 missing '(' at 'not', XtextSyntaxDiagnostic: null:8 missing '(' at 'and', XtextSyntaxDiagnostic: null:8 missing '(' at 'bC', XtextSyntaxDiagnostic: null:8 missing ')' at ';', XtextSyntaxDiagnostic: null:9 missing '(' at 'and', XtextSyntaxDiagnostic: null:9 missing '(' at 'not', XtextSyntaxDiagnostic: null:9 mismatched input ')' expecting '(', XtextSyntaxDiagnostic: null:9 missing ')' at ';', XtextSyntaxDiagnostic: null:10 missing '(' at 'or', XtextSyntaxDiagnostic: null:10 missing '(' at 'bB', XtextSyntaxDiagnostic: null:10 missing ';' at 'and', XtextSyntaxDiagnostic: null:10 mismatched input 'not' expecting ')', XtextSyntaxDiagnostic: null:10 missing ')' at 'bC', XtextSyntaxDiagnostic: null:10 mismatched input ';' expecting '(', XtextSyntaxDiagnostic: null:12 mismatched input 'bA' expecting ')', XtextSyntaxDiagnostic: null:12 no viable alternative at input '=', XtextSyntaxDiagnostic: null:12 mismatched input 'not' expecting ')', XtextSyntaxDiagnostic: null:12 missing ')' at ';', XtextSyntaxDiagnostic: null:13 mismatched input '(' expecting ')'
  ExpressionDSLParsingTest.testExpressionUnaryPlusOrMinus:441 Unexpected errors: XtextSyntaxDiagnostic: null:1 mismatched input ':' expecting ';', XtextSyntaxDiagnostic: null:11 no viable alternative at input '-', XtextSyntaxDiagnostic: null:12 no viable alternative at input '+', XtextSyntaxDiagnostic: null:14 no viable alternative at input '-', XtextSyntaxDiagnostic: null:15 no viable alternative at input '+', XtextSyntaxDiagnostic: null:17 no viable alternative at input '-', XtextSyntaxDiagnostic: null:18 no viable alternative at input '+', XtextSyntaxDiagnostic: null:21 no viable alternative at input '-', XtextSyntaxDiagnostic: null:21 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:22 no viable alternative at input '+', XtextSyntaxDiagnostic: null:22 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:23 no viable alternative at input '-', XtextSyntaxDiagnostic: null:23 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:23 no viable alternative at input 'iA', XtextSyntaxDiagnostic: null:23 no viable alternative at input 'iB', XtextSyntaxDiagnostic: null:23 no viable alternative at input ')', XtextSyntaxDiagnostic: null:23 extraneous input ')' expecting ';', XtextSyntaxDiagnostic: null:25 mismatched input '(' expecting ';', XtextSyntaxDiagnostic: null:26 mismatched input '(' expecting ';'
  ExpressionDSLParsingTest.testFuncationCall01:80 Unexpected errors: XtextSyntaxDiagnostic: null:2 no viable alternative at input ')'

Tests run: 15, Failures: 8, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] org.xtext.example.expressiondsl.parent 1.0.0-SNAPSHOT SUCCESS [  0.660 s]
[INFO] org.xtext.example.expressiondsl .................... SUCCESS [ 34.906 s]
[INFO] org.xtext.example.expressiondsl.ide ................ SUCCESS [  3.808 s]
[INFO] org.xtext.example.expressiondsl.ui ................. SUCCESS [  5.581 s]
[INFO] org.xtext.example.expressiondsl.target ............. SUCCESS [  0.036 s]
[INFO] org.xtext.example.expressiondsl.tests .............. FAILURE [ 11.577 s]
[INFO] org.xtext.example.expressiondsl.ui.tests 1.0.0-SNAPSHOT SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Re: LanExpressions [message #1792302 is a reply to message #1792299] Sun, 15 July 2018 18:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
i find it hard to "help" with such general questions. you should solve the stuff issue by issue.
one thing i dont understand is e.g.
is your grammar case insensitive if yes you have to tell xtext that
i dont understand your FunctionExp thingy
i dont understand functioncall
i dont understand your semicolon concept
i dont understand your unary expressions. usual pattrn is

UnaryExpression: MINUS Primary | Primary;
Primary: '(' Expressions ')' | Atom;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 15 July 2018 18:47]

Report message to a moderator

Re: LanExpressions [message #1792307 is a reply to message #1792302] Sun, 15 July 2018 22:59 Go to previous messageGo to next message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
Thanks for your valuable input.

Christian Dietrich

is your grammar case insensitive if yes you have to tell xtext that

Yes, it is suppose to be case insensitive. Fixed the mwe2 workflow.

Christian Dietrich

i dont understand your FunctionExp thingy

This my a temp at catering for the "user-defined functions" in the Expressions Precedence.
This is a pain point, that I am struggling to get right.

Christian Dietrich

i dont understand functioncall

The grammar is suppose to be procedural.
The procedure call, may or may not return a value.

1) Thus to cater for the procedure call returns a value, and to comply with the Expressions Precedence.
I created the "VariableAssignment" rule that references expressions of which the "FunctionExp"ression rule is part off.
===> variable = functioncall();

2) To cater for when the procedure call does not return a value, nor is part of an Assignment expression.
I created the "FunctionCall" rule.
===> functioncall();

Christian Dietrich

i dont understand your semicolon concept

Currently, All the statements should be terminated by semicolons ";".

Christian Dietrich

i dont understand your unary expressions. usual pattrn is

UnaryExpression: MINUS Primary | Primary;
Primary: '(' Expressions ')' | Atom;

Thanks for the suggestion, but would this not "break" the expected Expressions Precedence when creating the AST?

Conclusion:
The Expressions Precedence is a Pain in my ass, and I am clearly not implementing it correctly.

But my understanding is that to get the AST correct for later processing, I need to define the "Expression" rule correctly

Questions:
1) How critical is building the AST to comply with the Precedence rules?

2)Should I rather manipulate the AST after parsing has been done?

References:
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzasd/opprec.htm
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzasd/expropt.htm
/* Expressions Precedence:
* --> ()
* --> Built-in functions, user-defined functions
* --> unary +, unary -, NOT
* --> **
* --> *, /
* --> binary +, binary -
* --> =, <>, >, >=, <, <=
* --> AND
* --> OR
*
***/

[Updated on: Sun, 15 July 2018 23:00]

Report message to a moderator

Re: LanExpressions [message #1792316 is a reply to message #1792307] Mon, 16 July 2018 04:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
I mean:

why dont you dist. function call and function call statement. and fix functionexpr

FunctionCallStatement:
	call=FunctionCall ";"
;

FunctionCall:
	name=[FunctionDef]
	('('
 		(params+=Expression (':' params+=Expression)*)?
 	')')
 		
;

UnaryPlusMinusOrNot returns Expression:
	 (
	 ({UnaryPlus}'+' right=FunctionExp | {UnaryMinus}'-'  right=FunctionExp) | ('NOT' right=FunctionExp)
	
	) |FunctionExp;
FunctionExp returns Expression:
	Primary | (
		(func=FunctionCall)
	);


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: LanExpressions [message #1792320 is a reply to message #1792316] Mon, 16 July 2018 06:40 Go to previous message
Christoff Erasmus is currently offline Christoff ErasmusFriend
Messages: 32
Registered: December 2016
Member
It works. Thanks.

[INFO] org.xtext.example.expressiondsl.parent 1.0.0-SNAPSHOT SUCCESS [  0.352 s]
[INFO] org.xtext.example.expressiondsl .................... SUCCESS [ 41.408 s]
[INFO] org.xtext.example.expressiondsl.ide ................ SUCCESS [  3.404 s]
[INFO] org.xtext.example.expressiondsl.ui ................. SUCCESS [  5.133 s]
[INFO] org.xtext.example.expressiondsl.target ............. SUCCESS [  0.031 s]
[INFO] org.xtext.example.expressiondsl.tests .............. SUCCESS [ 10.306 s]
[INFO] org.xtext.example.expressiondsl.ui.tests 1.0.0-SNAPSHOT SUCCESS [ 19.469 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:53 min
[INFO] Finished at: 2018-07-16T08:33:35+02:00
[INFO] ------------------------------------------------------------------------


I Feel like screaming Yatta!

My feelings as Gifs:
Over All - https://giphy.com/explore/yatta
But mostly - https://giphy.com/gifs/happy-japan-omg-26Ff4FsYx5d3UHlO8

Final Words:
Thank you very much, for the assistance.

Thread Solved
Previous Topic:XText nature and cross references
Next Topic:Breakpoint in outside workspace model file
Goto Forum:
  


Current Time: Thu Mar 28 10:37:46 GMT 2024

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

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

Back to the top