Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fdba136866ee7f5ce4c06c07ef85f74f3b451966 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*******************************************************************************
 * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * CONTRIBUTORS:
 * 		Henrik Rentz-Reichert (initial contribution)
 * 
 *******************************************************************************/

grammar org.eclipse.etrice.core.etphys.ETPhys with org.eclipse.xtext.common.Terminals

generate eTPhys "http://www.eclipse.org/etrice/core/etphys/ETPhys"

import "http://www.eclipse.org/emf/2002/Ecore" as ecore

PhysicalModel:
	'PhysicalModel' name=FQN '{'
		(imports+=Import)*
		(
			systems+=PhysicalSystem |
			nodeClasses+=NodeClass |
			runtimeClasses+=RuntimeClass
		)*
	'}'
;

PhysicalSystem:
	'PhysicalSystem' name=ID (docu=Documentation)? '{'
		nodeRefs+=NodeRef*
	'}'
;

NodeRef:
	'NodeRef' name=ID ':' type=[NodeClass|FQN] (docu=Documentation)?
;

NodeClass:
	'NodeClass'name=ID (docu=Documentation)? '{'
		('runtime' '=' runtime=[RuntimeClass|FQN] &
		'priomin' '=' priomin=PRIO &
		'priomax' '=' priomax=PRIO)
		threads+=PhysicalThread*
	'}'
;

PhysicalThread:
	(default?='DefaultThread' | 'Thread') name=ID '{'
		('execmode' '=' execmode=ExecMode &
		('interval' '=' time=TIME)? &
		'prio' '=' prio=PRIO &
		'stacksize' '=' stacksize=INT &
		'msgblocksize' '=' msgblocksize=INT &
		'msgpoolsize' '=' msgpoolsize=INT)
	'}'
;

enum ExecMode:
	POLLED='polled' |
	BLOCKED='blocked' |
	MIXED='mixed'
;

RuntimeClass:
	'RuntimeClass' name=ID (docu=Documentation)? '{'
		'model' '=' threadModel=ThreadModel
	'}'
;

enum ThreadModel:
	SINGLE_THREADED='singleThreaded' |
	MULTI_THREADED='multiThreaded'
;

Documentation: '['
		text+=STRING+
	']';

PRIO returns ecore::EInt hidden(): ('+'|'-')? INT;

Import :
	'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING;

ImportedFQN:
	FQN ('.*')?;

FQN:
	ID ('.' ID)*;
	
TIME returns ecore::ELong: (INT 's') | (INT 'ms') | (INT 'us') | (INT 'ns');

Back to the top