@@ -2,53 +2,59 @@ export const SYSTEM_TEXT = `You will be provided with a free text description of
22Convert the given text into a structured text which follows the grammar given below between triple quotes.
33
44"""
5- grammar BeePathGrammar;
6-
7- description : leadingText initialStatement statement+ closingStatement;
8-
9- leadingText : '...';
10- initialStatement : 'Initially''start' ACTIVITY;
11- closingStatement : 'After' ( act_fragment 'ends'
12- | act_fragment 'ends' ('and' act_fragment 'ends')+
13- | 'either' act_fragment 'ends' ('or' act_fragment 'ends')+
14- ) ',''the''process''finishes';
15-
16- statement : sequence
17- | parallelSplit
18- | synchronization
19- | exclusiveChoice
20- | simpleMerge
21- | repeatSince
22- | eventually
23- | andSplitInXorSplit
24- | xorSplitInAndSplit
25- | andJoinInXorJoin
26- | xorJoinInAndJoin
27- | subprocess;
28-
29- sequence : 'After' ACTIVITY 'ends'',''immediately''start' ACTIVITY;
30- parallelSplit : 'After' ACTIVITY 'ends'',''immediately''start' ACTIVITY ('and''start' ACTIVITY)+;
31- synchronization : 'After' ACTIVITY 'ends' ('and' ACTIVITY 'ends')+ ',''immediately''start' ACTIVITY;
32- exclusiveChoice : 'After' ACTIVITY 'ends'',''immediately''either''start' ACTIVITY ('or''start' ACTIVITY)+;
33- simpleMerge : 'After''either' ACTIVITY 'ends' ('or' ACTIVITY 'ends')+ ',''immediately''start' ACTIVITY;
34- repeatSince : 'After' ACTIVITY 'ends'',''immediately''repeat''since' ACTIVITY ('or''start' ACTIVITY)+;
35- eventually : 'After' ACTIVITY 'ends'',''eventually''start' ACTIVITY;
36- andSplitInXorSplit: 'After' ACTIVITY 'ends'',''immediately''either''start' act_fragment ('or''start' act_fragment)+;
37- xorSplitInAndSplit: 'After' ACTIVITY 'ends'',''immediately''start' act_fragment ('and''start' act_fragment)+;
38- andJoinInXorJoin : 'After''either' act_fragment 'ends' ('or' act_fragment 'ends')+ ',''immediately''start' ACTIVITY;
39- xorJoinInAndJoin : 'After' act_fragment 'ends' ('and' act_fragment 'ends')+ ',''immediately''start' ACTIVITY;
40-
41- subprocess: andSubprocess | orSubprocess;
42- andSubprocess : SUBPROCESS_ID ':' ACTIVITY ('and' ACTIVITY)+;
43- orSubprocess : SUBPROCESS_ID ':' ACTIVITY ('or' ACTIVITY)+;
44-
45- act_fragment : ACTIVITY | SUBPROCESS_ID;
46- ACTIVITY : '"' WORD (' ' WORD)* '"';
47- SUBPROCESS_ID: '(' WORD+ ')' ;
48-
49- WORD : ([a-z] | [A-Z] | [0-9] | '_')+;
50- SPACE : (' ' | '\t' | '.') -> skip;
51- NEWLINE : ('\r'? '\n' | '\r') -> skip;
5+ grammar MScGrammar ;
6+ description
7+ : leadingText statementList;
8+
9+ leadingText
10+ : 'The following textual description follows the closed-world assumption, meaning that only the activities specified can be executed in the specified order. Any possible activity and execution that is not specified is considered impossible.' (NEWLINE)*;
11+
12+ statementList
13+ : initialStatement (statement)*? closingStatement;
14+ initialStatement
15+ : 'Initially start ' activity '.' (NEWLINE)*;
16+ statement
17+ : (afterStatement | closingStatement | andSubProcess | orSubProcess) (NEWLINE)*;
18+ closingStatement
19+ : (sequenceEndActivityExpression | andEndActivityExpression | orEndActivityExpression) ', the process finishes.' ;
20+
21+ afterStatement
22+ : (sequenceEndActivityExpression | andEndActivityExpression | orEndActivityExpression) ', ' (sequenceStartActivityExpression | andStartActivityExpression | orStartActivityExpression | repeatSinceStartActivityExpression | eventuallyExpression) '.';
23+ andSubProcess
24+ : andSubProcessId ': ' activity ' and ' activity (' and ' activity)*? '.';
25+ orSubProcess
26+ : orSubProcessId ': ' activity ' or ' activity (' or ' activity)*? '.';
27+
28+ sequenceStartActivityExpression
29+ : 'immediately start ' activity;
30+ andStartActivityExpression
31+ : 'immediately start ' (activity | orSubProcessId) ' and start ' (activity | orSubProcessId) (' and start ' (activity | orSubProcessId))*? ;
32+ orStartActivityExpression
33+ : 'immediately either start ' (activity | andSubProcessId) ' or start ' (activity | andSubProcessId) (' or start ' (activity | andSubProcessId))*? ;
34+ repeatSinceStartActivityExpression
35+ : 'immediately repeat since ' activity (' or start ' (activity | andSubProcessId))*?;
36+ eventuallyExpression
37+ : 'eventually start ' activity;
38+
39+ sequenceEndActivityExpression
40+ : 'After ' activity ' ends';
41+ andEndActivityExpression
42+ : 'After ' (activity | orSubProcessId) ' ends and ' ((activity | orSubProcessId) ' ends and ')*? (activity | orSubProcessId) ' ends';
43+ orEndActivityExpression
44+ : 'After either ' (activity | andSubProcessId) ' ends or ' ((activity | andSubProcessId) ' ends or ')*? (activity | andSubProcessId) ' ends';
45+
46+ activity
47+ : '"' WORD (SPACE WORD)*? '"' ;
48+ andSubProcessId
49+ : '(' WORD (SPACE WORD)*? ')' ;
50+ orSubProcessId
51+ : '(' WORD (SPACE WORD)*? ')' ;
52+ WORD
53+ : [a-zA-Z0-9]+ ;
54+ SPACE
55+ : '_' ;
56+ NEWLINE
57+ : '\r'? '\n' ;
5258"""
5359
5460In addition to the grammar, follow these numbered semantics rules:
0 commit comments