New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax input spec grammar by using Xtext options #89

Closed
RobertHilbrich opened this Issue Mar 20, 2018 · 5 comments

Comments

@RobertHilbrich
Owner

RobertHilbrich commented Mar 20, 2018

Use Xtext unordered group feature:

Unordered Groups
The elements of an unordered group can occur in any order, but each element must appear once. Members of unordered groups are separated by &. The following rule Modifier allows to parse simplified modifiers of the Java language:

Modifier:
static?='static'? & final?='final'? & visibility=Visibility;

enum Visibility:
PUBLIC='public' | PRIVATE='private' | PROTECTED='protected';

With these definitions the following sequences of tokens are valid:

public static final
static protected
final private static
public

In contrast, the parser refuses to accept these input lines:

static final static // ERROR: static appears twice
public static final private // ERROR: visibility appears twice
final // ERROR: visibility is missing

Note that if you want an element of an unordered group to appear once or not at all, you have to choose a cardinality of ?. In the example, the visibility is mandatory, while static or final are optional. Elements with a cardinality of * or + have to appear continuously without interruption, i.e.

ExampleRule:
values+=INT* & name=ID;

can parse these lines

0 8 15 x
x 0 8 15

but not does not consume the following sequence without raising an error

0 x 8 15 // wrong, as values must not be interrupted by a name (ID)

@RobertHilbrich

This comment has been minimized.

Owner

RobertHilbrich commented Jun 1, 2018

Apparently, unordered groups are very expensive for the parser as it has to construct many variants. It may be better to allow an arbitrary order via grammar rules and use a generic checker to check for maximum occurance.

See: https://stackoverflow.com/questions/23701169/free-order-of-rules-in-xtext

@RobertHilbrich

This comment has been minimized.

Owner

RobertHilbrich commented Jun 1, 2018

Hm - maybe we need to refactor the grammar - with rule fragments?

https://www.eclipse.org/forums/index.php/t/1071359/

@RobertHilbrich

This comment has been minimized.

Owner

RobertHilbrich commented Sep 26, 2018

Using regular unordered groups quickly exceeded 16GB of heap space for the xtext generator. I reverted the grammar code and asked in the forum:
https://www.eclipse.org/forums/index.php?t=msg&th=1095331&goto=1795610&#msg_1795610

@RobertHilbrich

This comment has been minimized.

Owner

RobertHilbrich commented Sep 26, 2018

Moved to 2.6 as it may require a significant model change

@RobertHilbrich RobertHilbrich modified the milestones: 2.5.0, 2.6.0 Sep 26, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

[#89]: Relax input spec grammar by using Xtext options
Added the remaining model properties for scheduling properties

Task-Url: http://github.com/roberthilbrich/assist-public/issues/89

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

RobertHilbrich added a commit that referenced this issue Oct 12, 2018

[#89]: Relax input spec grammar by using Xtext options
Fixing the formatters for DSE, Mapping and Scheduling,
added missing scheduling label provider for relation

Task-Url: http://github.com/roberthilbrich/assist-public/issues/89
@RobertHilbrich

This comment has been minimized.

Owner

RobertHilbrich commented Oct 17, 2018

Closed after adding all the required functionality (model changes, validator, new dsls, validators, formatters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment