Skip to content

Commit ab52f24

Browse files
authored
Merge pull request #32 from elkoDev/develop
Merge develop into main
2 parents b3ca468 + 49bb5aa commit ab52f24

16 files changed

Lines changed: 60 additions & 64 deletions

File tree

language/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ vsce package
2323
```
2424

2525
### 1.4 Publish CLI
26+
2627
NOTE: Previous versions have been published under the name `bcs-engineering-dsl` on my personal npm account. To avoid confusion, you might want to publish under a different name.
2728

2829
```bash
@@ -75,3 +76,14 @@ In addition to the standard libraries provided by Beckhoff, the following librar
7576
- `Tc3_DALI`: Please note that this library integration is not fully tested.
7677

7778
## 4 Future Work
79+
- Add support for more target platforms (e.g., Siemens, Codesys)
80+
- Add and test support for more bus systems (e.g., EtherCAT, Profinet)
81+
- Add a more sophisticated module system (e.g., support multiple files, packages, imports, etc.)
82+
- Support structs of structs
83+
- Support not only statefull FBs, but also stateless functions
84+
- Support FB properties (besides inputs, outputs, locals, and logic)
85+
- Support better scoping e.g. true block scoping for variables
86+
- Support UseStmt within FB logic
87+
- Look into debugging DSLs
88+
- Look into moving the framework to a web-based solution (both the DSL and the deployment tool)
89+
- Look into graphical modeling

language/example/etherCAT/control.bcsctrl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ control EtherCATController {
118118
}
119119
unit AdjustLightLevelByMode {
120120
switch (mode){
121-
case OperatingMode.COMFORT: {
121+
case OperatingMode.COMFORT {
122122
lightLevel = 100;
123123
}
124-
case OperatingMode.ECO: {
124+
case OperatingMode.ECO {
125125
lightLevel = 50;
126126
}
127-
default: {
127+
default {
128128
lightLevel = 0;
129129
}
130130
}

language/example/exhaustive/exhaustive_control.bcsctrl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ control ExhaustiveController {
8787
var extractedBool: BOOL = arr1[2];
8888
var extractedInt: INT = arr2[3];
8989
var extractedReal: REAL = arr3[4];
90-
var extractedBoolArray: BOOL[5] = arr4[2];
90+
var extractedBoolArray: BOOL[5] = arr4[2]; // Note: not supported in generator
9191
var extractedBoolArrayElement: BOOL = arr4[2][3];
9292
var extractedMode: Mode = arr5[1];
9393

@@ -100,8 +100,8 @@ control ExhaustiveController {
100100
arr2[0] = arr2[1] + arr2[2] - arr2[3] * arr2[4] / 2;
101101
arr3[0] = arr3[1] + arr3[2] - arr3[3] * arr3[4] / 2.0;
102102
arr4[0][0] = arr4[1][1] && arr4[2][2] || arr4[3][3] && arr4[4][4];
103-
arr4[1] = [true, false, true, false, true];
104-
arr4[1] = arr1;
103+
arr4[1] = [true, false, true, false, true]; // Note: not supported in generator
104+
arr4[1] = arr1; // Note: not supported in generator
105105
}
106106

107107
struct Rectangle {
@@ -149,7 +149,7 @@ control ExhaustiveController {
149149

150150
// 6. Separate struct initialization after declaration
151151
var p: Point;
152-
p = { x: 1.0, y: 2.0 };
152+
p = { x: 1.0, y: 2.0 }; // Note: not supported in generator
153153

154154
// 7. Array element accessed and modified
155155
var tempX: REAL;
@@ -160,7 +160,7 @@ control ExhaustiveController {
160160
// 8. Valid reassignment of structs
161161
var c1: Circle = { radius: 5.0 };
162162
var c2: Circle;
163-
c2 = { radius: 10.0 };
163+
c2 = { radius: 10.0 }; // Note: not supported in generator
164164
var newRadius: REAL = c2.radius;
165165
}
166166

language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.0.24",
2+
"version": "0.0.25",
33
"name": "bcs-engineering-dsl",
44
"displayName": "BCS Engineering DSL",
55
"icon": "icon.png",

language/railroad/svg/bcs-control/CaseOption.svg

Lines changed: 7 additions & 15 deletions
Loading

language/railroad/svg/bcs-control/DefaultOption.svg

Lines changed: 7 additions & 15 deletions
Loading

language/src/language/bcs-control.langium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ SwitchStmt:
200200
;
201201

202202
CaseOption:
203-
'case' (literals+=CaseLiteral (',' literals+=CaseLiteral)*) ':' Block
203+
'case' (literals+=CaseLiteral (',' literals+=CaseLiteral)*) Block
204204
;
205205

206206
DefaultOption:
207-
'default' ':' Block
207+
'default' Block
208208
;
209209

210210
ExpressionStmt:

language/src/language/bcs-hardware.langium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Bus:
5858

5959
Box:
6060
'box' name=ID '{'
61-
'product:' product=ID // e.g. EK1100, CU1128
61+
'product:' product=ID // e.g. EK1100, CU1128
6262
('revision:' rev=StringLiteral)? // optional explicit rev
6363
modules+=Module*
6464
'}'
@@ -74,7 +74,7 @@ Module:
7474

7575
NetworkSettings:
7676
'network' '{'
77-
'hostname:' hostname=StringLiteral // e.g. "CX-301714"
77+
'hostname:' hostname=StringLiteral // e.g. "CX-301714"
7878
'ipAddress:' ipAddress=StringLiteral // e.g. "192.168.1.100" TODO: IPLiteral
7979
'}'
8080
;

language/src/language/control/utils/type-inference-utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ export class TypeInferenceUtils {
577577
accept: ValidationAcceptor,
578578
expr: any
579579
): string | undefined {
580-
const numericTypes = ["INT", "REAL"];
580+
const numericTypes = new Set(["INT", "REAL"]);
581581

582-
if (!numericTypes.includes(left) || !numericTypes.includes(right)) {
582+
if (!numericTypes.has(left) || !numericTypes.has(right)) {
583583
accept(
584584
"error",
585585
`Arithmetic operator '${op}' requires numeric operands, but got '${left}' and '${right}'.`,
@@ -588,11 +588,11 @@ export class TypeInferenceUtils {
588588
return undefined;
589589
}
590590

591-
// If either operand is REAL, result is REAL
592-
if (left === "REAL" || right === "REAL") {
593-
return "REAL";
591+
// If either operand is INT, result is INT
592+
if (left === "INT" || right === "INT") {
593+
return "INT";
594594
}
595595

596-
return "INT";
596+
return "REAL";
597597
}
598598
}

0 commit comments

Comments
 (0)