From 89505d95efc1aeb11fcd1ecb39e0e32eba56176e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 15:11:05 +0100 Subject: [PATCH 01/49] Add equals initializer syntax --- org.lflang/src/org/lflang/LinguaFranca.xtext | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/org.lflang/src/org/lflang/LinguaFranca.xtext b/org.lflang/src/org/lflang/LinguaFranca.xtext index dfa604d7cd..b83ff9e932 100644 --- a/org.lflang/src/org/lflang/LinguaFranca.xtext +++ b/org.lflang/src/org/lflang/LinguaFranca.xtext @@ -139,7 +139,7 @@ TargetDecl: Initializer: parens?='(' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? ')' | braces?='{' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? '}' -// | assign?='=' exprs+=Expression // todo later + | assign?='=' exprs+=Expression ; @@ -285,14 +285,15 @@ VarRefOrModeTransition returns VarRef: Assignment: lhs=[Parameter] - (equals='=')? rhs=AssignmentInitializer + rhs=AssignmentInitializer ; -// TODO Only allow = based parameter assignment AssignmentInitializer returns Initializer: - exprs+=Expression - | parens?='(' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? ')' - | braces?='{' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? '}' + assign?='=' exprs+=Expression + // these syntaxes are legacy and now deprecated + // todo remove in future version. + | '='? parens?='(' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? ')' + | '='? braces?='{' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? '}' ; From b9e5f52c9b797713ccfcef2080de03bba04d47f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 15:53:03 +0100 Subject: [PATCH 02/49] Update formatter --- .../tests/compiler/FormattingUnitTests.java | 33 +++++++++++++++++-- org.lflang/src/org/lflang/ASTUtils.java | 8 +++++ org.lflang/src/org/lflang/Target.java | 4 +++ org.lflang/src/org/lflang/ast/IsEqual.java | 1 - org.lflang/src/org/lflang/ast/ToLf.java | 19 +++++++---- 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/org.lflang.tests/src/org/lflang/tests/compiler/FormattingUnitTests.java b/org.lflang.tests/src/org/lflang/tests/compiler/FormattingUnitTests.java index ae325ab94d..d7862e5d25 100644 --- a/org.lflang.tests/src/org/lflang/tests/compiler/FormattingUnitTests.java +++ b/org.lflang.tests/src/org/lflang/tests/compiler/FormattingUnitTests.java @@ -34,7 +34,7 @@ public void testSimple() { @Test public void testAssignments() { - assertIsFormatted( + assertFormatsTo( """ target C @@ -43,6 +43,15 @@ public void testAssignments() { input in: int state last_invoked: tag_t({= NEVER_TAG_INITIALIZER =}) } + """, + """ + target C + + reactor Destination { + input ok: bool + input in: int + state last_invoked: tag_t = {= NEVER_TAG_INITIALIZER =} + } """ ); } @@ -56,16 +65,34 @@ public void testState() { reactor Destination { state one_init: tag_t( {= NEVER_TAG_INITIALIZER =}) state no_init: tag_t - state list_init(1,2) + state list_init(1,2) // this syntax is deprecated } """, """ target Python + reactor Destination { + state one_init: tag_t = {= NEVER_TAG_INITIALIZER =} + state no_init: tag_t + state list_init(1, 2) # this syntax is deprecated + } + """ + ); + } + + @Test + public void testCppInits() { + assertIsFormatted( + """ + target Cpp + reactor Destination { state one_init: tag_t({= NEVER_TAG_INITIALIZER =}) state no_init: tag_t - state list_init(1, 2) + state assign: int = 0 + state paren: int(0) + state brace: std::vector{1, 2} + state paren_list: std::vector(1, 2) } """ ); diff --git a/org.lflang/src/org/lflang/ASTUtils.java b/org.lflang/src/org/lflang/ASTUtils.java index fe6fdfeb2b..4d4854b946 100644 --- a/org.lflang/src/org/lflang/ASTUtils.java +++ b/org.lflang/src/org/lflang/ASTUtils.java @@ -251,6 +251,14 @@ public static boolean changeTargetName(Resource resource, String newTargetName) return true; } + /** + * Return the target of the file in which the given node lives. + */ + public static Target getTarget(EObject object) { + TargetDecl targetDecl = targetDecl(object.eResource()); + return Target.fromDecl(targetDecl); + } + /** * Add a new target property to the given resource. * diff --git a/org.lflang/src/org/lflang/Target.java b/org.lflang/src/org/lflang/Target.java index 4842bc1672..24d942a5be 100644 --- a/org.lflang/src/org/lflang/Target.java +++ b/org.lflang/src/org/lflang/Target.java @@ -502,6 +502,10 @@ public boolean buildsUsingDocker() { }; } + public boolean mandatesEqualsInitializers() { + return this != CPP; + } + /** * Return a string that demarcates the beginning of a single-line comment. */ diff --git a/org.lflang/src/org/lflang/ast/IsEqual.java b/org.lflang/src/org/lflang/ast/IsEqual.java index b4614edcf0..7cae9e471d 100644 --- a/org.lflang/src/org/lflang/ast/IsEqual.java +++ b/org.lflang/src/org/lflang/ast/IsEqual.java @@ -415,7 +415,6 @@ public Boolean caseVarRef(VarRef object) { public Boolean caseAssignment(Assignment object) { return new ComparisonMachine<>(object, Assignment.class) .equivalent(Assignment::getLhs) - .equalAsObjects(Assignment::getEquals) .equivalent(Assignment::getRhs) .conclusion; } diff --git a/org.lflang/src/org/lflang/ast/ToLf.java b/org.lflang/src/org/lflang/ast/ToLf.java index 7582ee3a59..8fd73ff48e 100644 --- a/org.lflang/src/org/lflang/ast/ToLf.java +++ b/org.lflang/src/org/lflang/ast/ToLf.java @@ -819,9 +819,6 @@ public MalleableString caseAssignment(Assignment object) { // )); Builder msb = new Builder(); msb.append(object.getLhs().getName()); - if (object.getEquals() != null) { - msb.append(" = "); - } msb.append(initializer(object.getRhs(), false)); return msb.get(); } @@ -831,21 +828,29 @@ public MalleableString caseInitializer(Initializer object) { return initializer(object, false); } + private boolean shouldOutputAsAssignment(Initializer init) { + return init.isAssign() + || init.getExprs().size() == 1 && ASTUtils.getTarget(init).mandatesEqualsInitializers(); + } + private MalleableString initializer(Initializer init, boolean nothingIfEmpty) { if (init == null) { return MalleableString.anyOf(""); } + if (shouldOutputAsAssignment(init)) { + Expression expr = ASTUtils.asSingleExpr(init); + Objects.requireNonNull(expr); + return new Builder().append(" = ").append(doSwitch(expr)).get(); + } String prefix; String suffix; if (init.isBraces()) { prefix = "{"; suffix = "}"; - } else if (init.isParens()) { + } else { + assert init.isParens(); prefix = "("; suffix = ")"; - } else { - // unparenthesized parameter assignment. - prefix = suffix = ""; } return list(", ", prefix, suffix, nothingIfEmpty, false, init.getExprs()); } From 5021ab59561ff3175bbd95fdfa28ab167509ef59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 16:18:45 +0100 Subject: [PATCH 03/49] Add deprecation warning --- org.lflang/src/org/lflang/validation/LFValidator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.lflang/src/org/lflang/validation/LFValidator.java b/org.lflang/src/org/lflang/validation/LFValidator.java index f53987e2b5..69107d96e4 100644 --- a/org.lflang/src/org/lflang/validation/LFValidator.java +++ b/org.lflang/src/org/lflang/validation/LFValidator.java @@ -172,6 +172,10 @@ public void checkInitializer(Initializer init) { if (init.isBraces() && target != Target.CPP) { error("Brace initializers are only supported for the C++ target", Literals.INITIALIZER__BRACES); } + if (init.isParens() && target.mandatesEqualsInitializers()) { + warning("This syntax is deprecated in the " + target + + " target, use an equal sign instead of parentheses for assignment (run the formatter to fix this automatically).", Literals.INITIALIZER__PARENS); + } } @Check(CheckType.FAST) From 2c00c2047b27556682f159a691c8163be042c7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 16:26:42 +0100 Subject: [PATCH 04/49] Format Rust tests --- test/Rust/src/ActionDelay.lf | 2 +- test/Rust/src/ActionImplicitDelay.lf | 2 +- test/Rust/src/ActionIsPresent.lf | 4 ++-- test/Rust/src/ActionScheduleMicrostep.lf | 2 +- test/Rust/src/ActionValues.lf | 4 ++-- test/Rust/src/ActionValuesCleanup.lf | 2 +- test/Rust/src/CtorParamDefault.lf | 4 ++-- test/Rust/src/CtorParamMixed.lf | 12 ++++++------ test/Rust/src/CtorParamSimple.lf | 4 ++-- test/Rust/src/DependencyOnChildPort.lf | 2 +- test/Rust/src/DependencyUseOnLogicalAction.lf | 2 +- test/Rust/src/FloatLiteral.lf | 8 ++++---- test/Rust/src/MainReactorParam.lf | 6 +++--- test/Rust/src/MovingAverage.lf | 6 +++--- test/Rust/src/NativeListsAndTimes.lf | 14 +++++++------- test/Rust/src/PortConnectionInSelfInChild.lf | 2 +- test/Rust/src/PortConnectionInSelfOutSelf.lf | 2 +- test/Rust/src/PortConnectionOutChildOutSelf.lf | 4 ++-- test/Rust/src/PortRefCleanup.lf | 4 ++-- test/Rust/src/PortValueCleanup.lf | 4 ++-- test/Rust/src/ReservedKeywords.lf | 4 ++-- test/Rust/src/StateInitializerVisibility.lf | 4 ++-- test/Rust/src/Stop.lf | 10 +++++----- test/Rust/src/StopIdempotence.lf | 2 +- test/Rust/src/StopTimeoutExact.lf | 2 +- test/Rust/src/StructAsState.lf | 2 +- test/Rust/src/StructAsType.lf | 4 ++-- test/Rust/src/TimeState.lf | 2 +- test/Rust/src/TimerDefaults.lf | 2 +- test/Rust/src/TimerIsPresent.lf | 4 ++-- test/Rust/src/TimerPeriodic.lf | 2 +- test/Rust/src/Timers.lf | 2 +- test/Rust/src/TypeVarLengthList.lf | 2 +- test/Rust/src/concurrent/AsyncCallback.lf | 10 +++++----- test/Rust/src/generics/CtorParamGeneric.lf | 4 ++-- test/Rust/src/generics/CtorParamGenericInst.lf | 6 +++--- test/Rust/src/generics/GenericReactor.lf | 2 +- test/Rust/src/multiport/ConnectionToSelfBank.lf | 8 ++++---- .../src/multiport/ConnectionToSelfMultiport.lf | 6 +++--- test/Rust/src/multiport/CycledLhs_SelfLoop.lf | 2 +- test/Rust/src/multiport/CycledLhs_Single.lf | 2 +- test/Rust/src/multiport/FullyConnected.lf | 10 +++++----- .../src/multiport/FullyConnectedAddressable.lf | 10 +++++----- test/Rust/src/multiport/MultiportFromBank.lf | 6 +++--- test/Rust/src/multiport/MultiportFromHierarchy.lf | 4 ++-- test/Rust/src/multiport/MultiportIn.lf | 4 ++-- test/Rust/src/multiport/MultiportOut.lf | 4 ++-- test/Rust/src/multiport/MultiportToBank.lf | 6 +++--- .../Rust/src/multiport/MultiportToBankHierarchy.lf | 6 +++--- test/Rust/src/multiport/MultiportToMultiport2.lf | 4 ++-- .../src/multiport/ReadOutputOfContainedBank.lf | 6 +++--- test/Rust/src/multiport/WidthWithParameter.lf | 2 +- .../src/multiport/WriteInputOfContainedBank.lf | 6 +++--- test/Rust/src/target/CliFeature.lf | 2 +- .../src/target/MainParameterCanBeExpression.lf | 4 ++-- 55 files changed, 123 insertions(+), 123 deletions(-) diff --git a/test/Rust/src/ActionDelay.lf b/test/Rust/src/ActionDelay.lf index 8612eabbb2..75c7ab909f 100644 --- a/test/Rust/src/ActionDelay.lf +++ b/test/Rust/src/ActionDelay.lf @@ -4,7 +4,7 @@ target Rust main reactor ActionDelay { logical action act0 logical action act1(100 msec) - state count: u32(0) + state count: u32 = 0 reaction(startup) -> act0, act1 {= ctx.schedule(act0, after!(100 ms)); diff --git a/test/Rust/src/ActionImplicitDelay.lf b/test/Rust/src/ActionImplicitDelay.lf index 1278472528..9a3a900d93 100644 --- a/test/Rust/src/ActionImplicitDelay.lf +++ b/test/Rust/src/ActionImplicitDelay.lf @@ -3,7 +3,7 @@ target Rust main reactor ActionImplicitDelay { logical action act(40 msec) - state count: u64(1) + state count: u64 = 1 reaction(startup) -> act {= ctx.schedule(act, Asap); =} diff --git a/test/Rust/src/ActionIsPresent.lf b/test/Rust/src/ActionIsPresent.lf index efe6158e43..3a1e556c5a 100644 --- a/test/Rust/src/ActionIsPresent.lf +++ b/test/Rust/src/ActionIsPresent.lf @@ -3,8 +3,8 @@ target Rust main reactor ActionIsPresent { logical action a - state success: bool(false) - state tried: bool(false) + state success: bool = false + state tried: bool = false reaction(startup, a) -> a {= if !ctx.is_present(a) { diff --git a/test/Rust/src/ActionScheduleMicrostep.lf b/test/Rust/src/ActionScheduleMicrostep.lf index 5ded693d2c..53bf8781b9 100644 --- a/test/Rust/src/ActionScheduleMicrostep.lf +++ b/test/Rust/src/ActionScheduleMicrostep.lf @@ -3,7 +3,7 @@ target Rust main reactor ActionScheduleMicrostep { logical action act - state count: u32(1) + state count: u32 = 1 reaction(startup) -> act {= assert_tag_is!(ctx, T0); diff --git a/test/Rust/src/ActionValues.lf b/test/Rust/src/ActionValues.lf index 635516c3d0..007da1fb5a 100644 --- a/test/Rust/src/ActionValues.lf +++ b/test/Rust/src/ActionValues.lf @@ -2,8 +2,8 @@ target Rust main reactor ActionValues { - state r1done: bool(false) - state r2done: bool(false) + state r1done: bool = false + state r2done: bool = false logical action act(100 msec): i32 reaction(startup) -> act {= diff --git a/test/Rust/src/ActionValuesCleanup.lf b/test/Rust/src/ActionValuesCleanup.lf index 615bd68a90..f4bab7a2b5 100644 --- a/test/Rust/src/ActionValuesCleanup.lf +++ b/test/Rust/src/ActionValuesCleanup.lf @@ -20,7 +20,7 @@ main reactor ActionValuesCleanup { =} logical action act: FooDrop - state count: u32(0) + state count: u32 = 0 reaction(startup) -> act {= ctx.schedule_with_v(act, Some(FooDrop { }), Asap) diff --git a/test/Rust/src/CtorParamDefault.lf b/test/Rust/src/CtorParamDefault.lf index 2a4f4b8074..a7d2d868bc 100644 --- a/test/Rust/src/CtorParamDefault.lf +++ b/test/Rust/src/CtorParamDefault.lf @@ -1,7 +1,7 @@ target Rust -reactor Print(value: i32(42)) { - state v: i32(value) +reactor Print(value: i32 = 42) { + state v: i32 = value reaction(startup) {= assert_eq!(42, self.v); diff --git a/test/Rust/src/CtorParamMixed.lf b/test/Rust/src/CtorParamMixed.lf index cb8536fe0a..5de7a3dc4c 100644 --- a/test/Rust/src/CtorParamMixed.lf +++ b/test/Rust/src/CtorParamMixed.lf @@ -1,13 +1,13 @@ target Rust reactor Print( - value: i32(42), - name: String({= "xxx".into() =}), - other: bool(false) + value: i32 = 42, + name: String = {= "xxx".into() =}, + other: bool = false ) { - state value(value) - state name(name) - state other(other) + state value = value + state name = name + state other = other reaction(startup) {= assert_eq!(42, self.value); diff --git a/test/Rust/src/CtorParamSimple.lf b/test/Rust/src/CtorParamSimple.lf index 8594adde3d..bbf38c04a0 100644 --- a/test/Rust/src/CtorParamSimple.lf +++ b/test/Rust/src/CtorParamSimple.lf @@ -1,7 +1,7 @@ target Rust -reactor Print(value: i32(42)) { - state v: i32(value) +reactor Print(value: i32 = 42) { + state v: i32 = value reaction(startup) {= assert_eq!(self.v, 23); diff --git a/test/Rust/src/DependencyOnChildPort.lf b/test/Rust/src/DependencyOnChildPort.lf index e5c9336c11..ed8b6b2120 100644 --- a/test/Rust/src/DependencyOnChildPort.lf +++ b/test/Rust/src/DependencyOnChildPort.lf @@ -9,7 +9,7 @@ reactor Box { } main reactor { - state done: bool(false) + state done: bool = false box0 = new Box() box1 = new Box() diff --git a/test/Rust/src/DependencyUseOnLogicalAction.lf b/test/Rust/src/DependencyUseOnLogicalAction.lf index bf51944c8b..6278ec76f7 100644 --- a/test/Rust/src/DependencyUseOnLogicalAction.lf +++ b/test/Rust/src/DependencyUseOnLogicalAction.lf @@ -10,7 +10,7 @@ main reactor { timer t(0, 2 msec) - state tick: u32(0) + state tick: u32 = 0 reaction(startup) -> clock, a {= ctx.schedule(a, after!(3 ms)); // out of order on purpose diff --git a/test/Rust/src/FloatLiteral.lf b/test/Rust/src/FloatLiteral.lf index 645581c844..b1dd37ca5e 100644 --- a/test/Rust/src/FloatLiteral.lf +++ b/test/Rust/src/FloatLiteral.lf @@ -2,10 +2,10 @@ target Rust // This test verifies that floating-point literals are handled correctly. main reactor { - state N: f64(6.0221409e+23) - state charge: f64(-1.6021766E-19) - state minus_epsilon: f64(-.01e0) - state expected: f64(.964853323188E5) + state N: f64 = 6.0221409e+23 + state charge: f64 = -1.6021766E-19 + state minus_epsilon: f64 = -.01e0 + state expected: f64 = .964853323188E5 reaction(startup) {= let F = - self.N * self.charge; diff --git a/test/Rust/src/MainReactorParam.lf b/test/Rust/src/MainReactorParam.lf index 36a78d7699..0c9f189548 100644 --- a/test/Rust/src/MainReactorParam.lf +++ b/test/Rust/src/MainReactorParam.lf @@ -1,8 +1,8 @@ target Rust -main reactor(one: u64(1152921504606846976), two: u64({= 1 << 60 =})) { - state one(one) - state two(two) +main reactor(one: u64 = 1152921504606846976, two: u64 = {= 1 << 60 =}) { + state one = one + state two = two reaction(startup) {= assert_eq!(self.one, self.two); =} } diff --git a/test/Rust/src/MovingAverage.lf b/test/Rust/src/MovingAverage.lf index 228c69bd17..33e686cf42 100644 --- a/test/Rust/src/MovingAverage.lf +++ b/test/Rust/src/MovingAverage.lf @@ -7,7 +7,7 @@ target Rust { reactor Source { output out: f64 - state count: u32(0) + state count: u32 = 0 timer clock(0, 10 msec) reaction(clock) -> out {= @@ -19,7 +19,7 @@ reactor Source { reactor MovingAverageImpl { // fixme inaccessible ({=[0.0 ; 4]=}); state delay_line: f64[4](0.0, 0.0, 0.0, 0.0) - state index: usize(0) + state index: usize = 0 input in_: f64 output out: f64 @@ -39,7 +39,7 @@ reactor MovingAverageImpl { reactor Print { input in_: f64 - state count: usize(0) + state count: usize = 0 preamble {= const EXPECTED: [ f64 ; 6 ] = [0.0, 0.25, 0.75, 1.5, 2.5, 3.5]; diff --git a/test/Rust/src/NativeListsAndTimes.lf b/test/Rust/src/NativeListsAndTimes.lf index 3e378c2e43..79fd56e004 100644 --- a/test/Rust/src/NativeListsAndTimes.lf +++ b/test/Rust/src/NativeListsAndTimes.lf @@ -2,18 +2,18 @@ target Rust // This test passes if it is successfully compiled into valid target code. reactor Foo( - x: i32(0), - y: time(0), // Units are missing but not required - z(1 msec), // Type is missing but not required + x: i32 = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required p: i32[](1, 2, 3, 4), // List of integers - p2: i32[]({= vec![1] =}), // List of integers with single element + p2: i32[] = {= vec![1] =}, // List of integers with single element // todo // p2: i32[](1), // List of integers with single element p3: // i32[](), // Empty list of integers List of time values q: Vec(1 msec, 2 msec, 3 msec), g: time[](1 msec, 2 msec) // List of time values ) { - state s: time(y) // Reference to explicitly typed time parameter - state t: time(z) // Reference to implicitly typed time parameter + state s: time = y // Reference to explicitly typed time parameter + state t: time = z // Reference to implicitly typed time parameter state v: bool // Uninitialized boolean state variable state w: time // Uninitialized time state variable timer tick(0) // Units missing but not required @@ -29,7 +29,7 @@ reactor Foo( */ // state baz(p); // Implicit type i32[] fixme this interplays badly with // syntax for array init Implicit type time - state period(z) + state period = z state times: Vec>(q, g) // a list of lists /** diff --git a/test/Rust/src/PortConnectionInSelfInChild.lf b/test/Rust/src/PortConnectionInSelfInChild.lf index c72b4edae0..7fd66783f1 100644 --- a/test/Rust/src/PortConnectionInSelfInChild.lf +++ b/test/Rust/src/PortConnectionInSelfInChild.lf @@ -3,7 +3,7 @@ target Rust reactor Child { input inp: i32 - state done: bool(false) + state done: bool = false reaction(inp) {= assert_eq!(ctx.get(inp), Some(76600)); diff --git a/test/Rust/src/PortConnectionInSelfOutSelf.lf b/test/Rust/src/PortConnectionInSelfOutSelf.lf index 6d012b3d62..2e33b0e498 100644 --- a/test/Rust/src/PortConnectionInSelfOutSelf.lf +++ b/test/Rust/src/PortConnectionInSelfOutSelf.lf @@ -18,7 +18,7 @@ reactor TestCase { reactor Sink { input inp: i32 - state done: bool(false) + state done: bool = false reaction(inp) {= assert_eq!(ctx.get(inp), Some(76600)); diff --git a/test/Rust/src/PortConnectionOutChildOutSelf.lf b/test/Rust/src/PortConnectionOutChildOutSelf.lf index 54adbb56eb..4d58153d97 100644 --- a/test/Rust/src/PortConnectionOutChildOutSelf.lf +++ b/test/Rust/src/PortConnectionOutChildOutSelf.lf @@ -19,7 +19,7 @@ reactor Parent { reactor Sink { input inp: i32 - state done: bool(false) + state done: bool = false reaction(inp) {= assert_eq!(ctx.get(inp), Some(76600)); @@ -33,7 +33,7 @@ reactor Sink { main reactor { parent = new Parent() - state done: bool(false) + state done: bool = false reaction(parent.out) {= assert_eq!(ctx.get(parent__out), Some(76600)); diff --git a/test/Rust/src/PortRefCleanup.lf b/test/Rust/src/PortRefCleanup.lf index 65a5b415cf..30573ceee9 100644 --- a/test/Rust/src/PortRefCleanup.lf +++ b/test/Rust/src/PortRefCleanup.lf @@ -14,8 +14,8 @@ main reactor { timer t1(0) timer t2(15 msec) - state reaction_num: u32(0) - state done: bool(false) + state reaction_num: u32 = 0 + state done: bool = false reaction(t1) -> boxr.inp {= ctx.set(boxr__inp, 150); diff --git a/test/Rust/src/PortValueCleanup.lf b/test/Rust/src/PortValueCleanup.lf index be837c2908..9a11372cfb 100644 --- a/test/Rust/src/PortValueCleanup.lf +++ b/test/Rust/src/PortValueCleanup.lf @@ -11,8 +11,8 @@ reactor Sink { timer t2(15 msec) input in: u32 - state reaction_num: u32(0) - state done: bool(false) + state reaction_num: u32 = 0 + state done: bool = false reaction(in, t2) {= if self.reaction_num == 0 { diff --git a/test/Rust/src/ReservedKeywords.lf b/test/Rust/src/ReservedKeywords.lf index f1facfe8ea..5d30ba63a4 100644 --- a/test/Rust/src/ReservedKeywords.lf +++ b/test/Rust/src/ReservedKeywords.lf @@ -8,14 +8,14 @@ reactor box { in -> struct - state foo: bool(true) // not escaped + state foo: bool = true // not escaped reaction(in) {= ctx.get(r#in); =} } -main reactor ReservedKeywords(struct: u32(0)) { +main reactor ReservedKeywords(struct: u32 = 0) { box = new box() timer t1(0) diff --git a/test/Rust/src/StateInitializerVisibility.lf b/test/Rust/src/StateInitializerVisibility.lf index cef728ccfa..d192f0ca98 100644 --- a/test/Rust/src/StateInitializerVisibility.lf +++ b/test/Rust/src/StateInitializerVisibility.lf @@ -3,8 +3,8 @@ target Rust main reactor { - state foo: u32(123) - state x: u32({= *&foo =}) + state foo: u32 = 123 + state x: u32 = {= *&foo =} reaction(startup) {= assert_eq!(self.x, self.foo); diff --git a/test/Rust/src/Stop.lf b/test/Rust/src/Stop.lf index d2f380f634..c43f8c30ff 100644 --- a/test/Rust/src/Stop.lf +++ b/test/Rust/src/Stop.lf @@ -13,13 +13,13 @@ target Rust { * @param break_interval: Determines how long the reactor should take a break * after sending take_a_break_after messages. */ -reactor Sender(take_a_break_after: u32(10), break_interval: time(400 msec)) { +reactor Sender(take_a_break_after: u32 = 10, break_interval: time = 400 msec) { output out: u32 logical action act - state sent_messages: u32(0) + state sent_messages: u32 = 0 - state take_a_break_after(take_a_break_after) - state break_interval(break_interval) + state take_a_break_after = take_a_break_after + state break_interval = break_interval reaction(startup, act) -> act, out {= // Send a message on out @@ -40,7 +40,7 @@ reactor Sender(take_a_break_after: u32(10), break_interval: time(400 msec)) { reactor Consumer { input in_: u32 - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false reaction(in_) {= let current_tag = ctx.get_tag(); diff --git a/test/Rust/src/StopIdempotence.lf b/test/Rust/src/StopIdempotence.lf index ce9d17514f..1f79347758 100644 --- a/test/Rust/src/StopIdempotence.lf +++ b/test/Rust/src/StopIdempotence.lf @@ -4,7 +4,7 @@ target Rust { } main reactor StopIdempotence { - state count: u32(0) + state count: u32 = 0 reaction(startup) {= ctx.request_stop(Asap); // requested for (T0, 1) diff --git a/test/Rust/src/StopTimeoutExact.lf b/test/Rust/src/StopTimeoutExact.lf index 37e9616fb7..2b9eb85cda 100644 --- a/test/Rust/src/StopTimeoutExact.lf +++ b/test/Rust/src/StopTimeoutExact.lf @@ -9,7 +9,7 @@ target Rust { main reactor StopTimeoutExact { timer t(0, 10 msec) // the fifth triggering will coincide with the timeout - state reacted_on_shutdown: bool(false) + state reacted_on_shutdown: bool = false reaction(t) {= if ctx.get_tag() == tag!(T0 + 50 ms) { diff --git a/test/Rust/src/StructAsState.lf b/test/Rust/src/StructAsState.lf index 955affcc8b..9b35e7a3fb 100644 --- a/test/Rust/src/StructAsState.lf +++ b/test/Rust/src/StructAsState.lf @@ -15,7 +15,7 @@ main reactor StructAsState { * - state s: Hello(name: "Earth".into(), value: 42); * - state s: Hello { name: "Earth".into(), value: 42 }; */ - state s: Hello({= Hello { name: "Earth".into(), value: 42 } =}) + state s: Hello = {= Hello { name: "Earth".into(), value: 42 } =} reaction(startup) {= println!("State s.name=\"{}\", s.value={}.", self.s.name, self.s.value); diff --git a/test/Rust/src/StructAsType.lf b/test/Rust/src/StructAsType.lf index 76cee15f8e..0c8ed51456 100644 --- a/test/Rust/src/StructAsType.lf +++ b/test/Rust/src/StructAsType.lf @@ -18,9 +18,9 @@ reactor Source { =} } -reactor Print(expected: i32(42)) { // expected parameter is for testing. +reactor Print(expected: i32 = 42) { // expected parameter is for testing. input inp: {= super::source::Hello =} - state expected: i32(expected) + state expected: i32 = expected reaction(inp) {= ctx.use_ref_opt(inp, |hello| { diff --git a/test/Rust/src/TimeState.lf b/test/Rust/src/TimeState.lf index bbd80f730f..efffb00c2f 100644 --- a/test/Rust/src/TimeState.lf +++ b/test/Rust/src/TimeState.lf @@ -1,7 +1,7 @@ target Rust reactor Foo { - state baz: time(500 msec) + state baz: time = 500 msec reaction(startup) {= assert_eq!(500, self.baz.as_millis()); =} } diff --git a/test/Rust/src/TimerDefaults.lf b/test/Rust/src/TimerDefaults.lf index 3de189b62b..bbc920bf4a 100644 --- a/test/Rust/src/TimerDefaults.lf +++ b/test/Rust/src/TimerDefaults.lf @@ -1,7 +1,7 @@ target Rust main reactor TimerDefaults { - state i: i32(0) + state i: i32 = 0 timer t reaction(t) {= diff --git a/test/Rust/src/TimerIsPresent.lf b/test/Rust/src/TimerIsPresent.lf index 84327c06a6..1e87c11f51 100644 --- a/test/Rust/src/TimerIsPresent.lf +++ b/test/Rust/src/TimerIsPresent.lf @@ -8,8 +8,8 @@ main reactor { timer b(1 msec, 5 msec) timer c(1 msec) - state success: bool(false) - state tick: u32(0) + state success: bool = false + state tick: u32 = 0 reaction(startup, a, b, c) {= match self.tick { diff --git a/test/Rust/src/TimerPeriodic.lf b/test/Rust/src/TimerPeriodic.lf index fc62900e7c..c6dce10a73 100644 --- a/test/Rust/src/TimerPeriodic.lf +++ b/test/Rust/src/TimerPeriodic.lf @@ -3,7 +3,7 @@ target Rust { } main reactor TimerPeriodic { - state i: i32(0) + state i: i32 = 0 timer t2(0, 3 msec) reaction(t2) {= diff --git a/test/Rust/src/Timers.lf b/test/Rust/src/Timers.lf index 1043aad497..1ef5fc0ae5 100644 --- a/test/Rust/src/Timers.lf +++ b/test/Rust/src/Timers.lf @@ -6,7 +6,7 @@ target Rust { main reactor Timers { timer t(0, 1 sec) timer t2(0, 2 sec) - state counter: i32(0) + state counter: i32 = 0 reaction(t2) {= self.counter += 2; =} diff --git a/test/Rust/src/TypeVarLengthList.lf b/test/Rust/src/TypeVarLengthList.lf index 9dbf082f1f..37ff36df56 100644 --- a/test/Rust/src/TypeVarLengthList.lf +++ b/test/Rust/src/TypeVarLengthList.lf @@ -3,7 +3,7 @@ target Rust // this thing must compile needs to be modified when // https://github.com/lf-lang/lingua-franca/discussions/492 is implemented main reactor TypeVarLengthList { - state l0: i32[]({= Vec::new() =}) // generates l0: Vec::new() + state l0: i32[] = {= Vec::new() =} // generates l0: Vec::new() // generates l1: vec![1, 2] /** * - state l2: i32[](1); // generates l2: 1 // doesn't compile... diff --git a/test/Rust/src/concurrent/AsyncCallback.lf b/test/Rust/src/concurrent/AsyncCallback.lf index 053d8ae33d..dccbcf37c0 100644 --- a/test/Rust/src/concurrent/AsyncCallback.lf +++ b/test/Rust/src/concurrent/AsyncCallback.lf @@ -4,17 +4,17 @@ target Rust { cargo-features: ["cli"] } -main reactor AsyncCallback(period: time(10 msec)) { +main reactor AsyncCallback(period: time = 10 msec) { preamble {= use std::thread; =} timer t(0, period) state thread: Option> - state expected_time: time(period) - state period: time(period) - state toggle: bool(false) + state expected_time: time = period + state period: time = period + state toggle: bool = false physical action act - state i: u32(0) + state i: u32 = 0 reaction(t) -> act {= let act = act.clone(); diff --git a/test/Rust/src/generics/CtorParamGeneric.lf b/test/Rust/src/generics/CtorParamGeneric.lf index 93646e1746..1c8b1cab24 100644 --- a/test/Rust/src/generics/CtorParamGeneric.lf +++ b/test/Rust/src/generics/CtorParamGeneric.lf @@ -2,10 +2,10 @@ target Rust reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug =}>( - value: T({= Default::default() =}) + value: T = {= Default::default() =} ) { input in: T - state v: T(value) + state v: T = value reaction(in) {= ctx.use_ref_opt(r#in, |i| { diff --git a/test/Rust/src/generics/CtorParamGenericInst.lf b/test/Rust/src/generics/CtorParamGenericInst.lf index 63c38b2e16..86f696185c 100644 --- a/test/Rust/src/generics/CtorParamGenericInst.lf +++ b/test/Rust/src/generics/CtorParamGenericInst.lf @@ -5,10 +5,10 @@ target Rust reactor Generic2< {= T: Default + Eq + Sync + std::fmt::Debug + Send + 'static =} >( - value: T({= Default::default() =}) + value: T = {= Default::default() =} ) { input in: T - state v: T(value) + state v: T = value reaction(in) {= ctx.use_ref_opt(r#in, |i| { @@ -21,7 +21,7 @@ reactor Generic2< reactor Generic< {= T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'static =} >( - value: T({= Default::default() =}) + value: T = {= Default::default() =} ) { input in: T diff --git a/test/Rust/src/generics/GenericReactor.lf b/test/Rust/src/generics/GenericReactor.lf index 0bf0675c02..3190524a5b 100644 --- a/test/Rust/src/generics/GenericReactor.lf +++ b/test/Rust/src/generics/GenericReactor.lf @@ -9,7 +9,7 @@ reactor Box<{= T: Sync =}> { } main reactor { - state done: bool(false) + state done: bool = false box0 = new Box() box1 = new Box() diff --git a/test/Rust/src/multiport/ConnectionToSelfBank.lf b/test/Rust/src/multiport/ConnectionToSelfBank.lf index cbdb4ffa5a..c39933de9b 100644 --- a/test/Rust/src/multiport/ConnectionToSelfBank.lf +++ b/test/Rust/src/multiport/ConnectionToSelfBank.lf @@ -1,10 +1,10 @@ target Rust -reactor Node(bank_index: usize(0), num_nodes: usize(4)) { +reactor Node(bank_index: usize = 0, num_nodes: usize = 4) { input[num_nodes] in: usize output out: usize - state bank_index(bank_index) - state num_nodes(num_nodes) + state bank_index = bank_index + state num_nodes = num_nodes reaction(startup) -> out {= ctx.set(out, self.bank_index); =} @@ -15,7 +15,7 @@ reactor Node(bank_index: usize(0), num_nodes: usize(4)) { =} } -main reactor(num_nodes: usize(4)) { +main reactor(num_nodes: usize = 4) { nodes = new[num_nodes] Node(num_nodes = num_nodes) (nodes.out)+ -> nodes.in } diff --git a/test/Rust/src/multiport/ConnectionToSelfMultiport.lf b/test/Rust/src/multiport/ConnectionToSelfMultiport.lf index b29efc3fdf..6042ad7af5 100644 --- a/test/Rust/src/multiport/ConnectionToSelfMultiport.lf +++ b/test/Rust/src/multiport/ConnectionToSelfMultiport.lf @@ -1,10 +1,10 @@ // test a connection from a multiport to another multiport of the same reactor target Rust -reactor Node(num_nodes: usize(4)) { +reactor Node(num_nodes: usize = 4) { input[num_nodes] in: usize output[num_nodes] out: usize - state num_nodes(num_nodes) + state num_nodes = num_nodes reaction(startup) -> out {= for (i, out) in out.into_iter().enumerate() { @@ -19,7 +19,7 @@ reactor Node(num_nodes: usize(4)) { =} } -main reactor(num_nodes: usize(4)) { +main reactor(num_nodes: usize = 4) { nodes = new Node(num_nodes = num_nodes) nodes.out -> nodes.in // todo: (nodes.out)+ -> nodes.in; } diff --git a/test/Rust/src/multiport/CycledLhs_SelfLoop.lf b/test/Rust/src/multiport/CycledLhs_SelfLoop.lf index 5248dcd11e..925fafce21 100644 --- a/test/Rust/src/multiport/CycledLhs_SelfLoop.lf +++ b/test/Rust/src/multiport/CycledLhs_SelfLoop.lf @@ -8,7 +8,7 @@ reactor Test { output out: u32 input[2] in: u32 logical action act: u32 - state last: u32(1) + state last: u32 = 1 reaction(startup) -> act {= ctx.schedule_with_v(act, Some(1), after!(1 us)); diff --git a/test/Rust/src/multiport/CycledLhs_Single.lf b/test/Rust/src/multiport/CycledLhs_Single.lf index 289bd85159..2fdd5c605c 100644 --- a/test/Rust/src/multiport/CycledLhs_Single.lf +++ b/test/Rust/src/multiport/CycledLhs_Single.lf @@ -8,7 +8,7 @@ reactor Test { output[2] out: u32 input[4] in: u32 logical action act: {= (u32, u32) =} - state last: u32(1) + state last: u32 = 1 reaction(startup) -> act {= ctx.schedule_with_v(act, Some((0, 1)), after!(1 us)); diff --git a/test/Rust/src/multiport/FullyConnected.lf b/test/Rust/src/multiport/FullyConnected.lf index 8dc87882ed..c4cd24f908 100644 --- a/test/Rust/src/multiport/FullyConnected.lf +++ b/test/Rust/src/multiport/FullyConnected.lf @@ -1,16 +1,16 @@ // test iterated connection on the left target Rust -reactor Left(bank_index: usize(0)) { +reactor Left(bank_index: usize = 0) { output out: usize - state bank_index(bank_index) + state bank_index = bank_index reaction(startup) -> out {= ctx.set(out, self.bank_index); =} } -reactor Right(bank_index: usize(0), num_nodes: usize(4)) { +reactor Right(bank_index: usize = 0, num_nodes: usize = 4) { input[num_nodes] in: usize - state num_nodes(num_nodes) + state num_nodes = num_nodes reaction(in) {= let count = r#in.iterate_set().count(); @@ -19,7 +19,7 @@ reactor Right(bank_index: usize(0), num_nodes: usize(4)) { =} } -main reactor(num_nodes: usize(4)) { +main reactor(num_nodes: usize = 4) { left = new[num_nodes] Left() right = new[num_nodes] Right(num_nodes = num_nodes) (left.out)+ -> right.in diff --git a/test/Rust/src/multiport/FullyConnectedAddressable.lf b/test/Rust/src/multiport/FullyConnectedAddressable.lf index 63aed7b840..2c8a056ed1 100644 --- a/test/Rust/src/multiport/FullyConnectedAddressable.lf +++ b/test/Rust/src/multiport/FullyConnectedAddressable.lf @@ -1,14 +1,14 @@ // In this pattern, each node can send direct messages to individual other nodes target Rust -reactor Node(bank_index: usize(0), num_nodes: usize(4)) { - state bank_index(bank_index) - state num_nodes(num_nodes) +reactor Node(bank_index: usize = 0, num_nodes: usize = 4) { + state bank_index = bank_index + state num_nodes = num_nodes input[num_nodes] inpt: usize output[num_nodes] out: usize - state received: bool(false) + state received: bool = false reaction(startup) -> out {= println!("Hello from node {}!", self.bank_index); @@ -43,7 +43,7 @@ reactor Node(bank_index: usize(0), num_nodes: usize(4)) { =} } -main reactor(num_nodes: usize(4)) { +main reactor(num_nodes: usize = 4) { nodes1 = new[num_nodes] Node(num_nodes = num_nodes) nodes1.out -> interleaved (nodes1.inpt) diff --git a/test/Rust/src/multiport/MultiportFromBank.lf b/test/Rust/src/multiport/MultiportFromBank.lf index f17a4ffa8d..6f0592ec36 100644 --- a/test/Rust/src/multiport/MultiportFromBank.lf +++ b/test/Rust/src/multiport/MultiportFromBank.lf @@ -3,14 +3,14 @@ target Rust { timeout: 2 sec } -reactor Source(bank_index: usize(0)) { +reactor Source(bank_index: usize = 0) { output out: usize - state bank_index(bank_index) + state bank_index = bank_index reaction(startup) -> out {= ctx.set(out, self.bank_index); =} } -reactor Destination(port_width: usize(2)) { +reactor Destination(port_width: usize = 2) { input[port_width] in: usize reaction(in) {= diff --git a/test/Rust/src/multiport/MultiportFromHierarchy.lf b/test/Rust/src/multiport/MultiportFromHierarchy.lf index 2745424e8c..d2af4253c4 100644 --- a/test/Rust/src/multiport/MultiportFromHierarchy.lf +++ b/test/Rust/src/multiport/MultiportFromHierarchy.lf @@ -7,7 +7,7 @@ target Rust { reactor Source { timer t(0, 200 msec) output[4] out: u32 - state s: u32(0) + state s: u32 = 0 reaction(t) -> out {= for chan in out { @@ -18,7 +18,7 @@ reactor Source { } reactor Destination { - state s: u32(6) + state s: u32 = 6 input[4] in: u32 reaction(in) {= diff --git a/test/Rust/src/multiport/MultiportIn.lf b/test/Rust/src/multiport/MultiportIn.lf index bbaeb65dda..4ebf1c56d5 100644 --- a/test/Rust/src/multiport/MultiportIn.lf +++ b/test/Rust/src/multiport/MultiportIn.lf @@ -8,7 +8,7 @@ target Rust { reactor Source { timer t(0, 200 msec) output out: u32 - state s: u32(0) + state s: u32 = 0 reaction(t) -> out {= ctx.set(out, self.s); @@ -26,7 +26,7 @@ reactor Computation { } reactor Destination { - state s: u32(0) + state s: u32 = 0 input[4] in: u32 reaction(in) {= diff --git a/test/Rust/src/multiport/MultiportOut.lf b/test/Rust/src/multiport/MultiportOut.lf index 010b3a9603..5e3b9afe77 100644 --- a/test/Rust/src/multiport/MultiportOut.lf +++ b/test/Rust/src/multiport/MultiportOut.lf @@ -6,7 +6,7 @@ target Rust { reactor Source { timer t(0, 200 msec) output[4] out: u32 - state s: u32(0) + state s: u32 = 0 reaction(t) -> out {= for i in 0..out.len() { @@ -30,7 +30,7 @@ reactor Computation { } reactor Destination { - state s: u32(0) + state s: u32 = 0 input[4] in: u32 reaction(in) {= diff --git a/test/Rust/src/multiport/MultiportToBank.lf b/test/Rust/src/multiport/MultiportToBank.lf index fcfdb8bf5d..445ab94d54 100644 --- a/test/Rust/src/multiport/MultiportToBank.lf +++ b/test/Rust/src/multiport/MultiportToBank.lf @@ -11,11 +11,11 @@ reactor Source { =} } -reactor Sink(bank_index: usize(0)) { +reactor Sink(bank_index: usize = 0) { input in: usize - state bank_index(bank_index) + state bank_index = bank_index - state asserts_done: u32(0) + state asserts_done: u32 = 0 reaction(in) {= assert_eq!(ctx.get(r#in), Some(self.bank_index)); diff --git a/test/Rust/src/multiport/MultiportToBankHierarchy.lf b/test/Rust/src/multiport/MultiportToBankHierarchy.lf index 6a7af77ebf..4d7dce445a 100644 --- a/test/Rust/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Rust/src/multiport/MultiportToBankHierarchy.lf @@ -13,11 +13,11 @@ reactor Source { =} } -reactor Destination(bank_index: usize(0)) { +reactor Destination(bank_index: usize = 0) { input in: usize - state bank_index(bank_index) - state asserts_done: u32(0) + state bank_index = bank_index + state asserts_done: u32 = 0 reaction(in) {= assert_eq!(ctx.get(r#in), Some(self.bank_index)); diff --git a/test/Rust/src/multiport/MultiportToMultiport2.lf b/test/Rust/src/multiport/MultiportToMultiport2.lf index 703c498ab3..a1e2db235d 100644 --- a/test/Rust/src/multiport/MultiportToMultiport2.lf +++ b/test/Rust/src/multiport/MultiportToMultiport2.lf @@ -2,7 +2,7 @@ // disconnected) target Rust -reactor Source(width: usize(2)) { +reactor Source(width: usize = 2) { output[width] out: usize reaction(startup) -> out {= @@ -12,7 +12,7 @@ reactor Source(width: usize(2)) { =} } -reactor Destination(width: usize(2)) { +reactor Destination(width: usize = 2) { input[width] in: usize reaction(in) {= diff --git a/test/Rust/src/multiport/ReadOutputOfContainedBank.lf b/test/Rust/src/multiport/ReadOutputOfContainedBank.lf index 80103366db..21bbdf6967 100644 --- a/test/Rust/src/multiport/ReadOutputOfContainedBank.lf +++ b/test/Rust/src/multiport/ReadOutputOfContainedBank.lf @@ -2,8 +2,8 @@ // permutations. target Rust -reactor Contained(bank_index: usize(0)) { - state bank_index(bank_index) +reactor Contained(bank_index: usize = 0) { + state bank_index = bank_index output out: usize @@ -12,7 +12,7 @@ reactor Contained(bank_index: usize(0)) { main reactor { c = new[4] Contained() - state count: usize(0) + state count: usize = 0 reaction(startup) c.out {= for (i, chan) in c__out.iter().enumerate() { diff --git a/test/Rust/src/multiport/WidthWithParameter.lf b/test/Rust/src/multiport/WidthWithParameter.lf index e32f67bec5..03e4617e87 100644 --- a/test/Rust/src/multiport/WidthWithParameter.lf +++ b/test/Rust/src/multiport/WidthWithParameter.lf @@ -1,6 +1,6 @@ target Rust -reactor Some(value: usize(30)) { +reactor Some(value: usize = 30) { output[value] finished: unit reaction(startup) -> finished {= diff --git a/test/Rust/src/multiport/WriteInputOfContainedBank.lf b/test/Rust/src/multiport/WriteInputOfContainedBank.lf index cab6e80e16..f339a3aea1 100644 --- a/test/Rust/src/multiport/WriteInputOfContainedBank.lf +++ b/test/Rust/src/multiport/WriteInputOfContainedBank.lf @@ -1,11 +1,11 @@ // Test writing inputs to a contained reactor bank target Rust -reactor Contained(bank_index: usize(0)) { - state bank_index(bank_index) +reactor Contained(bank_index: usize = 0) { + state bank_index = bank_index input inpt: usize - state count: usize(0) + state count: usize = 0 reaction(inpt) {= let result = ctx.get(inpt).unwrap(); diff --git a/test/Rust/src/target/CliFeature.lf b/test/Rust/src/target/CliFeature.lf index bfa8fb5746..2ef81e76bb 100644 --- a/test/Rust/src/target/CliFeature.lf +++ b/test/Rust/src/target/CliFeature.lf @@ -4,6 +4,6 @@ target Rust { } // todo allow test framework to pass CLI arguments. -main reactor CliFeature(size: u32(4), t: time(4 sec)) { +main reactor CliFeature(size: u32 = 4, t: time = 4 sec) { reaction(startup) {= println!("success"); =} } diff --git a/test/Rust/src/target/MainParameterCanBeExpression.lf b/test/Rust/src/target/MainParameterCanBeExpression.lf index 9e62cb29cb..99ab0d7389 100644 --- a/test/Rust/src/target/MainParameterCanBeExpression.lf +++ b/test/Rust/src/target/MainParameterCanBeExpression.lf @@ -3,8 +3,8 @@ target Rust { cargo-features: ["cli"] } -main reactor(size: u32({= 1u32 << 23 =})) { - state s(size) +main reactor(size: u32 = {= 1u32 << 23 =}) { + state s = size reaction(startup) {= assert_eq!(1u32 << 23, self.s); From 436ab1f49937a6a4d604146868653f8c083949c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 16:44:59 +0100 Subject: [PATCH 05/49] Turn off validator warnings in LFC because warnings do not prevent the file from being formatted, and after formatting the positions of the warnings are wrong which can cause errors --- org.lflang/src/org/lflang/cli/Lff.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/cli/Lff.java b/org.lflang/src/org/lflang/cli/Lff.java index 8161f07d98..9affbedcce 100644 --- a/org.lflang/src/org/lflang/cli/Lff.java +++ b/org.lflang/src/org/lflang/cli/Lff.java @@ -234,7 +234,10 @@ private void formatSingleFile(Path file, Path inputRoot, Path outputRoot, int li } exitIfCollectedErrors(); - issueCollector.getAllIssues().forEach(reporter::printIssue); + // Only errors are printed. Warnings are not helpful for LFF + // and since they don't prevent the file from being formatted, + // the position of the issue may be wrong in the formatted file. + // issueCollector.getAllIssues().forEach(reporter::printIssue); if (verbose) { String msg = "Formatted " + io.getWd().relativize(file); if (file != outputPath) msg += " -> " + io.getWd().relativize(outputPath); From 4e41deef23451d2ba3b37adda5697a409f5b16f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 16:53:57 +0100 Subject: [PATCH 06/49] Format remaining test files Some of them cannot really be fixed yet, like test/C/concurrent/ScheduleAt.lf --- test/C/src/ActionDelay.lf | 2 +- test/C/src/ActionIsPresent.lf | 4 +- test/C/src/After.lf | 4 +- test/C/src/AfterCycles.lf | 2 +- test/C/src/AfterOverlapped.lf | 4 +- test/C/src/AfterZero.lf | 4 +- test/C/src/Alignment.lf | 8 ++-- test/C/src/ArrayAsParameter.lf | 10 ++--- test/C/src/ArrayAsType.lf | 2 +- test/C/src/ArrayFree.lf | 2 +- test/C/src/ArrayFreeMultiple.lf | 4 +- test/C/src/ArrayPrint.lf | 8 ++-- test/C/src/ArrayScale.lf | 2 +- test/C/src/CharLiteralInitializer.lf | 2 +- test/C/src/Composition.lf | 6 +-- test/C/src/CompositionAfter.lf | 8 ++-- test/C/src/CompositionInheritance.lf | 6 +-- test/C/src/CountSelf.lf | 2 +- test/C/src/Deadline.lf | 8 ++-- test/C/src/DeadlineHandledAbove.lf | 4 +- test/C/src/DeadlineWithBanks.lf | 4 +- test/C/src/DeadlineZero.lf | 2 +- test/C/src/DelayArray.lf | 4 +- test/C/src/DelayArrayWithAfter.lf | 8 ++-- test/C/src/DelayInt.lf | 6 +-- test/C/src/DelayPointer.lf | 6 +-- test/C/src/DelayString.lf | 4 +- test/C/src/DelayStruct.lf | 4 +- test/C/src/DelayStructWithAfter.lf | 2 +- test/C/src/DelayStructWithAfterOverlapped.lf | 4 +- test/C/src/DelayedAction.lf | 2 +- test/C/src/DoubleInvocation.lf | 4 +- test/C/src/DoublePort.lf | 2 +- test/C/src/DoubleReaction.lf | 6 +-- test/C/src/DoubleTrigger.lf | 2 +- test/C/src/FloatLiteral.lf | 8 ++-- test/C/src/Gain.lf | 4 +- test/C/src/GetMicroStep.lf | 2 +- test/C/src/Hello.lf | 10 ++--- test/C/src/HelloWorld.lf | 2 +- test/C/src/Hierarchy2.lf | 4 +- test/C/src/IdentifierLength.lf | 6 +-- test/C/src/ImportComposition.lf | 2 +- test/C/src/InheritanceAction.lf | 2 +- test/C/src/ManualDelayedReaction.lf | 2 +- test/C/src/Methods.lf | 2 +- test/C/src/MethodsRecursive.lf | 2 +- test/C/src/MethodsSameName.lf | 4 +- test/C/src/MovingAverage.lf | 6 +-- test/C/src/MultipleContained.lf | 2 +- test/C/src/MultipleOutputs.lf | 2 +- test/C/src/NativeListsAndTimes.lf | 14 +++---- test/C/src/NestedTriggeredReactions.lf | 4 +- test/C/src/ParameterHierarchy.lf | 6 +-- test/C/src/ParameterizedState.lf | 4 +- test/C/src/PeriodicDesugared.lf | 2 +- test/C/src/PingPong.lf | 8 ++-- test/C/src/ReadOutputOfContainedReactor.lf | 2 +- test/C/src/ScheduleLogicalAction.lf | 2 +- test/C/src/SelfLoop.lf | 2 +- test/C/src/SendingInside.lf | 4 +- test/C/src/SendsPointerTest.lf | 2 +- test/C/src/SetArray.lf | 2 +- test/C/src/SetToken.lf | 2 +- test/C/src/SimpleDeadline.lf | 2 +- test/C/src/SlowingClock.lf | 4 +- test/C/src/SlowingClockPhysical.lf | 4 +- test/C/src/Starvation.lf | 6 +-- test/C/src/Stop.lf | 2 +- test/C/src/StopZero.lf | 2 +- test/C/src/Stride.lf | 6 +-- test/C/src/StructAsType.lf | 2 +- test/C/src/StructAsTypeDirect.lf | 2 +- test/C/src/StructParallel.lf | 6 +-- test/C/src/StructPrint.lf | 2 +- test/C/src/StructScale.lf | 6 +-- test/C/src/SubclassesAndStartup.lf | 6 +-- test/C/src/TimeLimit.lf | 8 ++-- test/C/src/TimeState.lf | 4 +- test/C/src/Timeout.lf | 2 +- test/C/src/TimeoutZero.lf | 2 +- test/C/src/ToReactionNested.lf | 4 +- test/C/src/TriggerDownstreamOnlyIfPresent2.lf | 2 +- test/C/src/UnconnectedInput.lf | 4 +- test/C/src/arduino/DigitalReadSerial.lf | 2 +- test/C/src/arduino/Fade.lf | 6 +-- test/C/src/concurrent/AsyncCallback.lf | 8 ++-- test/C/src/concurrent/AsyncCallbackDrop.lf | 8 ++-- test/C/src/concurrent/AsyncCallbackReplace.lf | 8 ++-- test/C/src/concurrent/CompositionThreaded.lf | 6 +-- .../DeadlineHandledAboveThreaded.lf | 4 +- test/C/src/concurrent/DeadlineThreaded.lf | 8 ++-- test/C/src/concurrent/DelayIntThreaded.lf | 6 +-- .../src/concurrent/DoubleReactionThreaded.lf | 6 +-- test/C/src/concurrent/GainThreaded.lf | 4 +- test/C/src/concurrent/HelloThreaded.lf | 10 ++--- test/C/src/concurrent/PingPongThreaded.lf | 8 ++-- test/C/src/concurrent/ScheduleAt.lf | 2 +- test/C/src/concurrent/ScheduleTwice.lf | 2 +- .../C/src/concurrent/ScheduleTwiceThreaded.lf | 2 +- .../C/src/concurrent/SendingInsideThreaded.lf | 4 +- test/C/src/concurrent/StarvationThreaded.lf | 6 +-- test/C/src/concurrent/StopThreaded.lf | 2 +- test/C/src/concurrent/StopZeroThreaded.lf | 2 +- test/C/src/concurrent/Threaded.lf | 8 ++-- test/C/src/concurrent/ThreadedMultiport.lf | 12 +++--- test/C/src/concurrent/ThreadedThreaded.lf | 8 ++-- test/C/src/concurrent/TimeLimitThreaded.lf | 8 ++-- test/C/src/concurrent/TimeoutThreaded.lf | 2 +- test/C/src/concurrent/TimeoutZeroThreaded.lf | 2 +- test/C/src/concurrent/Tracing.lf | 14 +++---- .../DistributedCountContainerized.lf | 4 +- test/C/src/federated/BroadcastFeedback.lf | 2 +- .../BroadcastFeedbackWithHierarchy.lf | 4 +- test/C/src/federated/CycleDetection.lf | 2 +- test/C/src/federated/DecentralizedP2PComm.lf | 10 ++--- .../DecentralizedP2PUnbalancedTimeout.lf | 8 ++-- ...centralizedP2PUnbalancedTimeoutPhysical.lf | 8 ++-- test/C/src/federated/DistributedBank.lf | 2 +- .../federated/DistributedBankToMultiport.lf | 2 +- test/C/src/federated/DistributedCount.lf | 4 +- .../DistributedCountDecentralized.lf | 2 +- .../DistributedCountDecentralizedLate.lf | 6 +-- ...tributedCountDecentralizedLateHierarchy.lf | 8 ++-- .../src/federated/DistributedCountPhysical.lf | 4 +- .../DistributedCountPhysicalAfterDelay.lf | 2 +- .../DistributedCountPhysicalDecentralized.lf | 4 +- test/C/src/federated/DistributedDoublePort.lf | 2 +- .../DistributedLogicalActionUpstreamLong.lf | 4 +- .../src/federated/DistributedLoopedAction.lf | 11 ++++-- .../DistributedLoopedActionDecentralized.lf | 19 ++++++---- .../DistributedLoopedPhysicalAction.lf | 15 +++++--- test/C/src/federated/DistributedMultiport.lf | 4 +- .../federated/DistributedMultiportToBank.lf | 4 +- .../federated/DistributedMultiportToken.lf | 2 +- .../src/federated/DistributedNetworkOrder.lf | 2 +- .../DistributedPhysicalActionUpstream.lf | 2 +- .../DistributedPhysicalActionUpstreamLong.lf | 2 +- test/C/src/federated/DistributedStop.lf | 6 +-- test/C/src/federated/DistributedToken.lf | 6 +-- test/C/src/federated/FeedbackDelay.lf | 8 ++-- test/C/src/federated/FeedbackDelaySimple.lf | 2 +- test/C/src/federated/HelloDistributed.lf | 2 +- .../federated/LoopDistributedCentralized.lf | 6 +-- .../federated/LoopDistributedCentralized2.lf | 10 ++--- ...oopDistributedCentralizedPhysicalAction.lf | 6 +-- .../LoopDistributedCentralizedPrecedence.lf | 8 ++-- ...stributedCentralizedPrecedenceHierarchy.lf | 12 +++--- .../federated/LoopDistributedDecentralized.lf | 6 +-- test/C/src/federated/LoopDistributedDouble.lf | 6 +-- test/C/src/federated/PhysicalSTP.lf | 4 +- test/C/src/federated/PingPongDistributed.lf | 2 +- .../federated/PingPongDistributedPhysical.lf | 10 ++--- test/C/src/federated/TopLevelArtifacts.lf | 2 +- test/C/src/federated/failing/ClockSync.lf | 2 +- .../failing/DistributedDoublePortLooped.lf | 4 +- .../failing/DistributedDoublePortLooped2.lf | 4 +- .../DistributedNetworkOrderDecentralized.lf | 2 +- .../LoopDistributedDecentralizedPrecedence.lf | 8 ++-- ...ributedDecentralizedPrecedenceHierarchy.lf | 38 ++++++++++--------- test/C/src/lib/Count.lf | 4 +- test/C/src/lib/InternalDelay.lf | 2 +- test/C/src/lib/LoopedActionSender.lf | 4 +- test/C/src/lib/Test.lf | 2 +- test/C/src/lib/TestCount.lf | 6 +-- test/C/src/lib/TestCountMultiport.lf | 12 +++--- test/C/src/modal_models/ConvertCaseTest.lf | 4 +- test/C/src/modal_models/Count3Modes.lf | 2 +- test/C/src/modal_models/MixedReactions.lf | 4 +- test/C/src/modal_models/ModalAfter.lf | 4 +- test/C/src/modal_models/ModalCycleBreaker.lf | 4 +- test/C/src/modal_models/ModalStateReset.lf | 6 +-- .../C/src/modal_models/ModalStateResetAuto.lf | 6 +-- .../MultipleOutputFeeder_2Connections.lf | 4 +- ...ultipleOutputFeeder_ReactionConnections.lf | 4 +- test/C/src/modal_models/util/TraceTesting.lf | 16 ++++---- test/C/src/multiport/BankIndexInitializer.lf | 8 ++-- .../src/multiport/BankMultiportToReaction.lf | 4 +- .../src/multiport/BankReactionsInContainer.lf | 6 +-- test/C/src/multiport/BankSelfBroadcast.lf | 4 +- test/C/src/multiport/BankToBank.lf | 10 ++--- test/C/src/multiport/BankToBankMultiport.lf | 10 ++--- .../src/multiport/BankToBankMultiportAfter.lf | 10 ++--- test/C/src/multiport/BankToMultiport.lf | 8 ++-- test/C/src/multiport/BankToReaction.lf | 2 +- test/C/src/multiport/Broadcast.lf | 4 +- test/C/src/multiport/BroadcastAfter.lf | 4 +- .../C/src/multiport/BroadcastMultipleAfter.lf | 6 +-- test/C/src/multiport/DualBanks.lf | 4 +- test/C/src/multiport/DualBanksMultiport.lf | 4 +- test/C/src/multiport/FullyConnected.lf | 6 +-- .../multiport/FullyConnectedAddressable.lf | 8 ++-- .../FullyConnectedAddressableAfter.lf | 2 +- test/C/src/multiport/MultiportFromBank.lf | 8 ++-- .../multiport/MultiportFromBankHierarchy.lf | 4 +- .../C/src/multiport/MultiportFromHierarchy.lf | 14 +++---- test/C/src/multiport/MultiportFromReaction.lf | 8 ++-- test/C/src/multiport/MultiportIn.lf | 4 +- .../src/multiport/MultiportInParameterized.lf | 6 +-- test/C/src/multiport/MultiportMutableInput.lf | 4 +- .../multiport/MultiportMutableInputArray.lf | 4 +- test/C/src/multiport/MultiportOut.lf | 4 +- test/C/src/multiport/MultiportToBank.lf | 8 ++-- test/C/src/multiport/MultiportToBankAfter.lf | 8 ++-- test/C/src/multiport/MultiportToBankDouble.lf | 4 +- .../src/multiport/MultiportToBankHierarchy.lf | 10 ++--- test/C/src/multiport/MultiportToHierarchy.lf | 12 +++--- test/C/src/multiport/MultiportToMultiport.lf | 10 ++--- test/C/src/multiport/MultiportToMultiport2.lf | 10 ++--- .../multiport/MultiportToMultiport2After.lf | 4 +- .../multiport/MultiportToMultiportArray.lf | 4 +- .../MultiportToMultiportParameter.lf | 10 ++--- test/C/src/multiport/MultiportToPort.lf | 4 +- test/C/src/multiport/MultiportToReaction.lf | 6 +-- test/C/src/multiport/NestedBanks.lf | 10 ++--- .../C/src/multiport/NestedInterleavedBanks.lf | 4 +- .../src/multiport/ReactionToContainedBank.lf | 4 +- .../src/multiport/ReactionToContainedBank2.lf | 6 +-- .../ReactionToContainedBankMultiport.lf | 4 +- test/C/src/multiport/ReactionsToNested.lf | 4 +- test/C/src/multiport/Sparse.lf | 8 ++-- test/C/src/multiport/SparseFallback.lf | 8 ++-- .../TriggerDownstreamOnlyIfPresent.lf | 2 +- .../serialization/ROSBuiltInSerialization.lf | 4 +- .../ROSBuiltInSerializationSharedPtr.lf | 4 +- test/C/src/target/HelloWorldCCPP.lf | 2 +- test/C/src/token/TokenContainedPrint.lf | 2 +- test/C/src/token/TokenContainedPrintBank.lf | 2 +- test/C/src/token/TokenContainedSource.lf | 6 +-- test/C/src/token/TokenContainedSourceBank.lf | 6 +-- test/C/src/token/lib/Token.lf | 10 ++--- test/Python/src/AfterOverlapped.lf | 4 +- test/Python/src/ArrayAsParameter.lf | 8 ++-- test/Python/src/ArrayScale.lf | 2 +- test/Python/src/DeadlineHandledAbove.lf | 4 +- test/Python/src/DelayArray.lf | 4 +- test/Python/src/DelayArrayWithAfter.lf | 8 ++-- test/Python/src/DelayStruct.lf | 4 +- test/Python/src/Hello.lf | 8 ++-- test/Python/src/HelloWorld.lf | 2 +- test/Python/src/ImportComposition.lf | 2 +- test/Python/src/Methods.lf | 2 +- test/Python/src/MovingAverage.lf | 6 +-- test/Python/src/ParameterizedState.lf | 4 +- test/Python/src/SlowingClockPhysical.lf | 4 +- test/Python/src/StructAsType.lf | 2 +- test/Python/src/StructParallel.lf | 4 +- test/Python/src/TimeLimit.lf | 8 ++-- .../DecentralizedP2PUnbalancedTimeout.lf | 8 ++-- ...centralizedP2PUnbalancedTimeoutPhysical.lf | 8 ++-- test/Python/src/federated/DistributedBank.lf | 2 +- test/Python/src/federated/DistributedCount.lf | 4 +- ...tributedCountDecentralizedLateHierarchy.lf | 2 +- .../src/federated/DistributedDoublePort.lf | 2 +- .../federated/DistributedMultiportToBank.lf | 4 +- ...stributedCentralizedPrecedenceHierarchy.lf | 12 +++--- test/Python/src/federated/PhysicalSTP.lf | 4 +- .../LoopDistributedCentralizedPrecedence.lf | 8 ++-- .../failing/LoopDistributedDouble.lf | 6 +-- .../src/modal_models/ConvertCaseTest.lf | 4 +- test/Python/src/modal_models/Count3Modes.lf | 2 +- test/Python/src/modal_models/ModalAfter.lf | 4 +- .../src/modal_models/ModalCycleBreaker.lf | 4 +- .../src/modal_models/ModalStateReset.lf | 6 +-- .../src/modal_models/ModalStateResetAuto.lf | 6 +-- .../MultipleOutputFeeder_2Connections.lf | 4 +- ...ultipleOutputFeeder_ReactionConnections.lf | 4 +- .../src/modal_models/util/TraceTesting.lf | 10 ++--- 268 files changed, 702 insertions(+), 687 deletions(-) diff --git a/test/C/src/ActionDelay.lf b/test/C/src/ActionDelay.lf index 6a4deddda6..86e510080a 100644 --- a/test/C/src/ActionDelay.lf +++ b/test/C/src/ActionDelay.lf @@ -4,7 +4,7 @@ target C reactor GeneratedDelay { input y_in: int output y_out: int - state y_state: int(0) + state y_state: int = 0 logical action act(100 msec) reaction(y_in) -> act {= diff --git a/test/C/src/ActionIsPresent.lf b/test/C/src/ActionIsPresent.lf index 4f8164bea8..b94108949e 100644 --- a/test/C/src/ActionIsPresent.lf +++ b/test/C/src/ActionIsPresent.lf @@ -1,9 +1,9 @@ // Tests the is_present variable for actions. target C -main reactor ActionIsPresent(offset: time(1 nsec), period: time(500 msec)) { +main reactor ActionIsPresent(offset: time = 1 nsec, period: time = 500 msec) { logical action a - state success: bool(false) + state success: bool = false reaction(startup, a) -> a {= if (!a->is_present) { diff --git a/test/C/src/After.lf b/test/C/src/After.lf index f354d9d7c8..d3663457e4 100644 --- a/test/C/src/After.lf +++ b/test/C/src/After.lf @@ -13,8 +13,8 @@ reactor foo { } reactor print { - state expected_time: time(10 msec) - state received: int(0) + state expected_time: time = 10 msec + state received: int = 0 input x: int reaction(x) {= diff --git a/test/C/src/AfterCycles.lf b/test/C/src/AfterCycles.lf index 3bc9622944..d7d621046b 100644 --- a/test/C/src/AfterCycles.lf +++ b/test/C/src/AfterCycles.lf @@ -16,7 +16,7 @@ reactor Work { } main reactor AfterCycles { - state count: int(0) + state count: int = 0 s = new Source() w0 = new Work() w1 = new Work() diff --git a/test/C/src/AfterOverlapped.lf b/test/C/src/AfterOverlapped.lf index 49d2c22bd2..0925dc5164 100644 --- a/test/C/src/AfterOverlapped.lf +++ b/test/C/src/AfterOverlapped.lf @@ -8,8 +8,8 @@ import Count from "lib/Count.lf" reactor Test { input c: int - state i: int(0) - state received: int(0) + state i: int = 0 + state received: int = 0 reaction(c) {= self->received++; diff --git a/test/C/src/AfterZero.lf b/test/C/src/AfterZero.lf index 85e1d2e000..378114c730 100644 --- a/test/C/src/AfterZero.lf +++ b/test/C/src/AfterZero.lf @@ -13,8 +13,8 @@ reactor foo { } reactor print { - state expected_time: time(0) - state received: int(0) + state expected_time: time = 0 + state received: int = 0 input x: int reaction(x) {= diff --git a/test/C/src/Alignment.lf b/test/C/src/Alignment.lf index 7420bd51c1..551b7c8342 100644 --- a/test/C/src/Alignment.lf +++ b/test/C/src/Alignment.lf @@ -7,7 +7,7 @@ target C { reactor Source { output out: int - state count: int(1) + state count: int = 1 timer t(0, 100 msec) reaction(t) -> out {= lf_set(out, self->count++); =} @@ -16,8 +16,8 @@ reactor Source { reactor Sieve { input in: int output out: bool - state primes: int*({= NULL =}) - state last_prime: int(0) + state primes: int* = {= NULL =} + state last_prime: int = 0 reaction(startup) {= // There are 1229 primes between 1 and 10,000. @@ -74,7 +74,7 @@ reactor Sieve { reactor Destination { input ok: bool input in: int - state last_invoked: tag_t({= NEVER_TAG_INITIALIZER =}) + state last_invoked: tag_t = {= NEVER_TAG_INITIALIZER =} reaction(ok, in) {= if (ok->is_present && in->is_present) { diff --git a/test/C/src/ArrayAsParameter.lf b/test/C/src/ArrayAsParameter.lf index d51778980e..f235ef5f96 100644 --- a/test/C/src/ArrayAsParameter.lf +++ b/test/C/src/ArrayAsParameter.lf @@ -3,9 +3,9 @@ // encode their own length. target C -reactor Source(sequence: int[](0, 1, 2), n_sequence: int(3)) { +reactor Source(sequence: int[](0, 1, 2), n_sequence: int = 3) { output out: int - state count: int(0) + state count: int = 0 logical action next reaction(startup, next) -> out, next {= @@ -19,8 +19,8 @@ reactor Source(sequence: int[](0, 1, 2), n_sequence: int(3)) { reactor Print { input in: int - state count: int(1) - state received: int(0) + state count: int = 1 + state received: int = 0 reaction(in) {= self->received++; @@ -41,7 +41,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence = (1, 2, 3, 4), n_sequence = 4) + s = new Source(sequence(1, 2, 3, 4), n_sequence = 4) p = new Print() s.out -> p.in } diff --git a/test/C/src/ArrayAsType.lf b/test/C/src/ArrayAsType.lf index ad326c9288..c95e5bf385 100644 --- a/test/C/src/ArrayAsType.lf +++ b/test/C/src/ArrayAsType.lf @@ -13,7 +13,7 @@ reactor Source { =} } -reactor Print(scale: int(1)) { // The scale parameter is just for testing. +reactor Print(scale: int = 1) { // The scale parameter is just for testing. input in: int[3] reaction(in) {= diff --git a/test/C/src/ArrayFree.lf b/test/C/src/ArrayFree.lf index eea521aa72..11b31c123f 100644 --- a/test/C/src/ArrayFree.lf +++ b/test/C/src/ArrayFree.lf @@ -10,7 +10,7 @@ target C { import Source, Print from "ArrayPrint.lf" import Scale from "ArrayScale.lf" -reactor Free(scale: int(2), size: int(3)) { +reactor Free(scale: int = 2, size: int = 3) { mutable input in: int[] reaction(in) {= diff --git a/test/C/src/ArrayFreeMultiple.lf b/test/C/src/ArrayFreeMultiple.lf index b82bea9162..7b933ce518 100644 --- a/test/C/src/ArrayFreeMultiple.lf +++ b/test/C/src/ArrayFreeMultiple.lf @@ -12,7 +12,7 @@ import Print from "ArrayPrint.lf" reactor Source { output out: int[] - state c: int(0) + state c: int = 0 timer t(0, 1 sec) reaction(t) -> out {= @@ -26,7 +26,7 @@ reactor Source { =} } -reactor Free(scale: int(2)) { +reactor Free(scale: int = 2) { mutable input in: int[] reaction(in) {= diff --git a/test/C/src/ArrayPrint.lf b/test/C/src/ArrayPrint.lf index 33d75c6455..937bc51bea 100644 --- a/test/C/src/ArrayPrint.lf +++ b/test/C/src/ArrayPrint.lf @@ -6,9 +6,9 @@ target C { fast: true } -reactor Source(size: int(3)) { +reactor Source(size: int = 3) { output out: int[] - state count: int(0) + state count: int = 0 timer t(0, 1 sec) reaction(t) -> out {= @@ -26,9 +26,9 @@ reactor Source(size: int(3)) { } // The scale parameter is just for testing. -reactor Print(scale: int(1), size: int(3)) { +reactor Print(scale: int = 1, size: int = 3) { input in: int[] - state count: int(0) + state count: int = 0 reaction(in) {= bool failed = false; // For testing. diff --git a/test/C/src/ArrayScale.lf b/test/C/src/ArrayScale.lf index 257b0645c3..63edfc421c 100644 --- a/test/C/src/ArrayScale.lf +++ b/test/C/src/ArrayScale.lf @@ -9,7 +9,7 @@ target C { import Print, Source from "ArrayPrint.lf" -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { mutable input in: int[] output out: int[] diff --git a/test/C/src/CharLiteralInitializer.lf b/test/C/src/CharLiteralInitializer.lf index 9ee206efbf..319af0224c 100644 --- a/test/C/src/CharLiteralInitializer.lf +++ b/test/C/src/CharLiteralInitializer.lf @@ -2,7 +2,7 @@ target C main reactor CharLiteralInitializer { - state c: char('x') + state c: char = 'x' reaction(startup) {= if (self->c != 'x') { diff --git a/test/C/src/Composition.lf b/test/C/src/Composition.lf index c450bc0a64..7c024a9eba 100644 --- a/test/C/src/Composition.lf +++ b/test/C/src/Composition.lf @@ -5,10 +5,10 @@ target C { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -19,7 +19,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= (self->count)++; diff --git a/test/C/src/CompositionAfter.lf b/test/C/src/CompositionAfter.lf index 43f604de06..cb98ef7d7e 100644 --- a/test/C/src/CompositionAfter.lf +++ b/test/C/src/CompositionAfter.lf @@ -5,10 +5,10 @@ target C { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -18,7 +18,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= (self->count)++; @@ -30,7 +30,7 @@ reactor Test { =} } -main reactor CompositionAfter(delay: time(5 sec)) { +main reactor CompositionAfter(delay: time = 5 sec) { s = new Source() d = new Test() s.y -> d.x after delay diff --git a/test/C/src/CompositionInheritance.lf b/test/C/src/CompositionInheritance.lf index f57c1a688e..06221e9788 100644 --- a/test/C/src/CompositionInheritance.lf +++ b/test/C/src/CompositionInheritance.lf @@ -5,11 +5,11 @@ target C { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { input foo: int output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= printf("Hello World. At time %lld, my count is: %d.\n", lf_time_logical_elapsed(), self->count); @@ -30,7 +30,7 @@ reactor SourceExtended extends Source { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= (self->count)++; diff --git a/test/C/src/CountSelf.lf b/test/C/src/CountSelf.lf index 1a7a6d1ff2..1ef27187ae 100644 --- a/test/C/src/CountSelf.lf +++ b/test/C/src/CountSelf.lf @@ -6,7 +6,7 @@ target C { import TestCount from "lib/TestCount.lf" -reactor CountSelf2(delay: time(100 msec)) { +reactor CountSelf2(delay: time = 100 msec) { output out: int logical action a: int diff --git a/test/C/src/Deadline.lf b/test/C/src/Deadline.lf index 62116353a5..c72dc16dcf 100644 --- a/test/C/src/Deadline.lf +++ b/test/C/src/Deadline.lf @@ -5,10 +5,10 @@ target C { timeout: 6 sec } -reactor Source(period: time(3 sec)) { +reactor Source(period: time = 3 sec) { output y: int timer t(0, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= if (2 * (self->count / 2) != self->count) { @@ -22,9 +22,9 @@ reactor Source(period: time(3 sec)) { =} } -reactor Destination(timeout: time(1 sec)) { +reactor Destination(timeout: time = 1 sec) { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= printf("Destination receives: %d\n", x->value); diff --git a/test/C/src/DeadlineHandledAbove.lf b/test/C/src/DeadlineHandledAbove.lf index d186bf9016..92d7e9dac8 100644 --- a/test/C/src/DeadlineHandledAbove.lf +++ b/test/C/src/DeadlineHandledAbove.lf @@ -2,7 +2,7 @@ // container reacts to that output. target C -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: int output deadline_violation: bool @@ -16,7 +16,7 @@ reactor Deadline(threshold: time(100 msec)) { } main reactor DeadlineHandledAbove { - state violation_detected: bool(false) + state violation_detected: bool = false d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/C/src/DeadlineWithBanks.lf b/test/C/src/DeadlineWithBanks.lf index 266208cdac..18bc8c3682 100644 --- a/test/C/src/DeadlineWithBanks.lf +++ b/test/C/src/DeadlineWithBanks.lf @@ -11,7 +11,7 @@ target C { preamble {= volatile int global_cnt = 0; =} -reactor Bank(bank_index: int(0)) { +reactor Bank(bank_index: int = 0) { timer t(0, 100 msec) output out: int @@ -46,7 +46,7 @@ reactor Bank(bank_index: int(0)) { =} } -reactor Sink(dead: time(0)) { +reactor Sink(dead: time = 0) { input in: int reaction(in) {= =} deadline(dead) {= =} diff --git a/test/C/src/DeadlineZero.lf b/test/C/src/DeadlineZero.lf index 4e946bb63d..3ae49a9409 100644 --- a/test/C/src/DeadlineZero.lf +++ b/test/C/src/DeadlineZero.lf @@ -5,7 +5,7 @@ target C { reactor Detector { input trigger: int - state cnt: int(0) + state cnt: int = 0 reaction(trigger) {= printf("ERROR: failed to detect zero-duration deadline at iteration %d.\n", self->cnt); diff --git a/test/C/src/DelayArray.lf b/test/C/src/DelayArray.lf index 19e49e2464..72eb734888 100644 --- a/test/C/src/DelayArray.lf +++ b/test/C/src/DelayArray.lf @@ -4,7 +4,7 @@ target C { build-type: RelWithDebInfo } -reactor DelayPointer(delay: time(100 msec)) { +reactor DelayPointer(delay: time = 100 msec) { input in: int[] output out: int[] logical action a: int[] @@ -30,7 +30,7 @@ reactor Source { =} } -reactor Print(scale: int(1)) { // The scale parameter is just for testing. +reactor Print(scale: int = 1) { // The scale parameter is just for testing. input in: int[] reaction(in) {= diff --git a/test/C/src/DelayArrayWithAfter.lf b/test/C/src/DelayArrayWithAfter.lf index 42d7ff5275..c94be3b9a1 100644 --- a/test/C/src/DelayArrayWithAfter.lf +++ b/test/C/src/DelayArrayWithAfter.lf @@ -7,7 +7,7 @@ target C { reactor Source { output out: int[] - state iteration: int(1) + state iteration: int = 1 timer t(0, 1 sec) reaction(t) -> out {= @@ -23,10 +23,10 @@ reactor Source { =} } -reactor Print(scale: int(1)) { // The scale parameter is just for testing. +reactor Print(scale: int = 1) { // The scale parameter is just for testing. input in: int[] - state iteration: int(1) - state inputs_received: int(0) + state iteration: int = 1 + state inputs_received: int = 0 reaction(in) {= self->inputs_received++; diff --git a/test/C/src/DelayInt.lf b/test/C/src/DelayInt.lf index c7c27132bc..78ca793716 100644 --- a/test/C/src/DelayInt.lf +++ b/test/C/src/DelayInt.lf @@ -1,7 +1,7 @@ // This tests actions with payloads by delaying an input by a fixed amount. target C -reactor Delay(delay: time(100 msec)) { +reactor Delay(delay: time = 100 msec) { input in: int output out: int logical action a: int @@ -18,8 +18,8 @@ reactor Delay(delay: time(100 msec)) { reactor Test { input in: int - state start_time: time(0) - state received_value: bool(false) + state start_time: time = 0 + state received_value: bool = false reaction(startup) {= // Record the logical time at the start. diff --git a/test/C/src/DelayPointer.lf b/test/C/src/DelayPointer.lf index 87455d32ec..c6313c199d 100644 --- a/test/C/src/DelayPointer.lf +++ b/test/C/src/DelayPointer.lf @@ -1,7 +1,7 @@ // Test delaying a pointer type. target C -reactor DelayPointer2(delay: time(100 msec)) { +reactor DelayPointer2(delay: time = 100 msec) { input in: int* output out: int* logical action a: int* @@ -30,8 +30,8 @@ reactor Source { reactor Test { input in: int* - state start_time: time(0) - state received_value: bool(false) + state start_time: time = 0 + state received_value: bool = false reaction(startup) {= // Record the logical time at the start. diff --git a/test/C/src/DelayString.lf b/test/C/src/DelayString.lf index 1c77190581..b14e680d72 100644 --- a/test/C/src/DelayString.lf +++ b/test/C/src/DelayString.lf @@ -2,7 +2,7 @@ // freed. target C -reactor DelayString2(delay: time(100 msec)) { +reactor DelayString2(delay: time = 100 msec) { input in: string output out: string logical action a: string @@ -17,7 +17,7 @@ reactor DelayString2(delay: time(100 msec)) { reactor Test { input in: string - state start_time: time(0) + state start_time: time = 0 reaction(in) {= printf("Received: %s.\n", in->value); diff --git a/test/C/src/DelayStruct.lf b/test/C/src/DelayStruct.lf index a92acdc483..9cd201aa11 100644 --- a/test/C/src/DelayStruct.lf +++ b/test/C/src/DelayStruct.lf @@ -7,7 +7,7 @@ preamble {= #include "hello.h" =} -reactor DelayPointer(delay: time(100 msec)) { +reactor DelayPointer(delay: time = 100 msec) { input in: hello_t* output out: hello_t* logical action a: hello_t* @@ -38,7 +38,7 @@ reactor Source { =} } -reactor Print(expected: int(42)) { // expected parameter is for testing. +reactor Print(expected: int = 42) { // expected parameter is for testing. input in: hello_t* reaction(in) {= diff --git a/test/C/src/DelayStructWithAfter.lf b/test/C/src/DelayStructWithAfter.lf index 14f24aaf88..6693a437e6 100644 --- a/test/C/src/DelayStructWithAfter.lf +++ b/test/C/src/DelayStructWithAfter.lf @@ -20,7 +20,7 @@ reactor Source { =} } -reactor Print(expected: int(42)) { // expected parameter is for testing. +reactor Print(expected: int = 42) { // expected parameter is for testing. input in: hello_t* reaction(in) {= diff --git a/test/C/src/DelayStructWithAfterOverlapped.lf b/test/C/src/DelayStructWithAfterOverlapped.lf index 671b1ca4b3..8161022653 100644 --- a/test/C/src/DelayStructWithAfterOverlapped.lf +++ b/test/C/src/DelayStructWithAfterOverlapped.lf @@ -12,7 +12,7 @@ preamble {= reactor Source { output out: hello_t* timer t(0, 1 sec) - state s: int(0) + state s: int = 0 reaction(t) -> out {= self->s++; @@ -27,7 +27,7 @@ reactor Source { reactor Print { // expected parameter is for testing. input in: hello_t* - state s: int(0) + state s: int = 0 reaction(in) {= self->s++; diff --git a/test/C/src/DelayedAction.lf b/test/C/src/DelayedAction.lf index b37f6b9710..28a3e81ac5 100644 --- a/test/C/src/DelayedAction.lf +++ b/test/C/src/DelayedAction.lf @@ -6,7 +6,7 @@ target C { main reactor DelayedAction { timer t(0, 1 sec) logical action a - state count: int(0) + state count: int = 0 reaction(t) -> a {= lf_schedule(a, MSEC(100)); =} diff --git a/test/C/src/DoubleInvocation.lf b/test/C/src/DoubleInvocation.lf index 4b60f26fa8..973c8b18f6 100644 --- a/test/C/src/DoubleInvocation.lf +++ b/test/C/src/DoubleInvocation.lf @@ -13,7 +13,7 @@ target C { reactor Ball { output position: int output velocity: int - state p: int(200) + state p: int = 200 timer trigger(0, 1 sec) reaction(trigger) -> position, velocity {= @@ -26,7 +26,7 @@ reactor Ball { reactor Print { input velocity: int input position: int - state previous: int(-1) + state previous: int = -1 reaction(startup) {= printf("####### Print startup\n"); diff --git a/test/C/src/DoublePort.lf b/test/C/src/DoublePort.lf index 97d18f1761..c8bf9811f8 100644 --- a/test/C/src/DoublePort.lf +++ b/test/C/src/DoublePort.lf @@ -13,7 +13,7 @@ target C { import Count from "lib/Count.lf" reactor CountMicrostep { - state count: int(1) + state count: int = 1 output out: int logical action act: int timer t(0, 1 sec) diff --git a/test/C/src/DoubleReaction.lf b/test/C/src/DoubleReaction.lf index fb6aaaabaa..8da6210825 100644 --- a/test/C/src/DoubleReaction.lf +++ b/test/C/src/DoubleReaction.lf @@ -5,10 +5,10 @@ target C { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int input w: int - state s: int(2) + state s: int = 2 reaction(x, w) {= int sum = 0; diff --git a/test/C/src/DoubleTrigger.lf b/test/C/src/DoubleTrigger.lf index 201ac35d7c..68ad603168 100644 --- a/test/C/src/DoubleTrigger.lf +++ b/test/C/src/DoubleTrigger.lf @@ -8,7 +8,7 @@ target C { main reactor DoubleTrigger { timer t1 timer t2 - state s: int(0) + state s: int = 0 reaction(t1, t2) {= self->s++; diff --git a/test/C/src/FloatLiteral.lf b/test/C/src/FloatLiteral.lf index 6d55f6e988..576a20d1ac 100644 --- a/test/C/src/FloatLiteral.lf +++ b/test/C/src/FloatLiteral.lf @@ -6,10 +6,10 @@ main reactor { #include =} - state N: double(6.0221409e+23) - state charge: double(-1.6021766E-19) - state minus_epsilon: double(-.01e0) - state expected: double(.964853323188E5) + state N: double = 6.0221409e+23 + state charge: double = -1.6021766E-19 + state minus_epsilon: double = -.01e0 + state expected: double = .964853323188E5 reaction(startup) {= double F = - self->N * self->charge; diff --git a/test/C/src/Gain.lf b/test/C/src/Gain.lf index 4096ec5973..7cac5eaae6 100644 --- a/test/C/src/Gain.lf +++ b/test/C/src/Gain.lf @@ -1,7 +1,7 @@ // Example in the Wiki. target C -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { input x: int output y: int @@ -10,7 +10,7 @@ reactor Scale(scale: int(2)) { reactor Test { input x: int - state received_value: bool(false) + state received_value: bool = false reaction(x) {= printf("Received %d.\n", x->value); diff --git a/test/C/src/GetMicroStep.lf b/test/C/src/GetMicroStep.lf index 4c7094c42e..0a428fd07d 100644 --- a/test/C/src/GetMicroStep.lf +++ b/test/C/src/GetMicroStep.lf @@ -2,7 +2,7 @@ target C main reactor GetMicroStep { - state s: int(1) + state s: int = 1 logical action l diff --git a/test/C/src/Hello.lf b/test/C/src/Hello.lf index f47b66ecc4..ea37265a23 100644 --- a/test/C/src/Hello.lf +++ b/test/C/src/Hello.lf @@ -8,9 +8,9 @@ target C { fast: true } -reactor Reschedule(period: time(2 sec), message: string("Hello C")) { - state count: int(0) - state previous_time: time(0) +reactor Reschedule(period: time = 2 sec, message: string = "Hello C") { + state count: int = 0 + state previous_time: time = 0 timer t(1 sec, period) logical action a @@ -43,8 +43,8 @@ reactor Reschedule(period: time(2 sec), message: string("Hello C")) { } reactor Inside( - period: time(1 sec), - message: string("Composite default message.") + period: time = 1 sec, + message: string = "Composite default message." ) { third_instance = new Reschedule(period = period, message = message) } diff --git a/test/C/src/HelloWorld.lf b/test/C/src/HelloWorld.lf index dc17cc0626..7de913c8ad 100644 --- a/test/C/src/HelloWorld.lf +++ b/test/C/src/HelloWorld.lf @@ -7,7 +7,7 @@ target C { } reactor HelloWorld2 { - state success: bool(false) + state success: bool = false reaction(startup) {= printf("Hello World.\n"); diff --git a/test/C/src/Hierarchy2.lf b/test/C/src/Hierarchy2.lf index 07fa4c73a0..0a4f20d4bc 100644 --- a/test/C/src/Hierarchy2.lf +++ b/test/C/src/Hierarchy2.lf @@ -14,7 +14,7 @@ reactor Source { reactor Count { output out: int timer t(0, 1 sec) - state i: int(0) + state i: int = 0 reaction(t) -> out {= (self->i)++; @@ -37,7 +37,7 @@ reactor Add { reactor Print { input in: int - state expected: int(2) + state expected: int = 2 reaction(in) {= printf("Received: %d.\n", in->value); diff --git a/test/C/src/IdentifierLength.lf b/test/C/src/IdentifierLength.lf index 69f1fcfd75..8fa38b96f0 100644 --- a/test/C/src/IdentifierLength.lf +++ b/test/C/src/IdentifierLength.lf @@ -5,10 +5,10 @@ target C { fast: true } -reactor A_Really_Long_Name_For_A_Source(period: time(2 sec)) { +reactor A_Really_Long_Name_For_A_Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -18,7 +18,7 @@ reactor A_Really_Long_Name_For_A_Source(period: time(2 sec)) { reactor Another_Really_Long_Name_For_A_Test_Class { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= (self->count)++; diff --git a/test/C/src/ImportComposition.lf b/test/C/src/ImportComposition.lf index 023c9736b2..22a1bfef87 100644 --- a/test/C/src/ImportComposition.lf +++ b/test/C/src/ImportComposition.lf @@ -6,7 +6,7 @@ import ImportedComposition from "lib/ImportedComposition.lf" main reactor ImportComposition { a = new ImportedComposition() - state received: bool(false) + state received: bool = false reaction(startup) -> a.x {= lf_set(a.x, 42); =} diff --git a/test/C/src/InheritanceAction.lf b/test/C/src/InheritanceAction.lf index 3941882f2c..680ffe2f75 100644 --- a/test/C/src/InheritanceAction.lf +++ b/test/C/src/InheritanceAction.lf @@ -17,7 +17,7 @@ reactor SourceExtended extends Source { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= (self->count)++; diff --git a/test/C/src/ManualDelayedReaction.lf b/test/C/src/ManualDelayedReaction.lf index 1402e00c62..72c57105ce 100644 --- a/test/C/src/ManualDelayedReaction.lf +++ b/test/C/src/ManualDelayedReaction.lf @@ -9,7 +9,7 @@ target C { reactor GeneratedDelay { input y_in: int output y_out: int - state y_state: int(0) + state y_state: int = 0 physical action act(0 msec) // TODO: delay in act or the schedule call? diff --git a/test/C/src/Methods.lf b/test/C/src/Methods.lf index 02f1f68c8e..edbdd2f7f6 100644 --- a/test/C/src/Methods.lf +++ b/test/C/src/Methods.lf @@ -1,7 +1,7 @@ target C main reactor { - state foo: int(2) + state foo: int = 2 method getFoo(): int {= return self->foo; =} diff --git a/test/C/src/MethodsRecursive.lf b/test/C/src/MethodsRecursive.lf index 73588e5115..5465e0c92c 100644 --- a/test/C/src/MethodsRecursive.lf +++ b/test/C/src/MethodsRecursive.lf @@ -2,7 +2,7 @@ target C main reactor { - state foo: int(2) + state foo: int = 2 method fib(n: int): int {= // Return the n-th Fibonacci number. if (n <= 1) return 1; diff --git a/test/C/src/MethodsSameName.lf b/test/C/src/MethodsSameName.lf index d2978ba4db..b274d153c8 100644 --- a/test/C/src/MethodsSameName.lf +++ b/test/C/src/MethodsSameName.lf @@ -2,7 +2,7 @@ target C reactor Foo { - state foo: int(2) + state foo: int = 2 method add(x: int) {= self->foo += x; =} @@ -16,7 +16,7 @@ reactor Foo { } main reactor { - state foo: int(2) + state foo: int = 2 a = new Foo() diff --git a/test/C/src/MovingAverage.lf b/test/C/src/MovingAverage.lf index cd135dbd26..bdc47be451 100644 --- a/test/C/src/MovingAverage.lf +++ b/test/C/src/MovingAverage.lf @@ -10,7 +10,7 @@ import TestDouble from "lib/Test.lf" reactor MASource { output out: double - state count: int(0) + state count: int = 0 timer clock(0, 200 msec) reaction(clock) -> out {= @@ -21,7 +21,7 @@ reactor MASource { reactor MovingAverageImpl { state delay_line: double[](0.0, 0.0, 0.0) - state index: int(0) + state index: int = 0 input in: double output out: double @@ -47,7 +47,7 @@ reactor MovingAverageImpl { main reactor MovingAverage { s = new MASource() m = new MovingAverageImpl() - p = new TestDouble(expected = (0.0, 0.25, 0.75, 1.5, 2.5, 3.5)) + p = new TestDouble(expected(0.0, 0.25, 0.75, 1.5, 2.5, 3.5)) s.out -> m.in m.out -> p.in } diff --git a/test/C/src/MultipleContained.lf b/test/C/src/MultipleContained.lf index f3058c9dd4..540052ba87 100644 --- a/test/C/src/MultipleContained.lf +++ b/test/C/src/MultipleContained.lf @@ -6,7 +6,7 @@ reactor Contained { output trigger: int input in1: int input in2: int - state count: int(0) + state count: int = 0 reaction(startup) -> trigger {= lf_set(trigger, 42); =} diff --git a/test/C/src/MultipleOutputs.lf b/test/C/src/MultipleOutputs.lf index 8db9e5e6f9..37b5ddba9f 100644 --- a/test/C/src/MultipleOutputs.lf +++ b/test/C/src/MultipleOutputs.lf @@ -20,7 +20,7 @@ reactor C { main reactor { c = new C() - state triggered: bool(true) + state triggered: bool = true reaction(c.z) {= lf_print("c.z = %d", c.z->value); diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index eb3658f8a4..f7ce6f5ce9 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -2,22 +2,22 @@ target C // This test passes if it is successfully compiled into valid target code. main reactor( - x: int(0), - y: time(0), // Units are missing but not required - z(1 msec), // Type is missing but not required + x: int = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required p: int[](1, 2, 3, 4), // List of integers q: interval_t[](1 msec, 2 msec, 3 msec), // list of time values g: time[](1 msec, 2 msec) // List of time values ) { - state s: time(y) // Reference to explicitly typed time parameter - state t: time(z) // Reference to implicitly typed time parameter + state s: time = y // Reference to explicitly typed time parameter + state t: time = z // Reference to implicitly typed time parameter state v: bool // Uninitialized boolean state variable state w: time // Uninitialized time state variable timer tick(0) // Units missing but not required timer tock(1 sec) // Implicit type time timer toe(z) // Implicit type time - state baz(p) // Implicit type int[] - state period(z) // Implicit type time + state baz = p // Implicit type int[] + state period = z // Implicit type time reaction(tick) {= // Target code diff --git a/test/C/src/NestedTriggeredReactions.lf b/test/C/src/NestedTriggeredReactions.lf index 6cc5f911b1..df52d36a14 100644 --- a/test/C/src/NestedTriggeredReactions.lf +++ b/test/C/src/NestedTriggeredReactions.lf @@ -3,7 +3,7 @@ target C reactor Container { input in: bool - state triggered: bool(false) + state triggered: bool = false contained = new Contained() @@ -21,7 +21,7 @@ reactor Container { reactor Contained { input in: bool - state triggered: bool(false) + state triggered: bool = false reaction(in) {= self->triggered = true; =} diff --git a/test/C/src/ParameterHierarchy.lf b/test/C/src/ParameterHierarchy.lf index 433948bd2b..946b24fa0d 100644 --- a/test/C/src/ParameterHierarchy.lf +++ b/test/C/src/ParameterHierarchy.lf @@ -1,7 +1,7 @@ // Test that parameter values pass down a deep hierarchy. target C -reactor Deep(p: int(0)) { +reactor Deep(p: int = 0) { reaction(startup) {= if (self->p != 42) { lf_print_error_and_exit("Parameter value is %d. Should have been 42."); @@ -11,11 +11,11 @@ reactor Deep(p: int(0)) { =} } -reactor Intermediate(p: int(10)) { +reactor Intermediate(p: int = 10) { a = new Deep(p = p) } -reactor Another(p: int(20)) { +reactor Another(p: int = 20) { a = new Intermediate(p = p) } diff --git a/test/C/src/ParameterizedState.lf b/test/C/src/ParameterizedState.lf index 1965fa1929..3d92345ca9 100644 --- a/test/C/src/ParameterizedState.lf +++ b/test/C/src/ParameterizedState.lf @@ -1,7 +1,7 @@ target C -reactor Foo(bar: int(42)) { - state baz(bar) +reactor Foo(bar: int = 42) { + state baz = bar reaction(startup) {= printf("Baz: %d\n", self->baz); =} } diff --git a/test/C/src/PeriodicDesugared.lf b/test/C/src/PeriodicDesugared.lf index 6d9f8a8ab4..46eb97db9c 100644 --- a/test/C/src/PeriodicDesugared.lf +++ b/test/C/src/PeriodicDesugared.lf @@ -3,7 +3,7 @@ target C { timeout: 1 sec } -main reactor(offset: time(0), period: time(500 msec)) { +main reactor(offset: time = 0, period: time = 500 msec) { logical action init(offset) logical action recur(period) diff --git a/test/C/src/PingPong.lf b/test/C/src/PingPong.lf index 5ce6caaaaa..2f1699a51d 100644 --- a/test/C/src/PingPong.lf +++ b/test/C/src/PingPong.lf @@ -25,10 +25,10 @@ target C { fast: true } -reactor Ping(count: int(10)) { +reactor Ping(count: int = 10) { input receive: int output send: int - state pingsLeft: int(count) + state pingsLeft: int = count logical action serve reaction(startup, serve) -> send {= lf_set(send, self->pingsLeft--); =} @@ -42,10 +42,10 @@ reactor Ping(count: int(10)) { =} } -reactor Pong(expected: int(10)) { +reactor Pong(expected: int = 10) { input receive: int output send: int - state count: int(0) + state count: int = 0 reaction(receive) -> send {= self->count++; diff --git a/test/C/src/ReadOutputOfContainedReactor.lf b/test/C/src/ReadOutputOfContainedReactor.lf index 6b94d4a44b..ce2129069b 100644 --- a/test/C/src/ReadOutputOfContainedReactor.lf +++ b/test/C/src/ReadOutputOfContainedReactor.lf @@ -10,7 +10,7 @@ reactor Contained { main reactor ReadOutputOfContainedReactor { c = new Contained() - state count: int(0) + state count: int = 0 reaction(startup) c.out {= printf("Startup reaction reading output of contained reactor: %d.\n", c.out->value); diff --git a/test/C/src/ScheduleLogicalAction.lf b/test/C/src/ScheduleLogicalAction.lf index e3c898ebb5..762f8c6f52 100644 --- a/test/C/src/ScheduleLogicalAction.lf +++ b/test/C/src/ScheduleLogicalAction.lf @@ -20,7 +20,7 @@ reactor foo { } reactor print { - state expected_time: time(0) + state expected_time: time = 0 input x: int reaction(x) {= diff --git a/test/C/src/SelfLoop.lf b/test/C/src/SelfLoop.lf index 68ca61278e..855be46792 100644 --- a/test/C/src/SelfLoop.lf +++ b/test/C/src/SelfLoop.lf @@ -7,7 +7,7 @@ reactor Self { input x: int output y: int logical action a: int - state expected: int(43) + state expected: int = 43 reaction(a) -> y {= printf("a = %d\n", a->value); diff --git a/test/C/src/SendingInside.lf b/test/C/src/SendingInside.lf index fcb495305a..b1e8f25f93 100644 --- a/test/C/src/SendingInside.lf +++ b/test/C/src/SendingInside.lf @@ -7,7 +7,7 @@ target C { reactor Printer { input x: int - state count: int(1) + state count: int = 1 reaction(x) {= printf("Inside reactor received: %d\n", x->value); @@ -20,7 +20,7 @@ reactor Printer { } main reactor SendingInside { - state count: int(0) + state count: int = 0 timer t(0, 1 sec) p = new Printer() diff --git a/test/C/src/SendsPointerTest.lf b/test/C/src/SendsPointerTest.lf index c7336ff91f..1f17bd1388 100644 --- a/test/C/src/SendsPointerTest.lf +++ b/test/C/src/SendsPointerTest.lf @@ -13,7 +13,7 @@ reactor SendsPointer { =} } -reactor Print(expected: int(42)) { // expected parameter is for testing. +reactor Print(expected: int = 42) { // expected parameter is for testing. input in: int_pointer reaction(in) {= diff --git a/test/C/src/SetArray.lf b/test/C/src/SetArray.lf index 605eed4081..f30457f9f8 100644 --- a/test/C/src/SetArray.lf +++ b/test/C/src/SetArray.lf @@ -17,7 +17,7 @@ reactor Source { =} } -reactor Print(scale: int(1)) { // The scale parameter is just for testing. +reactor Print(scale: int = 1) { // The scale parameter is just for testing. input in: int[] reaction(in) {= diff --git a/test/C/src/SetToken.lf b/test/C/src/SetToken.lf index c2295dbaa0..b9af4bff20 100644 --- a/test/C/src/SetToken.lf +++ b/test/C/src/SetToken.lf @@ -10,7 +10,7 @@ reactor Source { reaction(a) -> out {= lf_set_token(out, a->token); =} } -reactor Print(expected: int(42)) { // expected parameter is for testing. +reactor Print(expected: int = 42) { // expected parameter is for testing. input in: int* reaction(in) {= diff --git a/test/C/src/SimpleDeadline.lf b/test/C/src/SimpleDeadline.lf index a59a6728e9..3e2d786eec 100644 --- a/test/C/src/SimpleDeadline.lf +++ b/test/C/src/SimpleDeadline.lf @@ -3,7 +3,7 @@ // violation. target C -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: int output deadlineViolation: bool diff --git a/test/C/src/SlowingClock.lf b/test/C/src/SlowingClock.lf index 6655e87014..d4a1e1d5f4 100644 --- a/test/C/src/SlowingClock.lf +++ b/test/C/src/SlowingClock.lf @@ -11,8 +11,8 @@ target C { main reactor SlowingClock { logical action a(100 msec) - state interval: time(100 msec) - state expected_time: time(100 msec) + state interval: time = 100 msec + state expected_time: time = 100 msec reaction(startup) -> a {= lf_schedule(a, 0); =} diff --git a/test/C/src/SlowingClockPhysical.lf b/test/C/src/SlowingClockPhysical.lf index b3255428c2..0e82730112 100644 --- a/test/C/src/SlowingClockPhysical.lf +++ b/test/C/src/SlowingClockPhysical.lf @@ -11,8 +11,8 @@ target C { main reactor SlowingClockPhysical { physical action a(100 msec) - state interval: time(100 msec) - state expected_time: time(100 msec) + state interval: time = 100 msec + state expected_time: time = 100 msec reaction(startup) -> a {= self->expected_time = MSEC(100); diff --git a/test/C/src/Starvation.lf b/test/C/src/Starvation.lf index 38f2a247b6..a1c1167850 100644 --- a/test/C/src/Starvation.lf +++ b/test/C/src/Starvation.lf @@ -6,10 +6,10 @@ */ target C -reactor SuperDenseSender(number_of_iterations: int(10)) { +reactor SuperDenseSender(number_of_iterations: int = 10) { logical action loop output out: int - state iterator: int(0) + state iterator: int = 0 reaction(startup, loop) -> out {= if (self->iterator < self->number_of_iterations) { @@ -34,7 +34,7 @@ reactor SuperDenseSender(number_of_iterations: int(10)) { =} } -reactor SuperDenseReceiver(number_of_iterations: int(10)) { +reactor SuperDenseReceiver(number_of_iterations: int = 10) { input in: int reaction(in) {= diff --git a/test/C/src/Stop.lf b/test/C/src/Stop.lf index fcfa407d35..1731bced42 100644 --- a/test/C/src/Stop.lf +++ b/test/C/src/Stop.lf @@ -11,7 +11,7 @@ import Sender from "lib/LoopedActionSender.lf" reactor Consumer { input in: int - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/StopZero.lf b/test/C/src/StopZero.lf index 316cce5c6c..e845c6de48 100644 --- a/test/C/src/StopZero.lf +++ b/test/C/src/StopZero.lf @@ -8,7 +8,7 @@ target C reactor Sender { output out: int - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false timer t(0, 1 usec) logical action act diff --git a/test/C/src/Stride.lf b/test/C/src/Stride.lf index 137855990d..62b9077878 100644 --- a/test/C/src/Stride.lf +++ b/test/C/src/Stride.lf @@ -5,8 +5,8 @@ target C { fast: true } -reactor Count(stride: int(1)) { - state count: int(1) +reactor Count(stride: int = 1) { + state count: int = 1 output y: int timer t(0, 100 msec) @@ -18,7 +18,7 @@ reactor Count(stride: int(1)) { reactor Display { input x: int - state expected: int(1) // for testing. + state expected: int = 1 // for testing. reaction(x) {= printf("Received: %d.\n", x->value); diff --git a/test/C/src/StructAsType.lf b/test/C/src/StructAsType.lf index 9e43173110..8674685530 100644 --- a/test/C/src/StructAsType.lf +++ b/test/C/src/StructAsType.lf @@ -23,7 +23,7 @@ reactor Source { =} } -reactor Print(expected: int(42)) { // expected parameter is for testing. +reactor Print(expected: int = 42) { // expected parameter is for testing. input in: hello_t reaction(in) {= diff --git a/test/C/src/StructAsTypeDirect.lf b/test/C/src/StructAsTypeDirect.lf index f9d85799e9..29472f057b 100644 --- a/test/C/src/StructAsTypeDirect.lf +++ b/test/C/src/StructAsTypeDirect.lf @@ -17,7 +17,7 @@ reactor Source { =} } -reactor Print(expected: int(42)) { // expected parameter is for testing. +reactor Print(expected: int = 42) { // expected parameter is for testing. input in: hello_t reaction(in) {= diff --git a/test/C/src/StructParallel.lf b/test/C/src/StructParallel.lf index 0d3e78cc3e..3c8e61a3a2 100644 --- a/test/C/src/StructParallel.lf +++ b/test/C/src/StructParallel.lf @@ -11,9 +11,9 @@ preamble {= #include "hello.h" =} -reactor Check(expected: int(42)) { +reactor Check(expected: int = 42) { input in: hello_t* - state invoked: bool(false) + state invoked: bool = false reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); @@ -32,7 +32,7 @@ reactor Check(expected: int(42)) { =} } -reactor Print(scale: int(2)) { +reactor Print(scale: int = 2) { // Mutable keyword indicates that this reactor wants a writable copy of the // input. mutable input in: hello_t* diff --git a/test/C/src/StructPrint.lf b/test/C/src/StructPrint.lf index adaf7fbf24..6af0d60c4f 100644 --- a/test/C/src/StructPrint.lf +++ b/test/C/src/StructPrint.lf @@ -20,7 +20,7 @@ reactor Print { =} } -reactor Check(expected: int(42)) { // expected parameter is for testing. +reactor Check(expected: int = 42) { // expected parameter is for testing. input in: hello_t* reaction(in) {= diff --git a/test/C/src/StructScale.lf b/test/C/src/StructScale.lf index 076d0e7f3f..3b92bab002 100644 --- a/test/C/src/StructScale.lf +++ b/test/C/src/StructScale.lf @@ -22,9 +22,9 @@ reactor Source { =} } -reactor TestInput(expected: int(42)) { // expected parameter is for testing. +reactor TestInput(expected: int = 42) { // expected parameter is for testing. input in: hello_t* - state invoked: bool(false) + state invoked: bool = false reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); @@ -43,7 +43,7 @@ reactor TestInput(expected: int(42)) { // expected parameter is for testing. =} } -reactor Print(scale: int(2)) { +reactor Print(scale: int = 2) { // Mutable keyword indicates that this reactor wants a writable copy of the // input. mutable input in: hello_t* diff --git a/test/C/src/SubclassesAndStartup.lf b/test/C/src/SubclassesAndStartup.lf index a8001a907d..2dbc1f688f 100644 --- a/test/C/src/SubclassesAndStartup.lf +++ b/test/C/src/SubclassesAndStartup.lf @@ -1,7 +1,7 @@ target C reactor Super { - state count: int(0) + state count: int = 0 reaction(startup) {= printf("%s(Super) started\n", self->name); @@ -16,7 +16,7 @@ reactor Super { =} } -reactor SubA(name: string("SubA")) extends Super { +reactor SubA(name: string = "SubA") extends Super { reaction(startup) {= printf("%s started\n", self->name); if (self->count == 0) { @@ -26,7 +26,7 @@ reactor SubA(name: string("SubA")) extends Super { =} } -reactor SubB(name: string("SubB")) extends Super { +reactor SubB(name: string = "SubB") extends Super { reaction(startup) {= printf("%s started\n", self->name); if (self->count == 0) { diff --git a/test/C/src/TimeLimit.lf b/test/C/src/TimeLimit.lf index 2497296efd..ae178d53b5 100644 --- a/test/C/src/TimeLimit.lf +++ b/test/C/src/TimeLimit.lf @@ -5,10 +5,10 @@ target C { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int - state s: int(1) + state s: int = 1 reaction(x) {= // printf("%d\n", x->value); @@ -39,7 +39,7 @@ reactor Destination { =} } -main reactor TimeLimit(period: time(1 sec)) { +main reactor TimeLimit(period: time = 1 sec) { timer stop(10 sec) c = new Clock(period = period) d = new Destination() diff --git a/test/C/src/TimeState.lf b/test/C/src/TimeState.lf index 790679ccda..cb0a9627f3 100644 --- a/test/C/src/TimeState.lf +++ b/test/C/src/TimeState.lf @@ -1,7 +1,7 @@ target C -reactor Foo(bar: int(42)) { - state baz: time(500 msec) +reactor Foo(bar: int = 42) { + state baz: time = 500 msec reaction(startup) {= printf("Baz: %lld\n", self->baz); =} } diff --git a/test/C/src/Timeout.lf b/test/C/src/Timeout.lf index e0bb841b3e..cb13eafba4 100644 --- a/test/C/src/Timeout.lf +++ b/test/C/src/Timeout.lf @@ -11,7 +11,7 @@ import Sender from "lib/LoopedActionSender.lf" reactor Consumer { input in: int - state success: bool(false) + state success: bool = false reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/TimeoutZero.lf b/test/C/src/TimeoutZero.lf index 36a65d6031..2b146bb57c 100644 --- a/test/C/src/TimeoutZero.lf +++ b/test/C/src/TimeoutZero.lf @@ -12,7 +12,7 @@ import Sender from "lib/LoopedActionSender.lf" reactor Consumer { input in: int - state success: bool(false) + state success: bool = false reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/ToReactionNested.lf b/test/C/src/ToReactionNested.lf index 4f89c20e9c..11b3577c84 100644 --- a/test/C/src/ToReactionNested.lf +++ b/test/C/src/ToReactionNested.lf @@ -12,8 +12,8 @@ reactor CountContainer { } main reactor { - state count: int(1) - state received: bool(false) + state count: int = 1 + state received: bool = false s = new CountContainer() diff --git a/test/C/src/TriggerDownstreamOnlyIfPresent2.lf b/test/C/src/TriggerDownstreamOnlyIfPresent2.lf index 544d269242..bc62b214e9 100644 --- a/test/C/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/C/src/TriggerDownstreamOnlyIfPresent2.lf @@ -9,7 +9,7 @@ target C { reactor Source { output[2] out: int - state count: int(0) + state count: int = 0 timer t(0, 200 msec) reaction(t) -> out {= diff --git a/test/C/src/UnconnectedInput.lf b/test/C/src/UnconnectedInput.lf index f41524fa01..21e8cc5a69 100644 --- a/test/C/src/UnconnectedInput.lf +++ b/test/C/src/UnconnectedInput.lf @@ -7,7 +7,7 @@ target C { reactor Source { output out: int timer t(0, 1 sec) - state s: int(1) + state s: int = 1 reaction(t) -> out {= lf_set(out, self->s++); =} } @@ -27,7 +27,7 @@ reactor Add { reactor Print { input in: int - state expected: int(1) + state expected: int = 1 reaction(in) {= printf("Received: %d.\n", in->value); diff --git a/test/C/src/arduino/DigitalReadSerial.lf b/test/C/src/arduino/DigitalReadSerial.lf index febc640eb3..d79f86ad9b 100644 --- a/test/C/src/arduino/DigitalReadSerial.lf +++ b/test/C/src/arduino/DigitalReadSerial.lf @@ -11,7 +11,7 @@ target C { main reactor DigitalReadSerial { timer t1(0, 1 msec) - state pushButton: int(2) + state pushButton: int = 2 reaction(startup) {= pinMode(self->pushButton, INPUT); =} diff --git a/test/C/src/arduino/Fade.lf b/test/C/src/arduino/Fade.lf index 0408fb5a1a..d23aabd646 100644 --- a/test/C/src/arduino/Fade.lf +++ b/test/C/src/arduino/Fade.lf @@ -14,9 +14,9 @@ target C { main reactor Fade { timer t1(0, 30 msec) - state led: int(9) - state brightness: int(9) - state fadeAmount: int(5) + state led: int = 9 + state brightness: int = 9 + state fadeAmount: int = 5 reaction(startup) {= pinMode(self->led, OUTPUT); =} diff --git a/test/C/src/concurrent/AsyncCallback.lf b/test/C/src/concurrent/AsyncCallback.lf index 90c300a8b2..ec2beae766 100644 --- a/test/C/src/concurrent/AsyncCallback.lf +++ b/test/C/src/concurrent/AsyncCallback.lf @@ -33,12 +33,12 @@ main reactor AsyncCallback { lf_thread_t threadId; =} timer t(0, 200 msec) - state thread_id: lf_thread_t(0) - state expected_time: time(100 msec) - state toggle: bool(false) + state thread_id: lf_thread_t = 0 + state expected_time: time = 100 msec + state toggle: bool = false physical action a(100 msec): int - state i: int(0) + state i: int = 0 reaction(t) -> a {= // start new thread, provide callback diff --git a/test/C/src/concurrent/AsyncCallbackDrop.lf b/test/C/src/concurrent/AsyncCallbackDrop.lf index 17cb113a99..f123bcdbdf 100644 --- a/test/C/src/concurrent/AsyncCallbackDrop.lf +++ b/test/C/src/concurrent/AsyncCallbackDrop.lf @@ -28,12 +28,12 @@ main reactor { lf_thread_t threadId; =} timer t(0, 200 msec) - state thread_id: lf_thread_t(0) - state expected_time: time(100 msec) - state toggle: bool(false) + state thread_id: lf_thread_t = 0 + state expected_time: time = 100 msec + state toggle: bool = false physical action a(100 msec, 100 msec, "drop"): int - state i: int(0) + state i: int = 0 reaction(t) -> a {= // start new thread, provide callback diff --git a/test/C/src/concurrent/AsyncCallbackReplace.lf b/test/C/src/concurrent/AsyncCallbackReplace.lf index 49dc3e75e9..b7afeb2363 100644 --- a/test/C/src/concurrent/AsyncCallbackReplace.lf +++ b/test/C/src/concurrent/AsyncCallbackReplace.lf @@ -28,12 +28,12 @@ main reactor { lf_thread_t threadId; =} timer t(0, 200 msec) - state thread_id: lf_thread_t(0) - state expected_time: time(100 msec) - state toggle: bool(false) + state thread_id: lf_thread_t = 0 + state expected_time: time = 100 msec + state toggle: bool = false physical action a(100 msec, 100 msec, "replace"): int - state i: int(0) + state i: int = 0 reaction(t) -> a {= // start new thread, provide callback diff --git a/test/C/src/concurrent/CompositionThreaded.lf b/test/C/src/concurrent/CompositionThreaded.lf index decf56d687..cf0bafeb82 100644 --- a/test/C/src/concurrent/CompositionThreaded.lf +++ b/test/C/src/concurrent/CompositionThreaded.lf @@ -5,10 +5,10 @@ target C { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -18,7 +18,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= (self->count)++; diff --git a/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf b/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf index 87359286ed..545206de91 100644 --- a/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf +++ b/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf @@ -2,7 +2,7 @@ // container reacts to that output. target C -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: int output deadline_violation: bool @@ -16,7 +16,7 @@ reactor Deadline(threshold: time(100 msec)) { } main reactor { - state violation_detected: bool(false) + state violation_detected: bool = false d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/C/src/concurrent/DeadlineThreaded.lf b/test/C/src/concurrent/DeadlineThreaded.lf index fccb60001b..ac765fe6f7 100644 --- a/test/C/src/concurrent/DeadlineThreaded.lf +++ b/test/C/src/concurrent/DeadlineThreaded.lf @@ -5,10 +5,10 @@ target C { timeout: 6 sec } -reactor Source(period: time(3000 msec)) { +reactor Source(period: time = 3000 msec) { output y: int timer t(0, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= if (2 * (self->count / 2) != self->count) { @@ -22,9 +22,9 @@ reactor Source(period: time(3000 msec)) { =} } -reactor Destination(timeout: time(1 sec)) { +reactor Destination(timeout: time = 1 sec) { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= printf("Destination receives: %d\n", x->value); diff --git a/test/C/src/concurrent/DelayIntThreaded.lf b/test/C/src/concurrent/DelayIntThreaded.lf index 5c2c983508..449b17eb60 100644 --- a/test/C/src/concurrent/DelayIntThreaded.lf +++ b/test/C/src/concurrent/DelayIntThreaded.lf @@ -1,7 +1,7 @@ // This tests actions with payloads by delaying an input by a fixed amount. target C -reactor Delay(delay: time(100 msec)) { +reactor Delay(delay: time = 100 msec) { input in: int output out: int logical action a: int @@ -16,8 +16,8 @@ reactor Delay(delay: time(100 msec)) { reactor Test { input in: int - state start_time: time(0) - state received_value: bool(false) + state start_time: time = 0 + state received_value: bool = false reaction(startup) {= // Record the logical time at the start. diff --git a/test/C/src/concurrent/DoubleReactionThreaded.lf b/test/C/src/concurrent/DoubleReactionThreaded.lf index 66885ab7a0..ba6c38ca19 100644 --- a/test/C/src/concurrent/DoubleReactionThreaded.lf +++ b/test/C/src/concurrent/DoubleReactionThreaded.lf @@ -5,10 +5,10 @@ target C { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int input w: int - state s: int(2) + state s: int = 2 reaction(x, w) {= int sum = 0; diff --git a/test/C/src/concurrent/GainThreaded.lf b/test/C/src/concurrent/GainThreaded.lf index b59d2b00fb..d9d6ec7673 100644 --- a/test/C/src/concurrent/GainThreaded.lf +++ b/test/C/src/concurrent/GainThreaded.lf @@ -1,7 +1,7 @@ // Example in the Wiki. target C -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { input x: int output y: int @@ -10,7 +10,7 @@ reactor Scale(scale: int(2)) { reactor Test { input x: int - state received_value: bool(false) + state received_value: bool = false reaction(x) {= printf("Received %d.\n", x->value); diff --git a/test/C/src/concurrent/HelloThreaded.lf b/test/C/src/concurrent/HelloThreaded.lf index 72c7560ede..a8ea34dd05 100644 --- a/test/C/src/concurrent/HelloThreaded.lf +++ b/test/C/src/concurrent/HelloThreaded.lf @@ -8,9 +8,9 @@ target C { fast: true } -reactor Reschedule(period: time(2 sec), message: string("Hello C")) { - state count: int(0) - state previous_time: time(0) +reactor Reschedule(period: time = 2 sec, message: string = "Hello C") { + state count: int = 0 + state previous_time: time = 0 timer t(1 sec, period) logical action a @@ -43,8 +43,8 @@ reactor Reschedule(period: time(2 sec), message: string("Hello C")) { } reactor Inside( - period: time(1 sec), - message: string("Composite default message.") + period: time = 1 sec, + message: string = "Composite default message." ) { third_instance = new Reschedule(period = period, message = message) } diff --git a/test/C/src/concurrent/PingPongThreaded.lf b/test/C/src/concurrent/PingPongThreaded.lf index 0f2e60f065..4fae17911e 100644 --- a/test/C/src/concurrent/PingPongThreaded.lf +++ b/test/C/src/concurrent/PingPongThreaded.lf @@ -25,10 +25,10 @@ target C { fast: true } -reactor Ping(count: int(10)) { +reactor Ping(count: int = 10) { input receive: int output send: int - state pingsLeft: int(count) + state pingsLeft: int = count logical action serve reaction(startup, serve) -> send {= lf_set(send, self->pingsLeft--); =} @@ -42,10 +42,10 @@ reactor Ping(count: int(10)) { =} } -reactor Pong(expected: int(10)) { +reactor Pong(expected: int = 10) { input receive: int output send: int - state count: int(0) + state count: int = 0 reaction(receive) -> send {= self->count++; diff --git a/test/C/src/concurrent/ScheduleAt.lf b/test/C/src/concurrent/ScheduleAt.lf index 7e5e8318b1..9fa09138b6 100644 --- a/test/C/src/concurrent/ScheduleAt.lf +++ b/test/C/src/concurrent/ScheduleAt.lf @@ -62,7 +62,7 @@ reactor Scheduler { 900 msec ) // Size = 9 - state action_hit_list_index: int(0) + state action_hit_list_index: int = 0 reaction(startup) -> act {= for (int i=0; i < 16; i++) { diff --git a/test/C/src/concurrent/ScheduleTwice.lf b/test/C/src/concurrent/ScheduleTwice.lf index 41512f3c7d..e19f4d02d5 100644 --- a/test/C/src/concurrent/ScheduleTwice.lf +++ b/test/C/src/concurrent/ScheduleTwice.lf @@ -2,7 +2,7 @@ target C main reactor ScheduleTwice { logical action a: int - state rc_count: int(0) + state rc_count: int = 0 preamble {= #define VERBOSE =} diff --git a/test/C/src/concurrent/ScheduleTwiceThreaded.lf b/test/C/src/concurrent/ScheduleTwiceThreaded.lf index a368bec1ec..499e0e4999 100644 --- a/test/C/src/concurrent/ScheduleTwiceThreaded.lf +++ b/test/C/src/concurrent/ScheduleTwiceThreaded.lf @@ -2,7 +2,7 @@ target C main reactor { logical action a: int - state rc_count: int(0) + state rc_count: int = 0 reaction(startup) -> a {= lf_schedule_int(a, MSEC(100), 42); diff --git a/test/C/src/concurrent/SendingInsideThreaded.lf b/test/C/src/concurrent/SendingInsideThreaded.lf index e08a5dffb5..e5185ecfc8 100644 --- a/test/C/src/concurrent/SendingInsideThreaded.lf +++ b/test/C/src/concurrent/SendingInsideThreaded.lf @@ -7,7 +7,7 @@ target C { reactor Printer { input x: int - state count: int(1) + state count: int = 1 reaction(x) {= printf("Inside reactor received: %d\n", x->value); @@ -20,7 +20,7 @@ reactor Printer { } main reactor SendingInsideThreaded { - state count: int(0) + state count: int = 0 timer t(0, 1 sec) p = new Printer() diff --git a/test/C/src/concurrent/StarvationThreaded.lf b/test/C/src/concurrent/StarvationThreaded.lf index 58d063647d..a16b5e46b6 100644 --- a/test/C/src/concurrent/StarvationThreaded.lf +++ b/test/C/src/concurrent/StarvationThreaded.lf @@ -7,10 +7,10 @@ */ target C -reactor SuperDenseSender(number_of_iterations: int(10)) { +reactor SuperDenseSender(number_of_iterations: int = 10) { logical action loop output out: int - state iterator: int(0) + state iterator: int = 0 reaction(startup, loop) -> out {= if (self->iterator < self->number_of_iterations) { @@ -35,7 +35,7 @@ reactor SuperDenseSender(number_of_iterations: int(10)) { =} } -reactor SuperDenseReceiver(number_of_iterations: int(10)) { +reactor SuperDenseReceiver(number_of_iterations: int = 10) { input in: int reaction(in) {= diff --git a/test/C/src/concurrent/StopThreaded.lf b/test/C/src/concurrent/StopThreaded.lf index aa69bda345..1deb1c4ff6 100644 --- a/test/C/src/concurrent/StopThreaded.lf +++ b/test/C/src/concurrent/StopThreaded.lf @@ -13,7 +13,7 @@ import Sender from "../lib/LoopedActionSender.lf" reactor Consumer { input in: int - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/concurrent/StopZeroThreaded.lf b/test/C/src/concurrent/StopZeroThreaded.lf index 051c615566..7afd4b0069 100644 --- a/test/C/src/concurrent/StopZeroThreaded.lf +++ b/test/C/src/concurrent/StopZeroThreaded.lf @@ -8,7 +8,7 @@ target C reactor Sender { output out: int - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false timer t(0, 1 usec) logical action act diff --git a/test/C/src/concurrent/Threaded.lf b/test/C/src/concurrent/Threaded.lf index abfcff2c1b..01f67c1bd4 100644 --- a/test/C/src/concurrent/Threaded.lf +++ b/test/C/src/concurrent/Threaded.lf @@ -16,7 +16,7 @@ target C { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= lf_set(out, self->s); @@ -40,8 +40,8 @@ reactor TakeTime { =} } -reactor Destination(width: int(4)) { - state s: int(400000000) +reactor Destination(width: int = 4) { + state s: int = 400000000 input[width] in: int reaction(in) {= @@ -58,7 +58,7 @@ reactor Destination(width: int(4)) { =} } -main reactor(width: int(4)) { +main reactor(width: int = 4) { a = new Source() t = new[width] TakeTime() (a.out)+ -> t.in diff --git a/test/C/src/concurrent/ThreadedMultiport.lf b/test/C/src/concurrent/ThreadedMultiport.lf index b24ead7cd9..2878393dac 100644 --- a/test/C/src/concurrent/ThreadedMultiport.lf +++ b/test/C/src/concurrent/ThreadedMultiport.lf @@ -5,10 +5,10 @@ target C { flags: "" } -reactor Source(width: int(4)) { +reactor Source(width: int = 4) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < out_width; i++) { @@ -18,7 +18,7 @@ reactor Source(width: int(4)) { =} } -reactor Computation(iterations: int(100000000)) { +reactor Computation(iterations: int = 100000000) { input in: int output out: int @@ -34,8 +34,8 @@ reactor Computation(iterations: int(100000000)) { =} } -reactor Destination(width: int(4), iterations: int(100000000)) { - state s: int(0) +reactor Destination(width: int = 4, iterations: int = 100000000) { + state s: int = 0 input[width] in: int reaction(in) {= @@ -61,7 +61,7 @@ reactor Destination(width: int(4), iterations: int(100000000)) { =} } -main reactor ThreadedMultiport(width: int(4), iterations: int(100000000)) { +main reactor ThreadedMultiport(width: int = 4, iterations: int = 100000000) { a = new Source(width = width) t = new[width] Computation(iterations = iterations) b = new Destination(width = width, iterations = iterations) diff --git a/test/C/src/concurrent/ThreadedThreaded.lf b/test/C/src/concurrent/ThreadedThreaded.lf index 9db95faaf0..4037e8c193 100644 --- a/test/C/src/concurrent/ThreadedThreaded.lf +++ b/test/C/src/concurrent/ThreadedThreaded.lf @@ -15,7 +15,7 @@ target C { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= lf_set(out, self->s); @@ -39,8 +39,8 @@ reactor TakeTime { =} } -reactor Destination(width: int(4)) { - state s: int(400000000) +reactor Destination(width: int = 4) { + state s: int = 400000000 input[width] in: int reaction(in) {= @@ -57,7 +57,7 @@ reactor Destination(width: int(4)) { =} } -main reactor ThreadedThreaded(width: int(4)) { +main reactor ThreadedThreaded(width: int = 4) { a = new Source() t = new[width] TakeTime() (a.out)+ -> t.in diff --git a/test/C/src/concurrent/TimeLimitThreaded.lf b/test/C/src/concurrent/TimeLimitThreaded.lf index 97bb9cfec6..8d3824af47 100644 --- a/test/C/src/concurrent/TimeLimitThreaded.lf +++ b/test/C/src/concurrent/TimeLimitThreaded.lf @@ -4,10 +4,10 @@ target C { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -18,7 +18,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int - state s: int(1) + state s: int = 1 reaction(x) {= // printf("%d\n", x->value); @@ -38,7 +38,7 @@ reactor Destination { =} } -main reactor(period: time(1 sec)) { +main reactor(period: time = 1 sec) { timer stop(10 sec) c = new Clock(period = period) d = new Destination() diff --git a/test/C/src/concurrent/TimeoutThreaded.lf b/test/C/src/concurrent/TimeoutThreaded.lf index 993366a2c0..3a7e2181d7 100644 --- a/test/C/src/concurrent/TimeoutThreaded.lf +++ b/test/C/src/concurrent/TimeoutThreaded.lf @@ -12,7 +12,7 @@ import Sender from "../lib/LoopedActionSender.lf" reactor Consumer { input in: int - state success: bool(false) + state success: bool = false reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/concurrent/TimeoutZeroThreaded.lf b/test/C/src/concurrent/TimeoutZeroThreaded.lf index 4a0bdd62a3..9b24ef080f 100644 --- a/test/C/src/concurrent/TimeoutZeroThreaded.lf +++ b/test/C/src/concurrent/TimeoutZeroThreaded.lf @@ -12,7 +12,7 @@ import Sender from "../lib/LoopedActionSender.lf" reactor Consumer { input in: int - state success: bool(false) + state success: bool = false reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/concurrent/Tracing.lf b/test/C/src/concurrent/Tracing.lf index ff2f436e85..71da79c7ef 100644 --- a/test/C/src/concurrent/Tracing.lf +++ b/test/C/src/concurrent/Tracing.lf @@ -10,7 +10,7 @@ target C { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= lf_set(out, self->s); @@ -18,10 +18,10 @@ reactor Source { =} } -reactor TakeTime(bank_index: int(0)) { +reactor TakeTime(bank_index: int = 0) { input in: int output out: int - state event: char*("No ID") + state event: char* = "No ID" reaction(startup) {= // Construct an id string for a user trace event. @@ -57,9 +57,9 @@ reactor TakeTime(bank_index: int(0)) { =} } -reactor Destination(width: int(4)) { - state s: int(400000000) - state count: int(0) +reactor Destination(width: int = 4) { + state s: int = 400000000 + state count: int = 0 input[width] in: int reaction(startup) {= @@ -86,7 +86,7 @@ reactor Destination(width: int(4)) { =} } -main reactor(width: int(4)) { +main reactor(width: int = 4) { a = new Source() t = new[width] TakeTime() (a.out)+ -> t.in diff --git a/test/C/src/docker/federated/DistributedCountContainerized.lf b/test/C/src/docker/federated/DistributedCountContainerized.lf index 9eb6898a9d..4a120c5e1e 100644 --- a/test/C/src/docker/federated/DistributedCountContainerized.lf +++ b/test/C/src/docker/federated/DistributedCountContainerized.lf @@ -15,7 +15,9 @@ target C { import Count from "../../lib/Count.lf" import Print from "../../federated/DistributedCount.lf" -federated reactor DistributedCountContainerized(offset: time(200 msec)) at rti { +federated reactor DistributedCountContainerized( + offset: time = 200 msec +) at rti { c = new Count() p = new Print() c.out -> p.in after offset diff --git a/test/C/src/federated/BroadcastFeedback.lf b/test/C/src/federated/BroadcastFeedback.lf index 0c7146b8f7..2bef908d2d 100644 --- a/test/C/src/federated/BroadcastFeedback.lf +++ b/test/C/src/federated/BroadcastFeedback.lf @@ -9,7 +9,7 @@ target C { reactor SenderAndReceiver { output out: int input[2] in: int - state received: bool(false) + state received: bool = false reaction(startup) -> out {= lf_set(out, 42); =} diff --git a/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf b/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf index 1632f0332a..d9edbc954b 100644 --- a/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf +++ b/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf @@ -8,7 +8,7 @@ target C { reactor SenderAndReceiver { output out: int input[2] in: int - state received: bool(false) + state received: bool = false r = new Receiver() in -> r.in @@ -18,7 +18,7 @@ reactor SenderAndReceiver { reactor Receiver { input[2] in: int - state received: bool(false) + state received: bool = false reaction(in) {= if (in[0]->is_present && in[1]->is_present && in[0]->value == 42 && in[1]->value == 42) { diff --git a/test/C/src/federated/CycleDetection.lf b/test/C/src/federated/CycleDetection.lf index 90ce0faba2..d22837bc1f 100644 --- a/test/C/src/federated/CycleDetection.lf +++ b/test/C/src/federated/CycleDetection.lf @@ -10,7 +10,7 @@ reactor CAReplica { input remote_update: int input query: int - state balance: int(0) + state balance: int = 0 output response: int diff --git a/test/C/src/federated/DecentralizedP2PComm.lf b/test/C/src/federated/DecentralizedP2PComm.lf index 5791ddd8a7..0ca6a10e6f 100644 --- a/test/C/src/federated/DecentralizedP2PComm.lf +++ b/test/C/src/federated/DecentralizedP2PComm.lf @@ -6,15 +6,15 @@ target C { } reactor Platform( - start: int(0), - expected_start: int(0), - stp_offset_param: time(0) + start: int = 0, + expected_start: int = 0, + stp_offset_param: time = 0 ) { input in: int output out: int timer t(0, 100 msec) - state count: int(start) - state expected: int(expected_start) + state count: int = start + state expected: int = expected_start reaction(t) -> out {= lf_set(out, self->count++); =} diff --git a/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf b/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf index 3b872b8408..fca2149fcf 100644 --- a/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf +++ b/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf @@ -11,10 +11,10 @@ target C { coordination: decentralized } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -29,7 +29,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int - state s: int(1) + state s: int = 1 reaction(x) {= lf_print("Received %d", x->value); @@ -48,7 +48,7 @@ reactor Destination { =} } -federated reactor(period: time(10 usec)) { +federated reactor(period: time = 10 usec) { c = new Clock(period = period) d = new Destination() c.y -> d.x diff --git a/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf b/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf index 49562c7e77..8468e1dc81 100644 --- a/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf +++ b/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf @@ -12,10 +12,10 @@ target C { coordination: decentralized } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= (self->count)++; @@ -30,7 +30,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int - state s: int(1) + state s: int = 1 reaction(x) {= // printf("%d\n", x->value); @@ -46,7 +46,7 @@ reactor Destination { =} } -federated reactor(period: time(10 usec)) { +federated reactor(period: time = 10 usec) { c = new Clock(period = period) d = new Destination() c.y ~> d.x diff --git a/test/C/src/federated/DistributedBank.lf b/test/C/src/federated/DistributedBank.lf index 9dd1247980..84acb00031 100644 --- a/test/C/src/federated/DistributedBank.lf +++ b/test/C/src/federated/DistributedBank.lf @@ -6,7 +6,7 @@ target C { reactor Node { timer t(0, 100 msec) - state count: int(0) + state count: int = 0 reaction(t) {= lf_print("Hello world %d.", self->count++); =} diff --git a/test/C/src/federated/DistributedBankToMultiport.lf b/test/C/src/federated/DistributedBankToMultiport.lf index b392b3e603..796db0718e 100644 --- a/test/C/src/federated/DistributedBankToMultiport.lf +++ b/test/C/src/federated/DistributedBankToMultiport.lf @@ -7,7 +7,7 @@ import Count from "../lib/Count.lf" reactor Destination { input[2] in: int - state count: int(1) + state count: int = 1 reaction(in) {= for (int i = 0; i < in_width; i++) { diff --git a/test/C/src/federated/DistributedCount.lf b/test/C/src/federated/DistributedCount.lf index 7ffd4eb8e2..2ebdda169a 100644 --- a/test/C/src/federated/DistributedCount.lf +++ b/test/C/src/federated/DistributedCount.lf @@ -14,7 +14,7 @@ import Count from "../lib/Count.lf" reactor Print { input in: int - state c: int(1) + state c: int = 1 reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); @@ -35,7 +35,7 @@ reactor Print { =} } -federated reactor DistributedCount(offset: time(200 msec)) { +federated reactor DistributedCount(offset: time = 200 msec) { c = new Count() p = new Print() c.out -> p.in after offset diff --git a/test/C/src/federated/DistributedCountDecentralized.lf b/test/C/src/federated/DistributedCountDecentralized.lf index e7ee0a7d77..631dfab0c0 100644 --- a/test/C/src/federated/DistributedCountDecentralized.lf +++ b/test/C/src/federated/DistributedCountDecentralized.lf @@ -14,7 +14,7 @@ import Count from "../lib/Count.lf" reactor Print { input in: int - state c: int(1) + state c: int = 1 reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); diff --git a/test/C/src/federated/DistributedCountDecentralizedLate.lf b/test/C/src/federated/DistributedCountDecentralizedLate.lf index fa85987e87..9fb6d3b064 100644 --- a/test/C/src/federated/DistributedCountDecentralizedLate.lf +++ b/test/C/src/federated/DistributedCountDecentralizedLate.lf @@ -15,12 +15,12 @@ import Count from "../lib/Count.lf" reactor Print { input in: int // STP () - state success: int(0) // STP(in, 30 msec); - state success_stp_violation: int(0) + state success: int = 0 // STP(in, 30 msec); + state success_stp_violation: int = 0 // Force a timer to be invoke periodically to ensure logical time will // advance in the absence of incoming messages. timer t(0, 10 msec) - state c: int(0) + state c: int = 0 reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf b/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf index 26c20521e3..31ab87e110 100644 --- a/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf +++ b/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf @@ -17,12 +17,12 @@ import Count from "../lib/Count.lf" reactor ImportantActuator { input in: int - state success: int(0) - state success_stp_violation: int(0) + state success: int = 0 + state success_stp_violation: int = 0 // Force a timer to be invoke periodically timer t(0, 10 msec) // to ensure logical time will advance in the absence of incoming messages. - state c: int(0) + state c: int = 0 reaction(in) {= tag_t current_tag = lf_tag(); @@ -79,7 +79,7 @@ reactor Receiver { // Force a timer to be invoke periodically timer t(0, 10 msec) // to ensure logical time will advance in the absence of incoming messages. - state c: int(0) + state c: int = 0 p = new Print() a = new ImportantActuator() in -> p.in diff --git a/test/C/src/federated/DistributedCountPhysical.lf b/test/C/src/federated/DistributedCountPhysical.lf index 67d90ec4c1..9e1e15f775 100644 --- a/test/C/src/federated/DistributedCountPhysical.lf +++ b/test/C/src/federated/DistributedCountPhysical.lf @@ -13,7 +13,7 @@ target C { reactor Count { timer t(200 msec, 1 sec) - state s: int(0) + state s: int = 0 output out: int reaction(t) -> out {= @@ -24,7 +24,7 @@ reactor Count { reactor Print { input in: int - state c: int(0) + state c: int = 0 reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); diff --git a/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf b/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf index 2d13891bae..b0da42218a 100644 --- a/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf +++ b/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -12,7 +12,7 @@ import Count from "../lib/Count.lf" reactor Print { input in: int - state c: int(1) + state c: int = 1 reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); diff --git a/test/C/src/federated/DistributedCountPhysicalDecentralized.lf b/test/C/src/federated/DistributedCountPhysicalDecentralized.lf index 6bc50fce88..e821e4fb70 100644 --- a/test/C/src/federated/DistributedCountPhysicalDecentralized.lf +++ b/test/C/src/federated/DistributedCountPhysicalDecentralized.lf @@ -14,7 +14,7 @@ target C { reactor Count { timer t(200 msec, 1 sec) - state s: int(0) + state s: int = 0 output out: int reaction(t) -> out {= @@ -25,7 +25,7 @@ reactor Count { reactor Print { input in: int - state c: int(0) + state c: int = 0 reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); diff --git a/test/C/src/federated/DistributedDoublePort.lf b/test/C/src/federated/DistributedDoublePort.lf index 2490df67bf..87de1ddb28 100644 --- a/test/C/src/federated/DistributedDoublePort.lf +++ b/test/C/src/federated/DistributedDoublePort.lf @@ -14,7 +14,7 @@ target C { import Count from "../lib/Count.lf" reactor CountMicrostep { - state count: int(1) + state count: int = 1 output out: int logical action act: int timer t(0, 1 sec) diff --git a/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf b/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf index 078b15ed02..acbbaf4035 100644 --- a/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf +++ b/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf @@ -11,8 +11,8 @@ import TestCount from "../lib/TestCount.lf" reactor WithLogicalAction { output out: int - state thread_id: lf_thread_t(0) - state counter: int(1) + state thread_id: lf_thread_t = 0 + state counter: int = 1 logical action act(0): int reaction(startup, act) -> act, out {= diff --git a/test/C/src/federated/DistributedLoopedAction.lf b/test/C/src/federated/DistributedLoopedAction.lf index 1a70412696..8218e73646 100644 --- a/test/C/src/federated/DistributedLoopedAction.lf +++ b/test/C/src/federated/DistributedLoopedAction.lf @@ -10,11 +10,14 @@ target C { import Sender from "../lib/LoopedActionSender.lf" -reactor Receiver(take_a_break_after: int(10), break_interval: time(400 msec)) { +reactor Receiver( + take_a_break_after: int = 10, + break_interval: time = 400 msec +) { input in: int - state received_messages: int(0) - state total_received_messages: int(0) - state breaks: int(0) + state received_messages: int = 0 + state total_received_messages: int = 0 + state breaks: int = 0 timer t(0, 1 msec) // This will impact the performance // but forces the logical time to advance Comment this line for a more diff --git a/test/C/src/federated/DistributedLoopedActionDecentralized.lf b/test/C/src/federated/DistributedLoopedActionDecentralized.lf index f1addfb63c..17842809fa 100644 --- a/test/C/src/federated/DistributedLoopedActionDecentralized.lf +++ b/test/C/src/federated/DistributedLoopedActionDecentralized.lf @@ -20,11 +20,14 @@ target C { import Sender from "../lib/LoopedActionSender.lf" -reactor Receiver(take_a_break_after: int(10), break_interval: time(400 msec)) { +reactor Receiver( + take_a_break_after: int = 10, + break_interval: time = 400 msec +) { input in: int - state received_messages: int(0) - state total_received_messages: int(0) - state breaks: int(0) + state received_messages: int = 0 + state total_received_messages: int = 0 + state breaks: int = 0 reaction(in) {= tag_t current_tag = lf_tag(); @@ -77,12 +80,12 @@ reactor Receiver(take_a_break_after: int(10), break_interval: time(400 msec)) { } reactor STPReceiver( - take_a_break_after: int(10), - break_interval: time(400 msec), - stp_offset: time(0) + take_a_break_after: int = 10, + break_interval: time = 400 msec, + stp_offset: time = 0 ) { input in: int - state last_time_updated_stp: time(0) + state last_time_updated_stp: time = 0 receiver = new Receiver(take_a_break_after = 10, break_interval = 400 msec) timer t(0, 1 msec) // Force advancement of logical time diff --git a/test/C/src/federated/DistributedLoopedPhysicalAction.lf b/test/C/src/federated/DistributedLoopedPhysicalAction.lf index 7b42628683..454577ff35 100644 --- a/test/C/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/C/src/federated/DistributedLoopedPhysicalAction.lf @@ -16,10 +16,10 @@ target C { } } -reactor Sender(take_a_break_after: int(10), break_interval: time(550 msec)) { +reactor Sender(take_a_break_after: int = 10, break_interval: time = 550 msec) { output out: int physical action act - state sent_messages: int(0) + state sent_messages: int = 0 reaction(startup, act) -> act, out {= // Send a message on out @@ -35,11 +35,14 @@ reactor Sender(take_a_break_after: int(10), break_interval: time(550 msec)) { =} } -reactor Receiver(take_a_break_after: int(10), break_interval: time(550 msec)) { +reactor Receiver( + take_a_break_after: int = 10, + break_interval: time = 550 msec +) { input in: int - state received_messages: int(0) - state total_received_messages: int(0) - state breaks: int(0) + state received_messages: int = 0 + state total_received_messages: int = 0 + state breaks: int = 0 timer t(0, 1 msec) // This will impact the performance // but forces the logical time to advance Comment this line for a more diff --git a/test/C/src/federated/DistributedMultiport.lf b/test/C/src/federated/DistributedMultiport.lf index 28156d4b70..3853629731 100644 --- a/test/C/src/federated/DistributedMultiport.lf +++ b/test/C/src/federated/DistributedMultiport.lf @@ -7,7 +7,7 @@ target C { reactor Source { output[4] out: int timer t(0, 100 msec) - state count: int(0) + state count: int = 0 reaction(t) -> out {= for (int i = 0; i < out_width; i++) { @@ -18,7 +18,7 @@ reactor Source { reactor Destination { input[4] in: int - state count: int(0) + state count: int = 0 reaction(in) {= for (int i = 0; i < in_width; i++) { diff --git a/test/C/src/federated/DistributedMultiportToBank.lf b/test/C/src/federated/DistributedMultiportToBank.lf index 503dec692e..0accaf8c60 100644 --- a/test/C/src/federated/DistributedMultiportToBank.lf +++ b/test/C/src/federated/DistributedMultiportToBank.lf @@ -6,7 +6,7 @@ target C { reactor Source { output[2] out: int timer t(0, 100 msec) - state count: int(0) + state count: int = 0 reaction(t) -> out {= for (int i = 0; i < out_width; i++) { @@ -18,7 +18,7 @@ reactor Source { reactor Destination { input in: int - state count: int(0) + state count: int = 0 reaction(in) {= lf_print("Received %d.", in->value); diff --git a/test/C/src/federated/DistributedMultiportToken.lf b/test/C/src/federated/DistributedMultiportToken.lf index 065f480e11..dfb791d861 100644 --- a/test/C/src/federated/DistributedMultiportToken.lf +++ b/test/C/src/federated/DistributedMultiportToken.lf @@ -8,7 +8,7 @@ target C { reactor Source { output[4] out: char* timer t(0, 200 msec) - state count: int(0) + state count: int = 0 reaction(t) -> out {= for (int i = 0; i < out_width; i++) { diff --git a/test/C/src/federated/DistributedNetworkOrder.lf b/test/C/src/federated/DistributedNetworkOrder.lf index 0b9ca0cd17..e18ea4ac04 100644 --- a/test/C/src/federated/DistributedNetworkOrder.lf +++ b/test/C/src/federated/DistributedNetworkOrder.lf @@ -32,7 +32,7 @@ reactor Sender { reactor Receiver { input in: int - state success: int(0) + state success: int = 0 reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/federated/DistributedPhysicalActionUpstream.lf b/test/C/src/federated/DistributedPhysicalActionUpstream.lf index 2cc6735884..47280a24b8 100644 --- a/test/C/src/federated/DistributedPhysicalActionUpstream.lf +++ b/test/C/src/federated/DistributedPhysicalActionUpstream.lf @@ -30,7 +30,7 @@ preamble {= reactor WithPhysicalAction { output out: int - state thread_id: lf_thread_t(0) + state thread_id: lf_thread_t = 0 physical action act(0): int reaction(startup) -> act {= diff --git a/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf b/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf index 0a6ee31e62..66bbb964e1 100644 --- a/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf +++ b/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf @@ -30,7 +30,7 @@ preamble {= reactor WithPhysicalAction { output out: int - state thread_id: lf_thread_t(0) + state thread_id: lf_thread_t = 0 physical action act(0): int reaction(startup) -> act {= diff --git a/test/C/src/federated/DistributedStop.lf b/test/C/src/federated/DistributedStop.lf index cf103d8beb..2d4a616664 100644 --- a/test/C/src/federated/DistributedStop.lf +++ b/test/C/src/federated/DistributedStop.lf @@ -10,7 +10,7 @@ reactor Sender { output out: int timer t(0, 1 usec) logical action act - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false reaction(t, act) -> out, act {= lf_print("Sending 42 at (%lld, %u).", @@ -63,10 +63,10 @@ reactor Sender { } reactor Receiver( - stp_offset: time(10 msec) // Used in the decentralized variant of the test + stp_offset: time = 10 msec // Used in the decentralized variant of the test ) { input in: int - state reaction_invoked_correctly: bool(false) + state reaction_invoked_correctly: bool = false reaction(in) {= lf_print("Received %d at (%lld, %u).", diff --git a/test/C/src/federated/DistributedToken.lf b/test/C/src/federated/DistributedToken.lf index c408af6ad2..1068bd5f85 100644 --- a/test/C/src/federated/DistributedToken.lf +++ b/test/C/src/federated/DistributedToken.lf @@ -26,11 +26,11 @@ target C { * @param root The root string. * @output message The message. */ -reactor MessageGenerator(root: string("")) { +reactor MessageGenerator(root: string = "") { // Output type char* instead of string is used for dynamically allocated // character arrays (as opposed to static constant strings). output message: char* - state count: int(1) + state count: int = 1 // Send first message after 1 sec so that the startup reactions do not // factor into the transport time measurement on the first message. timer t(1 sec, 1 sec) @@ -57,7 +57,7 @@ reactor MessageGenerator(root: string("")) { */ reactor PrintMessage { input message: char* - state count: int(0) + state count: int = 0 reaction(message) {= printf("PrintMessage: At (elapsed) logical time %lld, receiver receives: %s\n", diff --git a/test/C/src/federated/FeedbackDelay.lf b/test/C/src/federated/FeedbackDelay.lf index 6495fde8db..997a4ad012 100644 --- a/test/C/src/federated/FeedbackDelay.lf +++ b/test/C/src/federated/FeedbackDelay.lf @@ -7,8 +7,8 @@ reactor PhysicalPlant { input control: double output sensor: double timer t(0, 33 msec) - state last_sensor_time: time(0) - state previous_sensor_time: time(0) + state last_sensor_time: time = 0 + state previous_sensor_time: time = 0 reaction(t) -> sensor {= lf_set(sensor, 42); @@ -27,8 +27,8 @@ reactor Controller { input sensor: double output control: double - state latest_control: double(0.0) - state first: bool(true) + state latest_control: double = 0.0 + state first: bool = true output request_for_planning: double input planning: double diff --git a/test/C/src/federated/FeedbackDelaySimple.lf b/test/C/src/federated/FeedbackDelaySimple.lf index 2f00000e03..0c9b147cda 100644 --- a/test/C/src/federated/FeedbackDelaySimple.lf +++ b/test/C/src/federated/FeedbackDelaySimple.lf @@ -6,7 +6,7 @@ reactor Loop { input in: int output out: int timer t(0, 100 msec) - state count: int(1) + state count: int = 1 reaction(in) {= lf_print("Received %d.", in->value); diff --git a/test/C/src/federated/HelloDistributed.lf b/test/C/src/federated/HelloDistributed.lf index 14b446f26d..6841bf91bc 100644 --- a/test/C/src/federated/HelloDistributed.lf +++ b/test/C/src/federated/HelloDistributed.lf @@ -19,7 +19,7 @@ reactor Source { reactor Destination { input in: string - state received: bool(false) + state received: bool = false reaction(startup) {= lf_print("Destination started."); =} diff --git a/test/C/src/federated/LoopDistributedCentralized.lf b/test/C/src/federated/LoopDistributedCentralized.lf index 9643d3f1f3..7fdc972b5a 100644 --- a/test/C/src/federated/LoopDistributedCentralized.lf +++ b/test/C/src/federated/LoopDistributedCentralized.lf @@ -14,11 +14,11 @@ target C { logging: DEBUG } -reactor Looper(incr: int(1), delay: time(0 msec)) { +reactor Looper(incr: int = 1, delay: time = 0 msec) { input in: int output out: int physical action a(delay) - state count: int(0) + state count: int = 0 timer t(0, 1 sec) @@ -42,7 +42,7 @@ reactor Looper(incr: int(1), delay: time(0 msec)) { =} } -federated reactor LoopDistributedCentralized(delay: time(0)) { +federated reactor LoopDistributedCentralized(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in diff --git a/test/C/src/federated/LoopDistributedCentralized2.lf b/test/C/src/federated/LoopDistributedCentralized2.lf index c81a0f012e..82412e16fe 100644 --- a/test/C/src/federated/LoopDistributedCentralized2.lf +++ b/test/C/src/federated/LoopDistributedCentralized2.lf @@ -13,11 +13,11 @@ target C { timeout: 4 sec } -reactor Looper(incr: int(1), delay: time(0 msec)) { +reactor Looper(incr: int = 1, delay: time = 0 msec) { input in: int output out: int physical action a(delay) - state count: int(0) + state count: int = 0 timer t(0, 1 sec) @@ -41,11 +41,11 @@ reactor Looper(incr: int(1), delay: time(0 msec)) { =} } -reactor Looper2(incr: int(1), delay: time(0 msec)) { +reactor Looper2(incr: int = 1, delay: time = 0 msec) { input in: int output out: int physical action a(delay) - state count: int(0) + state count: int = 0 timer t(0, 1 sec) @@ -69,7 +69,7 @@ reactor Looper2(incr: int(1), delay: time(0 msec)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper() right = new Looper2(incr = -1) left.out -> right.in diff --git a/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf b/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf index e622e31979..44ce6e1681 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf @@ -27,11 +27,11 @@ preamble {= } =} -reactor Looper(incr: int(1), delay: time(0 msec)) { +reactor Looper(incr: int = 1, delay: time = 0 msec) { input in: int output out: int physical action a(delay) - state count: int(0) + state count: int = 0 reaction(startup) -> a {= // Start the thread that listens for Enter or Return. @@ -62,7 +62,7 @@ reactor Looper(incr: int(1), delay: time(0 msec)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in diff --git a/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf b/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf index a1e6e87b6e..f9b088b7d1 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf @@ -14,11 +14,11 @@ target C { timeout: 5 sec } -reactor Looper(incr: int(1), delay: time(0 msec)) { +reactor Looper(incr: int = 1, delay: time = 0 msec) { input in: int output out: int - state count: int(0) - state received_count: int(0) + state count: int = 0 + state received_count: int = 0 timer t(0, 1 sec) reaction(t) -> out {= @@ -48,7 +48,7 @@ reactor Looper(incr: int(1), delay: time(0 msec)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in diff --git a/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf b/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf index ef18cadfbf..17177aadb3 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf @@ -15,11 +15,11 @@ target C { timeout: 5 sec } -reactor Contained(incr: int(1)) { +reactor Contained(incr: int = 1) { timer t(0, 1 sec) input in: int - state count: int(0) - state received_count: int(0) + state count: int = 0 + state received_count: int = 0 reaction(t) {= self->count += self->incr; =} @@ -32,10 +32,10 @@ reactor Contained(incr: int(1)) { =} } -reactor Looper(incr: int(1), delay: time(0 msec)) { +reactor Looper(incr: int = 1, delay: time = 0 msec) { input in: int output out: int - state count: int(0) + state count: int = 0 timer t(0, 1 sec) c = new Contained(incr = incr) @@ -62,7 +62,7 @@ reactor Looper(incr: int(1), delay: time(0 msec)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in diff --git a/test/C/src/federated/LoopDistributedDecentralized.lf b/test/C/src/federated/LoopDistributedDecentralized.lf index c2d4bcb297..ae64e6e71a 100644 --- a/test/C/src/federated/LoopDistributedDecentralized.lf +++ b/test/C/src/federated/LoopDistributedDecentralized.lf @@ -23,11 +23,11 @@ preamble {= } =} -reactor Looper(incr: int(1), delay: time(0 msec), stp_offset: time(0)) { +reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { input in: int output out: int physical action a(stp_offset) - state count: int(0) + state count: int = 0 reaction(startup) -> a {= // Start the thread that listens for Enter or Return. @@ -69,7 +69,7 @@ reactor Looper(incr: int(1), delay: time(0 msec), stp_offset: time(0)) { =} } -federated reactor LoopDistributedDecentralized(delay: time(0)) { +federated reactor LoopDistributedDecentralized(delay: time = 0) { left = new Looper(stp_offset = 900 usec) right = new Looper(incr = -1, stp_offset = 2400 usec) left.out -> right.in diff --git a/test/C/src/federated/LoopDistributedDouble.lf b/test/C/src/federated/LoopDistributedDouble.lf index bba7c7ffaa..31b7eb0f6e 100644 --- a/test/C/src/federated/LoopDistributedDouble.lf +++ b/test/C/src/federated/LoopDistributedDouble.lf @@ -27,13 +27,13 @@ preamble {= } =} -reactor Looper(incr: int(1), delay: time(0 msec)) { +reactor Looper(incr: int = 1, delay: time = 0 msec) { input in: int input in2: int output out: int output out2: int physical action a(delay) - state count: int(0) + state count: int = 0 timer t(0, 1 sec) reaction(startup) -> a {= @@ -82,7 +82,7 @@ reactor Looper(incr: int(1), delay: time(0 msec)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in diff --git a/test/C/src/federated/PhysicalSTP.lf b/test/C/src/federated/PhysicalSTP.lf index 1824d9ec93..492cd8875b 100644 --- a/test/C/src/federated/PhysicalSTP.lf +++ b/test/C/src/federated/PhysicalSTP.lf @@ -9,9 +9,9 @@ target C { import Count from "../lib/Count.lf" -reactor Print(STP_offset_param: time(0)) { +reactor Print(STP_offset_param: time = 0) { input in: int - state c: int(1) + state c: int = 1 reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); diff --git a/test/C/src/federated/PingPongDistributed.lf b/test/C/src/federated/PingPongDistributed.lf index a1d321cc6d..e16de50ed2 100644 --- a/test/C/src/federated/PingPongDistributed.lf +++ b/test/C/src/federated/PingPongDistributed.lf @@ -23,7 +23,7 @@ target C import Ping, Pong from "PingPongDistributedPhysical.lf" -federated reactor(count: int(10)) { +federated reactor(count: int = 10) { ping = new Ping(count = count) pong = new Pong(expected = count) ping.send -> pong.receive diff --git a/test/C/src/federated/PingPongDistributedPhysical.lf b/test/C/src/federated/PingPongDistributedPhysical.lf index 95427c2a29..d9ba517c59 100644 --- a/test/C/src/federated/PingPongDistributedPhysical.lf +++ b/test/C/src/federated/PingPongDistributedPhysical.lf @@ -26,10 +26,10 @@ */ target C -reactor Ping(count: int(10)) { +reactor Ping(count: int = 10) { input receive: int output send: int - state pingsLeft: int(count) + state pingsLeft: int = count logical action serve reaction(startup, serve) -> send {= @@ -46,10 +46,10 @@ reactor Ping(count: int(10)) { =} } -reactor Pong(expected: int(10)) { +reactor Pong(expected: int = 10) { input receive: int output send: int - state count: int(0) + state count: int = 0 reaction(receive) -> send {= self->count++; @@ -71,7 +71,7 @@ reactor Pong(expected: int(10)) { =} } -federated reactor(count: int(10)) { +federated reactor(count: int = 10) { ping = new Ping(count = count) pong = new Pong(expected = count) ping.send ~> pong.receive diff --git a/test/C/src/federated/TopLevelArtifacts.lf b/test/C/src/federated/TopLevelArtifacts.lf index 5fd4b0c376..05932b1937 100644 --- a/test/C/src/federated/TopLevelArtifacts.lf +++ b/test/C/src/federated/TopLevelArtifacts.lf @@ -15,7 +15,7 @@ import Count from "../lib/Count.lf" import TestCount from "../lib/TestCount.lf" federated reactor { - state successes: int(0) + state successes: int = 0 timer t(0, 1 sec) logical action act(0) diff --git a/test/C/src/federated/failing/ClockSync.lf b/test/C/src/federated/failing/ClockSync.lf index e843f0c549..1231ce9cbf 100644 --- a/test/C/src/federated/failing/ClockSync.lf +++ b/test/C/src/federated/failing/ClockSync.lf @@ -29,7 +29,7 @@ target C { } /** Reactor that outputs periodically. */ -reactor Ticker(period: time(1600 msec)) { +reactor Ticker(period: time = 1600 msec) { output out: int timer tick(0, period) diff --git a/test/C/src/federated/failing/DistributedDoublePortLooped.lf b/test/C/src/federated/failing/DistributedDoublePortLooped.lf index 4eca2cee76..67a3300c74 100644 --- a/test/C/src/federated/failing/DistributedDoublePortLooped.lf +++ b/test/C/src/federated/failing/DistributedDoublePortLooped.lf @@ -19,7 +19,7 @@ reactor Foo { } reactor Count { - state count: int(1) + state count: int = 1 input in1: int input in2: int input in3: int @@ -37,7 +37,7 @@ reactor Count { } reactor CountMicrostep { - state count: int(1) + state count: int = 1 output out: int logical action act: int timer t(0, 1 msec) diff --git a/test/C/src/federated/failing/DistributedDoublePortLooped2.lf b/test/C/src/federated/failing/DistributedDoublePortLooped2.lf index 04ea02c4e8..56a873e1bc 100644 --- a/test/C/src/federated/failing/DistributedDoublePortLooped2.lf +++ b/test/C/src/federated/failing/DistributedDoublePortLooped2.lf @@ -12,7 +12,7 @@ target C { } reactor Count { - state count: int(1) + state count: int = 1 input in: int output out: int timer t(0, 1 msec) @@ -26,7 +26,7 @@ reactor Count { } reactor CountMicrostep { - state count: int(1) + state count: int = 1 output out: int logical action act: int timer t(0, 1 msec) diff --git a/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf b/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf index 19779de3d2..97fa16b016 100644 --- a/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf +++ b/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf @@ -31,7 +31,7 @@ reactor Sender { reactor Receiver { input in: int - state success: int(0) + state success: int = 0 reaction(in) {= tag_t current_tag = lf_tag(); diff --git a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf index ee9fc56d83..b991662a05 100644 --- a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf +++ b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf @@ -11,11 +11,11 @@ target C { timeout: 4900 msec } -reactor Looper(incr: int(1), delay: time(0 msec), stp_offset: time(0)) { +reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { input in: int output out: int - state count: int(0) - state received_count: int(0) + state count: int = 0 + state received_count: int = 0 timer t(0, 1 sec) reaction(t) -> out {= @@ -57,7 +57,7 @@ reactor Looper(incr: int(1), delay: time(0 msec), stp_offset: time(0)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper(stp_offset = 5 msec) right = new Looper(incr = -1, stp_offset = 5 msec) left.out -> right.in diff --git a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf index 6cf9236901..357b7f2f2d 100644 --- a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf +++ b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf @@ -1,6 +1,7 @@ /** - * This tests that the precedence order of reaction invocation is kept - * in the hierarchy of reactors when a feedback loop is present in decentralized coordination. + * This tests that the precedence order of reaction invocation is kept in the + * hierarchy of reactors when a feedback loop is present in decentralized + * coordination. * * @author Edward A. Lee * @author Soroush Bateni @@ -11,37 +12,39 @@ target C { timeout: 4900 msec } -import Contained from "../LoopDistributedCentralizedPrecedenceHierarchy.lf"; +import Contained from "../LoopDistributedCentralizedPrecedenceHierarchy.lf" -reactor Looper(incr:int(1), delay:time(0 msec), stp_offset:time(0)) { - input in:int; - output out:int; - state count:int(0); - timer t(0, 1 sec); +reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { + input in: int + output out: int + state count: int = 0 + timer t(0, 1 sec) - c = new Contained(incr = incr); + c = new Contained(incr = incr) + in -> c.in reaction(t) -> out {= lf_set(out, self->count); self->count += self->incr; =} + reaction(in) {= instant_t time_lag = lf_time_physical() - lf_time_logical(); char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 lf_readable_time(time_buffer, time_lag); lf_print("Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); - =} STP (stp_offset) {= + =} STP(stp_offset) {= instant_t time_lag = lf_time_physical() - lf_time_logical(); char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 lf_readable_time(time_buffer, time_lag); lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); - =} deadline (10 msec) {= + =} deadline(10 msec) {= instant_t time_lag = lf_time_physical() - lf_time_logical(); char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 lf_readable_time(time_buffer, time_lag); lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); =} - in->c.in; + reaction(shutdown) {= lf_print("******* Shutdown invoked."); if (self->count != 5 * self->incr) { @@ -49,9 +52,10 @@ reactor Looper(incr:int(1), delay:time(0 msec), stp_offset:time(0)) { } =} } -federated reactor (delay:time(0)) { - left = new Looper(stp_offset = 5 msec); - right = new Looper(incr = -1, stp_offset = 5 msec); - left.out -> right.in; - right.out -> left.in; + +federated reactor(delay: time = 0) { + left = new Looper(stp_offset = 5 msec) + right = new Looper(incr = -1, stp_offset = 5 msec) + left.out -> right.in + right.out -> left.in } diff --git a/test/C/src/lib/Count.lf b/test/C/src/lib/Count.lf index fc95ead637..70291e783f 100644 --- a/test/C/src/lib/Count.lf +++ b/test/C/src/lib/Count.lf @@ -1,7 +1,7 @@ target C -reactor Count(offset: time(0), period: time(1 sec)) { - state count: int(1) +reactor Count(offset: time = 0, period: time = 1 sec) { + state count: int = 1 output out: int timer t(offset, period) diff --git a/test/C/src/lib/InternalDelay.lf b/test/C/src/lib/InternalDelay.lf index 013b916ecc..fbbf2f0cb6 100644 --- a/test/C/src/lib/InternalDelay.lf +++ b/test/C/src/lib/InternalDelay.lf @@ -1,6 +1,6 @@ target C -reactor InternalDelay(delay: int(10 msec)) { +reactor InternalDelay(delay: int = 10 msec) { input in: int output out: int logical action d: int diff --git a/test/C/src/lib/LoopedActionSender.lf b/test/C/src/lib/LoopedActionSender.lf index 2e24f1677f..b996fe6ac5 100644 --- a/test/C/src/lib/LoopedActionSender.lf +++ b/test/C/src/lib/LoopedActionSender.lf @@ -11,10 +11,10 @@ target C * @param break_interval: Determines how long the reactor should take a break * after sending take_a_break_after messages. */ -reactor Sender(take_a_break_after: int(10), break_interval: time(400 msec)) { +reactor Sender(take_a_break_after: int = 10, break_interval: time = 400 msec) { output out: int logical action act - state sent_messages: int(0) + state sent_messages: int = 0 reaction(startup, act) -> act, out {= // Send a message on out diff --git a/test/C/src/lib/Test.lf b/test/C/src/lib/Test.lf index ea341ae772..067c61ee1d 100644 --- a/test/C/src/lib/Test.lf +++ b/test/C/src/lib/Test.lf @@ -2,7 +2,7 @@ target C reactor TestDouble(expected: double[](1.0, 1.0, 1.0, 1.0)) { input in: double - state count: int(0) + state count: int = 0 reaction(in) {= printf("Received: %f\n", in->value); diff --git a/test/C/src/lib/TestCount.lf b/test/C/src/lib/TestCount.lf index 3db3fbb2fc..d3f29aec6c 100644 --- a/test/C/src/lib/TestCount.lf +++ b/test/C/src/lib/TestCount.lf @@ -9,9 +9,9 @@ */ target C -reactor TestCount(start: int(1), stride: int(1), num_inputs: int(1)) { - state count: int(start) - state inputs_received: int(0) +reactor TestCount(start: int = 1, stride: int = 1, num_inputs: int = 1) { + state count: int = start + state inputs_received: int = 0 input in: int reaction(in) {= diff --git a/test/C/src/lib/TestCountMultiport.lf b/test/C/src/lib/TestCountMultiport.lf index 2a24922ef8..5a2db4b029 100644 --- a/test/C/src/lib/TestCountMultiport.lf +++ b/test/C/src/lib/TestCountMultiport.lf @@ -12,13 +12,13 @@ target C reactor TestCountMultiport( - start: int(1), - stride: int(1), - num_inputs: int(1), - width: int(2) + start: int = 1, + stride: int = 1, + num_inputs: int = 1, + width: int = 2 ) { - state count: int(start) - state inputs_received: int(0) + state count: int = start + state inputs_received: int = 0 input[width] in: int reaction(in) {= diff --git a/test/C/src/modal_models/ConvertCaseTest.lf b/test/C/src/modal_models/ConvertCaseTest.lf index 494a3c273c..5475edaa35 100644 --- a/test/C/src/modal_models/ConvertCaseTest.lf +++ b/test/C/src/modal_models/ConvertCaseTest.lf @@ -83,9 +83,9 @@ reactor Converter { } } -reactor InputFeeder(message: string("")) { +reactor InputFeeder(message: string = "") { output character: char - state idx: int(0) + state idx: int = 0 timer t(0, 250 msec) diff --git a/test/C/src/modal_models/Count3Modes.lf b/test/C/src/modal_models/Count3Modes.lf index 5ef26ccde0..862915abed 100644 --- a/test/C/src/modal_models/Count3Modes.lf +++ b/test/C/src/modal_models/Count3Modes.lf @@ -34,7 +34,7 @@ main reactor { timer stepper(0, 250 msec) counter = new CounterCycle() - state expected_value: int(1) + state expected_value: int = 1 // Trigger reaction(stepper) -> counter.next {= lf_set(counter.next, true); =} diff --git a/test/C/src/modal_models/MixedReactions.lf b/test/C/src/modal_models/MixedReactions.lf index e0c9c7f0f7..78ea39c95c 100644 --- a/test/C/src/modal_models/MixedReactions.lf +++ b/test/C/src/modal_models/MixedReactions.lf @@ -8,8 +8,8 @@ target C { } main reactor { - state x: int(0) - state first: bool(true) + state x: int = 0 + state first: bool = true timer t(0, 100 msec) diff --git a/test/C/src/modal_models/ModalAfter.lf b/test/C/src/modal_models/ModalAfter.lf index 038a368cc9..270fd88d05 100644 --- a/test/C/src/modal_models/ModalAfter.lf +++ b/test/C/src/modal_models/ModalAfter.lf @@ -45,7 +45,7 @@ reactor Modal { } } -reactor Producer(mode_id: int(0)) { +reactor Producer(mode_id: int = 0) { output product: int timer t(0, 750 msec) @@ -56,7 +56,7 @@ reactor Producer(mode_id: int(0)) { =} } -reactor Consumer(mode_id: int(0)) { +reactor Consumer(mode_id: int = 0) { input product: int output report: int diff --git a/test/C/src/modal_models/ModalCycleBreaker.lf b/test/C/src/modal_models/ModalCycleBreaker.lf index 680323a729..cee4fabfec 100644 --- a/test/C/src/modal_models/ModalCycleBreaker.lf +++ b/test/C/src/modal_models/ModalCycleBreaker.lf @@ -42,11 +42,11 @@ reactor Modal { } } -reactor Counter(period: time(1 sec)) { +reactor Counter(period: time = 1 sec) { output value: int timer t(0, period) - state curval: int(0) + state curval: int = 0 reaction(t) -> value {= lf_set(value, self->curval++); =} } diff --git a/test/C/src/modal_models/ModalStateReset.lf b/test/C/src/modal_models/ModalStateReset.lf index cd963cfd8d..61563162b6 100644 --- a/test/C/src/modal_models/ModalStateReset.lf +++ b/test/C/src/modal_models/ModalStateReset.lf @@ -14,7 +14,7 @@ reactor Modal { output count1: int output count2: int - state counter0: int(0) + state counter0: int = 0 reaction(next) -> count0 {= printf("Counter0: %d\n", self->counter0); @@ -22,7 +22,7 @@ reactor Modal { =} initial mode One { - state counter1: int(0) + state counter1: int = 0 timer T1(0 msec, 250 msec) reaction(reset) {= self->counter1 = 0; =} @@ -39,7 +39,7 @@ reactor Modal { } mode Two { - state counter2: int(-2) + state counter2: int = -2 timer T2(0 msec, 250 msec) reaction(reset) {= self->counter2 = -2; =} diff --git a/test/C/src/modal_models/ModalStateResetAuto.lf b/test/C/src/modal_models/ModalStateResetAuto.lf index 24cfe9b187..a2b6b105f0 100644 --- a/test/C/src/modal_models/ModalStateResetAuto.lf +++ b/test/C/src/modal_models/ModalStateResetAuto.lf @@ -14,7 +14,7 @@ reactor Modal { output count1: int output count2: int - state counter0: int(0) + state counter0: int = 0 reaction(next) -> count0 {= printf("Counter0: %d\n", self->counter0); @@ -22,7 +22,7 @@ reactor Modal { =} initial mode One { - state counter1: int(0) + state counter1: int = 0 timer T1(0 msec, 250 msec) reaction(T1) -> count1 {= printf("Counter1: %d\n", self->counter1); @@ -37,7 +37,7 @@ reactor Modal { } mode Two { - reset state counter2: int(-2) + reset state counter2: int = -2 timer T2(0 msec, 250 msec) reaction(T2) -> count2 {= printf("Counter2: %d\n", self->counter2); diff --git a/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf b/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf index 7e75afec13..60fa76dd1e 100644 --- a/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf +++ b/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf @@ -28,11 +28,11 @@ reactor Modal { } } -reactor Counter(period: time(1 sec)) { +reactor Counter(period: time = 1 sec) { output value: int timer t(0, period) - reset state curval: int(0) + reset state curval: int = 0 reaction(t) -> value {= lf_set(value, self->curval++); =} } diff --git a/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf b/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf index 48b335d2b3..dff82c602f 100644 --- a/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf +++ b/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf @@ -31,11 +31,11 @@ reactor Modal { } } -reactor Counter(period: time(1 sec)) { +reactor Counter(period: time = 1 sec) { output value: int timer t(0, period) - reset state curval: int(0) + reset state curval: int = 0 reaction(t) -> value {= lf_set(value, self->curval++); =} } diff --git a/test/C/src/modal_models/util/TraceTesting.lf b/test/C/src/modal_models/util/TraceTesting.lf index 7d5a335db2..247b3f1def 100644 --- a/test/C/src/modal_models/util/TraceTesting.lf +++ b/test/C/src/modal_models/util/TraceTesting.lf @@ -6,17 +6,17 @@ preamble {= =} reactor TraceTesting( - events_size: int(0), - trace_size: int(0), - trace: int[](0), - training: bool(false) + events_size: int = 0, + trace_size: int = 0, + trace: int[] = 0, + training: bool = false ) { input[events_size] events: int - state last_reaction_time: int(0) - state trace_idx: int(0) - state recorded_events: int*(0) - state recorded_events_next: int(0) + state last_reaction_time: int = 0 + state trace_idx: int = 0 + state recorded_events: int* = 0 + state recorded_events_next: int = 0 reaction(startup) {= self->last_reaction_time = lf_time_logical(); =} diff --git a/test/C/src/multiport/BankIndexInitializer.lf b/test/C/src/multiport/BankIndexInitializer.lf index b9b8803943..d8a2c5766e 100644 --- a/test/C/src/multiport/BankIndexInitializer.lf +++ b/test/C/src/multiport/BankIndexInitializer.lf @@ -3,15 +3,15 @@ target C preamble {= int table[] = {4, 3, 2, 1}; =} -reactor Source(bank_index: int(0), value: int(0)) { +reactor Source(bank_index: int = 0, value: int = 0) { output out: int reaction(startup) -> out {= lf_set(out, self->value); =} } -reactor Sink(width: int(4)) { +reactor Sink(width: int = 4) { input[width] in: int - state received: bool(false) + state received: bool = false reaction(in) {= for (int idx = 0; idx < in_width; idx++) { @@ -32,7 +32,7 @@ reactor Sink(width: int(4)) { =} } -main reactor(width: int(4)) { +main reactor(width: int = 4) { source = new[width] Source(value = {= table[bank_index] =}) sink = new Sink(width = width) source.out -> sink.in diff --git a/test/C/src/multiport/BankMultiportToReaction.lf b/test/C/src/multiport/BankMultiportToReaction.lf index c2eff34100..731cd6891b 100644 --- a/test/C/src/multiport/BankMultiportToReaction.lf +++ b/test/C/src/multiport/BankMultiportToReaction.lf @@ -13,8 +13,8 @@ reactor DoubleCount { } main reactor { - state count: int(1) - state received: bool(false) + state count: int = 1 + state received: bool = false s = new[2] DoubleCount() diff --git a/test/C/src/multiport/BankReactionsInContainer.lf b/test/C/src/multiport/BankReactionsInContainer.lf index 6533e7ed0b..98d7cf4e1f 100644 --- a/test/C/src/multiport/BankReactionsInContainer.lf +++ b/test/C/src/multiport/BankReactionsInContainer.lf @@ -5,10 +5,10 @@ target C { timeout: 1 sec } -reactor R(bank_index: int(0)) { +reactor R(bank_index: int = 0) { output[2] out: int input[2] in: int - state received: bool(false) + state received: bool = false reaction(startup) -> out {= for (int i = 0; i < out_width; i++) { @@ -42,7 +42,7 @@ reactor R(bank_index: int(0)) { main reactor { s = new[2] R() - state received: bool(false) + state received: bool = false reaction(startup) -> s.in {= int count = 0; diff --git a/test/C/src/multiport/BankSelfBroadcast.lf b/test/C/src/multiport/BankSelfBroadcast.lf index 587087d550..e1ffb4b2dd 100644 --- a/test/C/src/multiport/BankSelfBroadcast.lf +++ b/test/C/src/multiport/BankSelfBroadcast.lf @@ -7,10 +7,10 @@ */ target C -reactor A(bank_index: int(0)) { +reactor A(bank_index: int = 0) { input[4] in: int output out: int - state received: bool(false) + state received: bool = false reaction(startup) -> out {= lf_set(out, self->bank_index); =} diff --git a/test/C/src/multiport/BankToBank.lf b/test/C/src/multiport/BankToBank.lf index 19a784efd4..beb3a32fa8 100644 --- a/test/C/src/multiport/BankToBank.lf +++ b/test/C/src/multiport/BankToBank.lf @@ -4,10 +4,10 @@ target C { fast: true } -reactor Source(bank_index: int(0)) { +reactor Source(bank_index: int = 0) { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= lf_set(out, self->s); @@ -15,8 +15,8 @@ reactor Source(bank_index: int(0)) { =} } -reactor Destination(bank_index: int(0)) { - state s: int(0) +reactor Destination(bank_index: int = 0) { + state s: int = 0 input in: int reaction(in) {= @@ -37,7 +37,7 @@ reactor Destination(bank_index: int(0)) { =} } -main reactor BankToBank(width: int(4)) { +main reactor BankToBank(width: int = 4) { a = new[width] Source() b = new[width] Destination() a.out -> b.in diff --git a/test/C/src/multiport/BankToBankMultiport.lf b/test/C/src/multiport/BankToBankMultiport.lf index 22c5821cc6..681538f116 100644 --- a/test/C/src/multiport/BankToBankMultiport.lf +++ b/test/C/src/multiport/BankToBankMultiport.lf @@ -4,10 +4,10 @@ target C { fast: true } -reactor Source(width: int(1)) { +reactor Source(width: int = 1) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < out_width; i++) { @@ -16,8 +16,8 @@ reactor Source(width: int(1)) { =} } -reactor Destination(width: int(1)) { - state s: int(6) +reactor Destination(width: int = 1) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -42,7 +42,7 @@ reactor Destination(width: int(1)) { =} } -main reactor BankToBankMultiport(bank_width: int(4)) { +main reactor BankToBankMultiport(bank_width: int = 4) { a = new[bank_width] Source(width = 4) b = new[bank_width] Destination(width = 4) a.out -> b.in diff --git a/test/C/src/multiport/BankToBankMultiportAfter.lf b/test/C/src/multiport/BankToBankMultiportAfter.lf index 38daec6ccf..db0ff7771e 100644 --- a/test/C/src/multiport/BankToBankMultiportAfter.lf +++ b/test/C/src/multiport/BankToBankMultiportAfter.lf @@ -4,10 +4,10 @@ target C { fast: true } -reactor Source(width: int(1)) { +reactor Source(width: int = 1) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < out_width; i++) { @@ -16,8 +16,8 @@ reactor Source(width: int(1)) { =} } -reactor Destination(width: int(1)) { - state s: int(6) +reactor Destination(width: int = 1) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -42,7 +42,7 @@ reactor Destination(width: int(1)) { =} } -main reactor(bank_width: int(4)) { +main reactor(bank_width: int = 4) { a = new[bank_width] Source(width = 4) b = new[bank_width] Destination(width = 4) a.out -> b.in after 200 msec diff --git a/test/C/src/multiport/BankToMultiport.lf b/test/C/src/multiport/BankToMultiport.lf index ee0ad53dc3..f72c104df7 100644 --- a/test/C/src/multiport/BankToMultiport.lf +++ b/test/C/src/multiport/BankToMultiport.lf @@ -1,15 +1,15 @@ // Test bank of reactors to multiport input with id parameter in the bank. target C -reactor Source(bank_index: int(0)) { +reactor Source(bank_index: int = 0) { output out: int reaction(startup) -> out {= lf_set(out, self->bank_index); =} } -reactor Sink(width: int(4)) { +reactor Sink(width: int = 4) { input[width] in: int - state received: bool(false) + state received: bool = false reaction(in) {= for (int i = 0; i < in_width; i++) { @@ -32,7 +32,7 @@ reactor Sink(width: int(4)) { =} } -main reactor BankToMultiport(width: int(5)) { +main reactor BankToMultiport(width: int = 5) { source = new[width] Source() sink = new Sink(width = width) source.out -> sink.in diff --git a/test/C/src/multiport/BankToReaction.lf b/test/C/src/multiport/BankToReaction.lf index c5d68cfe41..4e59352bd5 100644 --- a/test/C/src/multiport/BankToReaction.lf +++ b/test/C/src/multiport/BankToReaction.lf @@ -6,7 +6,7 @@ target C { import Count from "../lib/Count.lf" main reactor { - state count: int(1) + state count: int = 1 s = new[2] Count() diff --git a/test/C/src/multiport/Broadcast.lf b/test/C/src/multiport/Broadcast.lf index dee0ad62ed..e3471da5f6 100644 --- a/test/C/src/multiport/Broadcast.lf +++ b/test/C/src/multiport/Broadcast.lf @@ -9,9 +9,9 @@ reactor Source { reaction(startup) -> out {= lf_set(out, 42); =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); diff --git a/test/C/src/multiport/BroadcastAfter.lf b/test/C/src/multiport/BroadcastAfter.lf index b66979e182..c1be635e55 100644 --- a/test/C/src/multiport/BroadcastAfter.lf +++ b/test/C/src/multiport/BroadcastAfter.lf @@ -9,9 +9,9 @@ reactor Source { reaction(startup) -> out {= lf_set(out, 42); =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); diff --git a/test/C/src/multiport/BroadcastMultipleAfter.lf b/test/C/src/multiport/BroadcastMultipleAfter.lf index b83540e3d4..97d853e4ce 100644 --- a/test/C/src/multiport/BroadcastMultipleAfter.lf +++ b/test/C/src/multiport/BroadcastMultipleAfter.lf @@ -3,15 +3,15 @@ target C { fast: true } -reactor Source(value: int(42)) { +reactor Source(value: int = 42) { output out: int reaction(startup) -> out {= lf_set(out, self->value); =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); diff --git a/test/C/src/multiport/DualBanks.lf b/test/C/src/multiport/DualBanks.lf index aa8faf4b75..3cb5d38887 100644 --- a/test/C/src/multiport/DualBanks.lf +++ b/test/C/src/multiport/DualBanks.lf @@ -1,8 +1,8 @@ target C -reactor Base(bank_index: int(0)) { +reactor Base(bank_index: int = 0) { input I: int - state received: bool(false) + state received: bool = false reaction(shutdown) {= if(!self->received) { diff --git a/test/C/src/multiport/DualBanksMultiport.lf b/test/C/src/multiport/DualBanksMultiport.lf index 42c4adb11e..a5c2120a79 100644 --- a/test/C/src/multiport/DualBanksMultiport.lf +++ b/test/C/src/multiport/DualBanksMultiport.lf @@ -1,8 +1,8 @@ target C -reactor Base(bank_index: int(0)) { +reactor Base(bank_index: int = 0) { input[2] I: int - state received: bool(false) + state received: bool = false reaction(shutdown) {= if(!self->received) { diff --git a/test/C/src/multiport/FullyConnected.lf b/test/C/src/multiport/FullyConnected.lf index 8a26fee83f..758ecf1580 100644 --- a/test/C/src/multiport/FullyConnected.lf +++ b/test/C/src/multiport/FullyConnected.lf @@ -1,10 +1,10 @@ target C -reactor Node(num_nodes: size_t(4), bank_index: int(0)) { +reactor Node(num_nodes: size_t = 4, bank_index: int = 0) { input[num_nodes] in: int output out: int - state received: bool(false) + state received: bool = false reaction(startup) -> out {= lf_print("Hello from node %d!", self->bank_index); @@ -35,7 +35,7 @@ reactor Node(num_nodes: size_t(4), bank_index: int(0)) { =} } -main reactor(num_nodes: size_t(4)) { +main reactor(num_nodes: size_t = 4) { nodes = new[num_nodes] Node(num_nodes = num_nodes) (nodes.out)+ -> nodes.in } diff --git a/test/C/src/multiport/FullyConnectedAddressable.lf b/test/C/src/multiport/FullyConnectedAddressable.lf index ae99d5397e..91b0f5caac 100644 --- a/test/C/src/multiport/FullyConnectedAddressable.lf +++ b/test/C/src/multiport/FullyConnectedAddressable.lf @@ -1,12 +1,12 @@ // In this pattern, each node can send direct messages to individual other nodes target C -reactor Node(num_nodes: size_t(4), bank_index: int(0)) { +reactor Node(num_nodes: size_t = 4, bank_index: int = 0) { input[num_nodes] in: int output[num_nodes] out: int - state received: int(0) - state triggered: bool(false) + state received: int = 0 + state triggered: bool = false reaction(startup) -> out {= int outChannel = (self->bank_index + 1) % self->num_nodes; @@ -45,7 +45,7 @@ reactor Node(num_nodes: size_t(4), bank_index: int(0)) { =} } -main reactor(num_nodes: size_t(4)) { +main reactor(num_nodes: size_t = 4) { nodes1 = new[num_nodes] Node(num_nodes = num_nodes) nodes1.out -> interleaved (nodes1.in) diff --git a/test/C/src/multiport/FullyConnectedAddressableAfter.lf b/test/C/src/multiport/FullyConnectedAddressableAfter.lf index cd6dc4cf85..1d30430deb 100644 --- a/test/C/src/multiport/FullyConnectedAddressableAfter.lf +++ b/test/C/src/multiport/FullyConnectedAddressableAfter.lf @@ -3,7 +3,7 @@ target C import Node from "FullyConnectedAddressable.lf" -main reactor(num_nodes: size_t(4)) { +main reactor(num_nodes: size_t = 4) { nodes1 = new[num_nodes] Node(num_nodes = num_nodes) nodes1.out -> interleaved (nodes1.in) after 200 msec diff --git a/test/C/src/multiport/MultiportFromBank.lf b/test/C/src/multiport/MultiportFromBank.lf index b8ade7a354..1b49786060 100644 --- a/test/C/src/multiport/MultiportFromBank.lf +++ b/test/C/src/multiport/MultiportFromBank.lf @@ -5,7 +5,7 @@ target C { fast: true } -reactor Source(check_override: int(0), bank_index: int(0)) { +reactor Source(check_override: int = 0, bank_index: int = 0) { output out: int reaction(startup) -> out {= @@ -13,9 +13,9 @@ reactor Source(check_override: int(0), bank_index: int(0)) { =} } -reactor Destination(port_width: int(3)) { +reactor Destination(port_width: int = 3) { input[port_width] in: int - state received: bool(false) + state received: bool = false reaction(in) {= for (int i = 0; i < in_width; i++) { @@ -37,7 +37,7 @@ reactor Destination(port_width: int(3)) { =} } -main reactor MultiportFromBank(width: int(4)) { +main reactor MultiportFromBank(width: int = 4) { a = new[width] Source(check_override = 1) b = new Destination(port_width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportFromBankHierarchy.lf b/test/C/src/multiport/MultiportFromBankHierarchy.lf index c38046107c..e8ee6194b5 100644 --- a/test/C/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/C/src/multiport/MultiportFromBankHierarchy.lf @@ -7,13 +7,13 @@ target C { import Source, Destination from "MultiportFromBank.lf" -reactor Container(port_width: int(3)) { +reactor Container(port_width: int = 3) { output[port_width] out: int s = new[port_width] Source(check_override = 1) s.out -> out } -main reactor(width: int(4)) { +main reactor(width: int = 4) { a = new Container(port_width = width) b = new Destination(port_width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportFromHierarchy.lf b/test/C/src/multiport/MultiportFromHierarchy.lf index f38661345c..8323210946 100644 --- a/test/C/src/multiport/MultiportFromHierarchy.lf +++ b/test/C/src/multiport/MultiportFromHierarchy.lf @@ -5,10 +5,10 @@ target C { fast: true } -reactor Source(width: int(3)) { +reactor Source(width: int = 3) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < out_width; i++) { @@ -17,8 +17,8 @@ reactor Source(width: int(3)) { =} } -reactor Destination(width: int(3)) { - state s: int(6) +reactor Destination(width: int = 3) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -43,19 +43,19 @@ reactor Destination(width: int(3)) { =} } -reactor Container(width: int(3)) { +reactor Container(width: int = 3) { output[width] out: int src = new InsideContainer(width = width) src.out -> out } -reactor InsideContainer(width: int(3)) { +reactor InsideContainer(width: int = 3) { output[width] out: int src = new Source(width = width) src.out -> out } -main reactor MultiportFromHierarchy(width: int(4)) { +main reactor MultiportFromHierarchy(width: int = 4) { a = new Container(width = width) b = new Destination(width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportFromReaction.lf b/test/C/src/multiport/MultiportFromReaction.lf index acaa59e519..33cbfffd83 100644 --- a/test/C/src/multiport/MultiportFromReaction.lf +++ b/test/C/src/multiport/MultiportFromReaction.lf @@ -4,8 +4,8 @@ target C { fast: true } -reactor Destination(width: int(1)) { - state s: int(6) +reactor Destination(width: int = 1) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -30,9 +30,9 @@ reactor Destination(width: int(1)) { =} } -main reactor MultiportFromReaction(width: int(4)) { +main reactor MultiportFromReaction(width: int = 4) { timer t(0, 200 msec) - state s: int(0) + state s: int = 0 b = new Destination(width = width) reaction(t) -> b.in {= diff --git a/test/C/src/multiport/MultiportIn.lf b/test/C/src/multiport/MultiportIn.lf index 80269896d8..b87a91a79b 100644 --- a/test/C/src/multiport/MultiportIn.lf +++ b/test/C/src/multiport/MultiportIn.lf @@ -8,7 +8,7 @@ target C { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= lf_set(out, self->s); @@ -24,7 +24,7 @@ reactor Computation { } reactor Destination { - state s: int(0) + state s: int = 0 input[4] in: int reaction(in) {= diff --git a/test/C/src/multiport/MultiportInParameterized.lf b/test/C/src/multiport/MultiportInParameterized.lf index cd9bb27ad2..bf7ec93f6e 100644 --- a/test/C/src/multiport/MultiportInParameterized.lf +++ b/test/C/src/multiport/MultiportInParameterized.lf @@ -8,7 +8,7 @@ target C { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= lf_set(out, self->s); @@ -23,8 +23,8 @@ reactor Computation { reaction(in) -> out {= lf_set(out, in->value); =} } -reactor Destination(width: int(1)) { - state s: int(0) +reactor Destination(width: int = 1) { + state s: int = 0 input[width] in: int reaction(in) {= diff --git a/test/C/src/multiport/MultiportMutableInput.lf b/test/C/src/multiport/MultiportMutableInput.lf index d1b0994012..e1f8d579c2 100644 --- a/test/C/src/multiport/MultiportMutableInput.lf +++ b/test/C/src/multiport/MultiportMutableInput.lf @@ -12,7 +12,7 @@ reactor Source { =} } -reactor Print(scale: int(1)) { // The scale parameter is just for testing. +reactor Print(scale: int = 1) { // The scale parameter is just for testing. input[2] in: int reaction(in) {= @@ -27,7 +27,7 @@ reactor Print(scale: int(1)) { // The scale parameter is just for testing. =} } -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { mutable input[2] in: int output[2] out: int diff --git a/test/C/src/multiport/MultiportMutableInputArray.lf b/test/C/src/multiport/MultiportMutableInputArray.lf index cd279bb6a2..90907e4f44 100644 --- a/test/C/src/multiport/MultiportMutableInputArray.lf +++ b/test/C/src/multiport/MultiportMutableInputArray.lf @@ -26,7 +26,7 @@ reactor Source { =} } -reactor Print(scale: int(1)) { // The scale parameter is just for testing. +reactor Print(scale: int = 1) { // The scale parameter is just for testing. input[2] in: int[] reaction(in) {= @@ -52,7 +52,7 @@ reactor Print(scale: int(1)) { // The scale parameter is just for testing. =} } -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { mutable input[2] in: int[] output[2] out: int[] diff --git a/test/C/src/multiport/MultiportOut.lf b/test/C/src/multiport/MultiportOut.lf index c2707d5d33..38365d217a 100644 --- a/test/C/src/multiport/MultiportOut.lf +++ b/test/C/src/multiport/MultiportOut.lf @@ -7,7 +7,7 @@ target C { reactor Source { timer t(0, 200 msec) output[4] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < 4; i++) { @@ -31,7 +31,7 @@ reactor Computation { } reactor Destination { - state s: int(0) + state s: int = 0 input[4] in: int reaction(in) {= diff --git a/test/C/src/multiport/MultiportToBank.lf b/test/C/src/multiport/MultiportToBank.lf index c1f19d3553..86146b9818 100644 --- a/test/C/src/multiport/MultiportToBank.lf +++ b/test/C/src/multiport/MultiportToBank.lf @@ -4,7 +4,7 @@ target C { fast: true } -reactor Source(width: int(2)) { +reactor Source(width: int = 2) { output[width] out: int // Connected to a bank of Destination reactors input dummy: int // Not connected to anything @@ -24,9 +24,9 @@ reactor Source(width: int(2)) { =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); @@ -46,7 +46,7 @@ reactor Destination(bank_index: int(0)) { =} } -main reactor MultiportToBank(width: int(3)) { +main reactor MultiportToBank(width: int = 3) { a = new Source(width = width) b = new[width] Destination() a.out -> b.in diff --git a/test/C/src/multiport/MultiportToBankAfter.lf b/test/C/src/multiport/MultiportToBankAfter.lf index 66e0fdf837..ba26142243 100644 --- a/test/C/src/multiport/MultiportToBankAfter.lf +++ b/test/C/src/multiport/MultiportToBankAfter.lf @@ -5,7 +5,7 @@ target C { fast: true } -reactor Source(width: int(2)) { +reactor Source(width: int = 2) { output[width] out: int reaction(startup) -> out {= @@ -15,9 +15,9 @@ reactor Source(width: int(2)) { =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); @@ -41,7 +41,7 @@ reactor Destination(bank_index: int(0)) { =} } -main reactor(width: int(3)) { +main reactor(width: int = 3) { a = new Source(width = width) b = new[width] Destination() a.out -> b.in after 1 sec // Width of the bank of delays will be inferred. diff --git a/test/C/src/multiport/MultiportToBankDouble.lf b/test/C/src/multiport/MultiportToBankDouble.lf index a116ef9c00..444f02d170 100644 --- a/test/C/src/multiport/MultiportToBankDouble.lf +++ b/test/C/src/multiport/MultiportToBankDouble.lf @@ -24,9 +24,9 @@ reactor Source { =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); diff --git a/test/C/src/multiport/MultiportToBankHierarchy.lf b/test/C/src/multiport/MultiportToBankHierarchy.lf index e4f231390f..fbdc531bf0 100644 --- a/test/C/src/multiport/MultiportToBankHierarchy.lf +++ b/test/C/src/multiport/MultiportToBankHierarchy.lf @@ -5,7 +5,7 @@ target C { fast: true } -reactor Source(width: int(2)) { +reactor Source(width: int = 2) { output[width] out: int reaction(startup) -> out {= @@ -15,9 +15,9 @@ reactor Source(width: int(2)) { =} } -reactor Destination(bank_index: int(0)) { +reactor Destination(bank_index: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); @@ -37,13 +37,13 @@ reactor Destination(bank_index: int(0)) { =} } -reactor Container(width: int(2)) { +reactor Container(width: int = 2) { input[width] in: int c = new[width] Destination() in -> c.in } -main reactor MultiportToBankHierarchy(width: int(3)) { +main reactor MultiportToBankHierarchy(width: int = 3) { a = new Source(width = width) b = new Container(width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportToHierarchy.lf b/test/C/src/multiport/MultiportToHierarchy.lf index 24290b56a5..41ca505077 100644 --- a/test/C/src/multiport/MultiportToHierarchy.lf +++ b/test/C/src/multiport/MultiportToHierarchy.lf @@ -6,10 +6,10 @@ target C { fast: true } -reactor Source(width: int(2)) { +reactor Source(width: int = 2) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < 4; i++) { @@ -18,8 +18,8 @@ reactor Source(width: int(2)) { =} } -reactor Destination(width: int(4)) { - state s: int(6) +reactor Destination(width: int = 4) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -44,13 +44,13 @@ reactor Destination(width: int(4)) { =} } -reactor Container(width: int(4)) { +reactor Container(width: int = 4) { input[width] in: int dst = new Destination() in -> dst.in } -main reactor MultiportToHierarchy(width: int(4)) { +main reactor MultiportToHierarchy(width: int = 4) { a = new Source(width = width) b = new Container(width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportToMultiport.lf b/test/C/src/multiport/MultiportToMultiport.lf index bf4bbefde4..375fa080e2 100644 --- a/test/C/src/multiport/MultiportToMultiport.lf +++ b/test/C/src/multiport/MultiportToMultiport.lf @@ -4,10 +4,10 @@ target C { fast: true } -reactor Source(width: int(1)) { +reactor Source(width: int = 1) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < out_width; i++) { @@ -19,8 +19,8 @@ reactor Source(width: int(1)) { =} } -reactor Destination(width: int(1)) { - state s: int(6) +reactor Destination(width: int = 1) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -45,7 +45,7 @@ reactor Destination(width: int(1)) { =} } -main reactor MultiportToMultiport(width: int(4)) { +main reactor MultiportToMultiport(width: int = 4) { a = new Source(width = width) b = new Destination(width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportToMultiport2.lf b/test/C/src/multiport/MultiportToMultiport2.lf index 29a8632399..76858a2a86 100644 --- a/test/C/src/multiport/MultiportToMultiport2.lf +++ b/test/C/src/multiport/MultiportToMultiport2.lf @@ -1,7 +1,7 @@ // Test multiport to multiport connections. See also MultiportToMultiport. target C -reactor Source(width: int(2)) { +reactor Source(width: int = 2) { output[width] out: int reaction(startup) -> out {= @@ -11,7 +11,7 @@ reactor Source(width: int(2)) { =} } -reactor Destination(width: int(2)) { +reactor Destination(width: int = 2) { input[width] in: int reaction(in) {= @@ -30,9 +30,9 @@ reactor Destination(width: int(2)) { } main reactor MultiportToMultiport2( - width1: int(3), - width2: int(2), - width3: int(5) + width1: int = 3, + width2: int = 2, + width3: int = 5 ) { a1 = new Source(width = width1) a2 = new Source(width = width2) diff --git a/test/C/src/multiport/MultiportToMultiport2After.lf b/test/C/src/multiport/MultiportToMultiport2After.lf index b6f078a099..49585ea1b0 100644 --- a/test/C/src/multiport/MultiportToMultiport2After.lf +++ b/test/C/src/multiport/MultiportToMultiport2After.lf @@ -1,7 +1,7 @@ // Test multiport to multiport connections. See also MultiportToMultiport. target C -reactor Source(width: int(2)) { +reactor Source(width: int = 2) { output[width] out: int reaction(startup) -> out {= @@ -11,7 +11,7 @@ reactor Source(width: int(2)) { =} } -reactor Destination(width: int(2)) { +reactor Destination(width: int = 2) { input[width] in: int reaction(in) {= diff --git a/test/C/src/multiport/MultiportToMultiportArray.lf b/test/C/src/multiport/MultiportToMultiportArray.lf index 100a57c393..9d86a4a522 100644 --- a/test/C/src/multiport/MultiportToMultiportArray.lf +++ b/test/C/src/multiport/MultiportToMultiportArray.lf @@ -8,7 +8,7 @@ target C { reactor Source { timer t(0, 200 msec) output[2] out: int[] - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < 2; i++) { @@ -24,7 +24,7 @@ reactor Source { } reactor Destination { - state s: int(15) + state s: int = 15 input[2] in: int[] reaction(in) {= diff --git a/test/C/src/multiport/MultiportToMultiportParameter.lf b/test/C/src/multiport/MultiportToMultiportParameter.lf index 9dc7288a52..d1c96e5ddd 100644 --- a/test/C/src/multiport/MultiportToMultiportParameter.lf +++ b/test/C/src/multiport/MultiportToMultiportParameter.lf @@ -4,10 +4,10 @@ target C { fast: true } -reactor Source(width: int(1)) { +reactor Source(width: int = 1) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < out_width; i++) { @@ -19,8 +19,8 @@ reactor Source(width: int(1)) { =} } -reactor Destination(width: int(1)) { - state s: int(6) +reactor Destination(width: int = 1) { + state s: int = 6 input[width] in: int // Width is one larger than that of the source. reaction(in) {= @@ -45,7 +45,7 @@ reactor Destination(width: int(1)) { =} } -main reactor(width: int(4)) { +main reactor(width: int = 4) { a = new Source(width = width) b = new Destination(width = width) a.out -> b.in diff --git a/test/C/src/multiport/MultiportToPort.lf b/test/C/src/multiport/MultiportToPort.lf index ccee46566c..1784f2503c 100644 --- a/test/C/src/multiport/MultiportToPort.lf +++ b/test/C/src/multiport/MultiportToPort.lf @@ -16,9 +16,9 @@ reactor Source { =} } -reactor Destination(expected: int(0)) { +reactor Destination(expected: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= printf("Received: %d.\n", in->value); diff --git a/test/C/src/multiport/MultiportToReaction.lf b/test/C/src/multiport/MultiportToReaction.lf index 62e2c302f2..9281633079 100644 --- a/test/C/src/multiport/MultiportToReaction.lf +++ b/test/C/src/multiport/MultiportToReaction.lf @@ -4,9 +4,9 @@ target C { fast: true } -reactor Source(width: int(1)) { +reactor Source(width: int = 1) { timer t(0, 200 msec) - state s: int(0) + state s: int = 0 output[width] out: int reaction(t) -> out {= @@ -18,7 +18,7 @@ reactor Source(width: int(1)) { } main reactor MultiportToReaction { - state s: int(6) + state s: int = 6 b = new Source(width = 4) reaction(b.out) {= diff --git a/test/C/src/multiport/NestedBanks.lf b/test/C/src/multiport/NestedBanks.lf index b80ff2e606..bef08727f3 100644 --- a/test/C/src/multiport/NestedBanks.lf +++ b/test/C/src/multiport/NestedBanks.lf @@ -13,13 +13,13 @@ main reactor { (a.x)+ -> c.z, d.u, e.t } -reactor A(bank_index: int(0)) { +reactor A(bank_index: int = 0) { output[4] x: int b = new[2] B(a_bank_index = bank_index) b.y -> x } -reactor B(a_bank_index: int(0), bank_index: int(0)) { +reactor B(a_bank_index: int = 0, bank_index: int = 0) { output[2] y: int reaction(startup) -> y {= @@ -29,7 +29,7 @@ reactor B(a_bank_index: int(0), bank_index: int(0)) { =} } -reactor C(bank_index: int(0)) { +reactor C(bank_index: int = 0) { input[2] z: int f = new F(c_bank_index = bank_index) g = new G(c_bank_index = bank_index) @@ -59,7 +59,7 @@ reactor E { =} } -reactor F(c_bank_index: int(0)) { +reactor F(c_bank_index: int = 0) { input w: int reaction(w) {= @@ -70,7 +70,7 @@ reactor F(c_bank_index: int(0)) { =} } -reactor G(c_bank_index: int(0)) { +reactor G(c_bank_index: int = 0) { input s: int reaction(s) {= diff --git a/test/C/src/multiport/NestedInterleavedBanks.lf b/test/C/src/multiport/NestedInterleavedBanks.lf index 9f03313972..8e3056bd88 100644 --- a/test/C/src/multiport/NestedInterleavedBanks.lf +++ b/test/C/src/multiport/NestedInterleavedBanks.lf @@ -4,7 +4,7 @@ */ target C -reactor A(bank_index: int(0), outer_bank_index: int(0)) { +reactor A(bank_index: int = 0, outer_bank_index: int = 0) { output[2] p: int reaction(startup) -> p {= @@ -15,7 +15,7 @@ reactor A(bank_index: int(0), outer_bank_index: int(0)) { =} } -reactor B(bank_index: int(0)) { +reactor B(bank_index: int = 0) { output[4] q: int a = new[2] A(outer_bank_index = bank_index) interleaved (a.p) -> q diff --git a/test/C/src/multiport/ReactionToContainedBank.lf b/test/C/src/multiport/ReactionToContainedBank.lf index 3e0afa17d5..30f3f5564c 100644 --- a/test/C/src/multiport/ReactionToContainedBank.lf +++ b/test/C/src/multiport/ReactionToContainedBank.lf @@ -6,9 +6,9 @@ target C { import TestCount from "../lib/TestCount.lf" -main reactor ReactionToContainedBank(width: int(2)) { +main reactor ReactionToContainedBank(width: int = 2) { timer t(0, 100 msec) - state count: int(1) + state count: int = 1 test = new[width] TestCount(num_inputs = 11) diff --git a/test/C/src/multiport/ReactionToContainedBank2.lf b/test/C/src/multiport/ReactionToContainedBank2.lf index b7c7d1cf92..e03e884558 100644 --- a/test/C/src/multiport/ReactionToContainedBank2.lf +++ b/test/C/src/multiport/ReactionToContainedBank2.lf @@ -6,9 +6,9 @@ target C { import TestCount from "../lib/TestCount.lf" -reactor ReactionToContainedBank(width: int(2)) { +reactor ReactionToContainedBank(width: int = 2) { timer t(0, 100 msec) - state count: int(1) + state count: int = 1 test = new[width] TestCount(num_inputs = 11) @@ -20,7 +20,7 @@ reactor ReactionToContainedBank(width: int(2)) { =} } -main reactor(width: int(2)) { +main reactor(width: int = 2) { a = new ReactionToContainedBank(width = width) b = new ReactionToContainedBank(width = 4) } diff --git a/test/C/src/multiport/ReactionToContainedBankMultiport.lf b/test/C/src/multiport/ReactionToContainedBankMultiport.lf index 6a9e067ca1..d84b21c191 100644 --- a/test/C/src/multiport/ReactionToContainedBankMultiport.lf +++ b/test/C/src/multiport/ReactionToContainedBankMultiport.lf @@ -7,9 +7,9 @@ target C { import TestCountMultiport from "../lib/TestCountMultiport.lf" -main reactor(width: int(2)) { +main reactor(width: int = 2) { timer t(0, 100 msec) - state count: int(1) + state count: int = 1 test = new[width] TestCountMultiport(num_inputs = 11, width = width) diff --git a/test/C/src/multiport/ReactionsToNested.lf b/test/C/src/multiport/ReactionsToNested.lf index 102df10f8b..4270f55c2d 100644 --- a/test/C/src/multiport/ReactionsToNested.lf +++ b/test/C/src/multiport/ReactionsToNested.lf @@ -4,9 +4,9 @@ target C { timeout: 1 sec } -reactor T(expected: int(0)) { +reactor T(expected: int = 0) { input z: int - state received: bool(false) + state received: bool = false reaction(z) {= lf_print("T received %d", z->value); diff --git a/test/C/src/multiport/Sparse.lf b/test/C/src/multiport/Sparse.lf index eaa75782cb..537daabb4b 100644 --- a/test/C/src/multiport/Sparse.lf +++ b/test/C/src/multiport/Sparse.lf @@ -3,9 +3,9 @@ target C { timeout: 20 ms } -reactor SparseSource(width: int(20)) { +reactor SparseSource(width: int = 20) { output[width] out: int - state count: int(0) + state count: int = 0 timer t(0, 1 msec) reaction(t) -> out {= @@ -19,7 +19,7 @@ reactor SparseSource(width: int(20)) { =} } -reactor SparseSink(width: int(20)) { +reactor SparseSink(width: int = 20) { input[width] in: int reaction(in) {= @@ -43,7 +43,7 @@ reactor SparseSink(width: int(20)) { =} } -main reactor(width: int(20)) { +main reactor(width: int = 20) { s = new SparseSource(width = width) d = new SparseSink(width = width) s.out -> d.in diff --git a/test/C/src/multiport/SparseFallback.lf b/test/C/src/multiport/SparseFallback.lf index 195dca1f19..a7788858d8 100644 --- a/test/C/src/multiport/SparseFallback.lf +++ b/test/C/src/multiport/SparseFallback.lf @@ -6,9 +6,9 @@ target C { timeout: 20 ms } -reactor SparseSource(width: int(20)) { +reactor SparseSource(width: int = 20) { output[width] out: int - state count: int(0) + state count: int = 0 timer t(0, 1 msec) reaction(t) -> out {= @@ -22,7 +22,7 @@ reactor SparseSource(width: int(20)) { =} } -reactor SparseSink(width: int(20)) { +reactor SparseSink(width: int = 20) { input[width] in: int reaction(in) {= @@ -46,7 +46,7 @@ reactor SparseSink(width: int(20)) { =} } -main reactor(width: int(10)) { +main reactor(width: int = 10) { s = new SparseSource(width = width) d = new SparseSink(width = width) s.out -> d.in diff --git a/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf b/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf index c696261db7..917982af39 100644 --- a/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf +++ b/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf @@ -10,7 +10,7 @@ target C { reactor Source { output a: int output b: int - state count: int(0) + state count: int = 0 timer t(0, 200 msec) reaction(t) -> a, b {= diff --git a/test/C/src/serialization/ROSBuiltInSerialization.lf b/test/C/src/serialization/ROSBuiltInSerialization.lf index d573b23cce..095aadacd2 100644 --- a/test/C/src/serialization/ROSBuiltInSerialization.lf +++ b/test/C/src/serialization/ROSBuiltInSerialization.lf @@ -32,7 +32,7 @@ reactor Sender { output out: std_msgs::msg::Int32 // state serialized_msg_pcl:rclcpp::SerializedMessage({=0u=}); - state count: int(0) + state count: int = 0 timer t(0, 1 sec) @@ -45,7 +45,7 @@ reactor Sender { reactor Receiver { input in: std_msgs::msg::Int32 - state count: int(0) + state count: int = 0 reaction(in) {= // Print the ROS2 message data diff --git a/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf b/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf index 4726809c57..97b5a12554 100644 --- a/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf +++ b/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf @@ -31,7 +31,7 @@ preamble {= reactor Sender { output out: std::shared_ptr - state count: int(0) + state count: int = 0 timer t(0, 1 sec) @@ -44,7 +44,7 @@ reactor Sender { reactor Receiver { input in: std::shared_ptr - state count: int(0) + state count: int = 0 reaction(in) {= // Print the ROS2 message data diff --git a/test/C/src/target/HelloWorldCCPP.lf b/test/C/src/target/HelloWorldCCPP.lf index 0b0e54ed52..91d1cd61d1 100644 --- a/test/C/src/target/HelloWorldCCPP.lf +++ b/test/C/src/target/HelloWorldCCPP.lf @@ -11,7 +11,7 @@ reactor HelloWorld { preamble {= #include =} - state success: bool(false) + state success: bool = false reaction(startup) {= std::cout << "Hello World." << std::endl; diff --git a/test/C/src/token/TokenContainedPrint.lf b/test/C/src/token/TokenContainedPrint.lf index 0d4b19379d..29e6005c4c 100644 --- a/test/C/src/token/TokenContainedPrint.lf +++ b/test/C/src/token/TokenContainedPrint.lf @@ -9,7 +9,7 @@ target C { import TokenPrint from "lib/Token.lf" main reactor { - state count: int(0) + state count: int = 0 timer t(0, 1 ms) p = new TokenPrint() diff --git a/test/C/src/token/TokenContainedPrintBank.lf b/test/C/src/token/TokenContainedPrintBank.lf index b23eb1c109..991a94b5a7 100644 --- a/test/C/src/token/TokenContainedPrintBank.lf +++ b/test/C/src/token/TokenContainedPrintBank.lf @@ -10,7 +10,7 @@ target C { import TokenPrint from "lib/Token.lf" main reactor { - state count: int(0) + state count: int = 0 timer t(0, 1 ms) p = new[2] TokenPrint() diff --git a/test/C/src/token/TokenContainedSource.lf b/test/C/src/token/TokenContainedSource.lf index 9bf517bc18..66095b8a0b 100644 --- a/test/C/src/token/TokenContainedSource.lf +++ b/test/C/src/token/TokenContainedSource.lf @@ -9,9 +9,9 @@ target C { import TokenSource from "lib/Token.lf" -main reactor(scale: int(1)) { - state count: int(0) - state input_received: bool(false) +main reactor(scale: int = 1) { + state count: int = 0 + state input_received: bool = false s = new TokenSource() diff --git a/test/C/src/token/TokenContainedSourceBank.lf b/test/C/src/token/TokenContainedSourceBank.lf index f1faee87dd..615695890b 100644 --- a/test/C/src/token/TokenContainedSourceBank.lf +++ b/test/C/src/token/TokenContainedSourceBank.lf @@ -10,9 +10,9 @@ target C { import TokenSource from "lib/Token.lf" -main reactor(scale: int(1)) { - state count: int(0) - state input_received: bool(false) +main reactor(scale: int = 1) { + state count: int = 0 + state input_received: bool = false s = new[2] TokenSource() diff --git a/test/C/src/token/lib/Token.lf b/test/C/src/token/lib/Token.lf index 4e49cd0006..7b8d2a83ee 100644 --- a/test/C/src/token/lib/Token.lf +++ b/test/C/src/token/lib/Token.lf @@ -20,7 +20,7 @@ preamble {= */ reactor TokenSource { output out: int_array_t* - state count: int(0) + state count: int = 0 timer t(0, 1 ms) reaction(startup) -> out {= @@ -42,10 +42,10 @@ reactor TokenSource { * value is a scaled version of the sequence of values produced by the * TokenSource, where the scaling factor is given by the scale parameter. */ -reactor TokenPrint(scale: int(1)) { +reactor TokenPrint(scale: int = 1) { input in: int_array_t* - state count: int(0) - state input_received: bool(false) + state count: int = 0 + state input_received: bool = false reaction(in) {= self->input_received = true; @@ -79,7 +79,7 @@ reactor TokenPrint(scale: int(1)) { * input is declared mutable so, if possible, the input token will be modified * rather than allocating a new token. */ -reactor TokenScale(scale: int(2)) { +reactor TokenScale(scale: int = 2) { mutable input in: int_array_t* output out: int_array_t* diff --git a/test/Python/src/AfterOverlapped.lf b/test/Python/src/AfterOverlapped.lf index 2876538189..32657f1cdb 100644 --- a/test/Python/src/AfterOverlapped.lf +++ b/test/Python/src/AfterOverlapped.lf @@ -8,8 +8,8 @@ import Count from "lib/Count.lf" reactor Test { input c - state i(0) - state received(0) + state i = 0 + state received = 0 reaction(c) {= self.received += 1 diff --git a/test/Python/src/ArrayAsParameter.lf b/test/Python/src/ArrayAsParameter.lf index 67af462358..359e38b7a3 100644 --- a/test/Python/src/ArrayAsParameter.lf +++ b/test/Python/src/ArrayAsParameter.lf @@ -3,7 +3,7 @@ target Python reactor Source(sequence(0, 1, 2)) { output out - state count(0) + state count = 0 logical action next reaction(startup, next) -> out, next {= @@ -16,8 +16,8 @@ reactor Source(sequence(0, 1, 2)) { reactor Print { input _in - state count(1) - state received(0) + state count = 1 + state received = 0 reaction(_in) {= self.received+=1 @@ -36,7 +36,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence = (1, 2, 3, 4)) + s = new Source(sequence(1, 2, 3, 4)) p = new Print() s.out -> p._in } diff --git a/test/Python/src/ArrayScale.lf b/test/Python/src/ArrayScale.lf index 620b63e10f..2b69aebe77 100644 --- a/test/Python/src/ArrayScale.lf +++ b/test/Python/src/ArrayScale.lf @@ -6,7 +6,7 @@ target Python import Print, Source from "ArrayPrint.lf" -reactor Scale(scale(2)) { +reactor Scale(scale = 2) { mutable input _in output out diff --git a/test/Python/src/DeadlineHandledAbove.lf b/test/Python/src/DeadlineHandledAbove.lf index d3df675152..ef8510ee67 100644 --- a/test/Python/src/DeadlineHandledAbove.lf +++ b/test/Python/src/DeadlineHandledAbove.lf @@ -4,7 +4,7 @@ target Python preamble {= import time =} -reactor Deadline(threshold(100 msec)) { +reactor Deadline(threshold = 100 msec) { input x output deadline_violation @@ -18,7 +18,7 @@ reactor Deadline(threshold(100 msec)) { } main reactor DeadlineHandledAbove { - state violation_detected(false) + state violation_detected = false d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/Python/src/DelayArray.lf b/test/Python/src/DelayArray.lf index abcf367d45..945b786cca 100644 --- a/test/Python/src/DelayArray.lf +++ b/test/Python/src/DelayArray.lf @@ -1,7 +1,7 @@ # This tests delaying an array type. target Python -reactor DelayPointer(delay(100 msec)) { +reactor DelayPointer(delay = 100 msec) { # The Python target does not require explicit type allocation for types # other than time mutable input _in @@ -25,7 +25,7 @@ reactor Source { =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input _in reaction(_in) {= diff --git a/test/Python/src/DelayArrayWithAfter.lf b/test/Python/src/DelayArrayWithAfter.lf index e244690ec8..1e6ac1f317 100644 --- a/test/Python/src/DelayArrayWithAfter.lf +++ b/test/Python/src/DelayArrayWithAfter.lf @@ -7,7 +7,7 @@ target Python { reactor Source { output out - state iteration(1) + state iteration = 1 timer t(0, 1 sec) reaction(t) -> out {= @@ -18,10 +18,10 @@ reactor Source { =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input _in - state iteration(1) - state inputs_received(0) + state iteration = 1 + state inputs_received = 0 reaction(_in) {= self.inputs_received += 1 diff --git a/test/Python/src/DelayStruct.lf b/test/Python/src/DelayStruct.lf index f16aedfe7c..e578a42699 100644 --- a/test/Python/src/DelayStruct.lf +++ b/test/Python/src/DelayStruct.lf @@ -5,7 +5,7 @@ target Python { preamble {= import hello =} -reactor DelayPointer(delay(100 msec)) { +reactor DelayPointer(delay = 100 msec) { input _in output out logical action a @@ -25,7 +25,7 @@ reactor Source { reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} } -reactor Print(expected(42)) { # expected parameter is for testing. +reactor Print(expected = 42) { # expected parameter is for testing. input _in reaction(_in) {= diff --git a/test/Python/src/Hello.lf b/test/Python/src/Hello.lf index 0da0d53f47..271ed180ca 100644 --- a/test/Python/src/Hello.lf +++ b/test/Python/src/Hello.lf @@ -8,9 +8,9 @@ target Python { fast: true } -reactor Reschedule(period(2 sec), message("Hello Python")) { - state count(0) - state previous_time(0) +reactor Reschedule(period = 2 sec, message = "Hello Python") { + state count = 0 + state previous_time = 0 timer t(1 sec, period) logical action a @@ -38,7 +38,7 @@ reactor Reschedule(period(2 sec), message("Hello Python")) { =} } -reactor Inside(period(1 sec), message("Composite default message.")) { +reactor Inside(period = 1 sec, message = "Composite default message.") { third_instance = new Reschedule(period = period, message = message) } diff --git a/test/Python/src/HelloWorld.lf b/test/Python/src/HelloWorld.lf index 725a73d0ac..523ff9ce2b 100644 --- a/test/Python/src/HelloWorld.lf +++ b/test/Python/src/HelloWorld.lf @@ -3,7 +3,7 @@ target Python { } reactor HelloWorld2 { - state success(False) + state success = False reaction(startup) {= print("Hello World.") diff --git a/test/Python/src/ImportComposition.lf b/test/Python/src/ImportComposition.lf index 4e57dc6423..bf3a92eb06 100644 --- a/test/Python/src/ImportComposition.lf +++ b/test/Python/src/ImportComposition.lf @@ -6,7 +6,7 @@ import ImportedComposition from "lib/ImportedComposition.lf" main reactor ImportComposition { a = new ImportedComposition() - state received(false) + state received = false reaction(startup) -> a.x {= a.x.set(42) =} diff --git a/test/Python/src/Methods.lf b/test/Python/src/Methods.lf index cc29079dad..5e0023fe8f 100644 --- a/test/Python/src/Methods.lf +++ b/test/Python/src/Methods.lf @@ -2,7 +2,7 @@ target Python main reactor { - state foo(2) + state foo = 2 method getFoo() {= return self.foo =} diff --git a/test/Python/src/MovingAverage.lf b/test/Python/src/MovingAverage.lf index 505b6a043d..3dbd5636c3 100644 --- a/test/Python/src/MovingAverage.lf +++ b/test/Python/src/MovingAverage.lf @@ -10,7 +10,7 @@ import TestDouble from "lib/Test.lf" reactor MASource { output out - state count(0) + state count = 0 timer clock(0, 200 msec) reaction(clock) -> out {= @@ -21,7 +21,7 @@ reactor MASource { reactor MovingAverageImpl { state delay_line(0.0, 0.0, 0.0) - state index(0) + state index = 0 input m_in output out @@ -45,7 +45,7 @@ reactor MovingAverageImpl { main reactor MovingAverage { s = new MASource() m = new MovingAverageImpl() - p = new TestDouble(expected = (0.0, 0.25, 0.75, 1.5, 2.5, 3.5)) + p = new TestDouble(expected(0.0, 0.25, 0.75, 1.5, 2.5, 3.5)) s.out -> m.m_in m.out -> p.t_in } diff --git a/test/Python/src/ParameterizedState.lf b/test/Python/src/ParameterizedState.lf index 3511c8d2f5..e8805b027f 100644 --- a/test/Python/src/ParameterizedState.lf +++ b/test/Python/src/ParameterizedState.lf @@ -1,7 +1,7 @@ target Python -reactor Foo(bar(42)) { - state baz(bar) +reactor Foo(bar = 42) { + state baz = bar reaction(startup) {= print("Baz: ", self.baz) =} } diff --git a/test/Python/src/SlowingClockPhysical.lf b/test/Python/src/SlowingClockPhysical.lf index b2533acf12..dbb9da705f 100644 --- a/test/Python/src/SlowingClockPhysical.lf +++ b/test/Python/src/SlowingClockPhysical.lf @@ -15,8 +15,8 @@ target Python { main reactor SlowingClockPhysical { # first offset and minimum interarrival time. physical action a(100 msec, 100 msec) - state interval(100 msec) - state expected_time(100 msec) + state interval = 100 msec + state expected_time = 100 msec reaction(startup) -> a {= self.expected_time = MSEC(100) diff --git a/test/Python/src/StructAsType.lf b/test/Python/src/StructAsType.lf index d8955d0064..46951ec86a 100644 --- a/test/Python/src/StructAsType.lf +++ b/test/Python/src/StructAsType.lf @@ -13,7 +13,7 @@ reactor Source { =} } -reactor Print(expected(42)) { # expected parameter is for testing. +reactor Print(expected = 42) { # expected parameter is for testing. input _in reaction(_in) {= diff --git a/test/Python/src/StructParallel.lf b/test/Python/src/StructParallel.lf index fb34a84981..bac79a6abe 100644 --- a/test/Python/src/StructParallel.lf +++ b/test/Python/src/StructParallel.lf @@ -8,7 +8,7 @@ import Source from "StructScale.lf" preamble {= import hello =} -reactor Check(expected(42)) { +reactor Check(expected = 42) { input _in reaction(_in) {= @@ -19,7 +19,7 @@ reactor Check(expected(42)) { =} } -reactor Print(scale(2)) { +reactor Print(scale = 2) { # Mutable keyword indicates that this reactor wants a writable copy of the # input. mutable input _in diff --git a/test/Python/src/TimeLimit.lf b/test/Python/src/TimeLimit.lf index 47577e9ed5..beb7602db9 100644 --- a/test/Python/src/TimeLimit.lf +++ b/test/Python/src/TimeLimit.lf @@ -5,10 +5,10 @@ target Python { fast: true } -reactor Clock(offset(0), period(1 sec)) { +reactor Clock(offset = 0, period = 1 sec) { output y timer t(offset, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -19,7 +19,7 @@ reactor Clock(offset(0), period(1 sec)) { reactor Destination { input x - state s(1) + state s = 1 reaction(x) {= # print(x.value) @@ -37,7 +37,7 @@ reactor Destination { =} } -main reactor TimeLimit(period(1 sec)) { +main reactor TimeLimit(period = 1 sec) { timer stop(10 sec) c = new Clock(period = period) d = new Destination() diff --git a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf index 960a06c650..48ff7a4ca7 100644 --- a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf +++ b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf @@ -12,10 +12,10 @@ target Python { } # reason for failing: lf_tag() not supported by the python target -reactor Clock(offset(0), period(1 sec)) { +reactor Clock(offset = 0, period = 1 sec) { output y timer t(offset, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -29,7 +29,7 @@ reactor Clock(offset(0), period(1 sec)) { reactor Destination { preamble {= import sys =} input x - state s(1) + state s = 1 state startup_logical_time reaction(startup) {= self.startup_logical_time = lf.time.logical() =} @@ -50,7 +50,7 @@ reactor Destination { =} } -federated reactor(period(10 usec)) { +federated reactor(period = 10 usec) { c = new Clock(period = period) d = new Destination() c.y -> d.x diff --git a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf index c9de7270c6..4eb881694f 100644 --- a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf +++ b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf @@ -12,10 +12,10 @@ target Python { coordination: decentralized } -reactor Clock(offset(0), period(1 sec)) { +reactor Clock(offset = 0, period = 1 sec) { output y timer t(offset, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -28,7 +28,7 @@ reactor Clock(offset(0), period(1 sec)) { reactor Destination { preamble {= import sys =} input x - state s(1) + state s = 1 reaction(x) {= if x.value != self.s: @@ -43,7 +43,7 @@ reactor Destination { =} } -federated reactor(period(10 usec)) { +federated reactor(period = 10 usec) { c = new Clock(period = period) d = new Destination() c.y ~> d.x diff --git a/test/Python/src/federated/DistributedBank.lf b/test/Python/src/federated/DistributedBank.lf index ace6b6b53c..de9ea298e4 100644 --- a/test/Python/src/federated/DistributedBank.lf +++ b/test/Python/src/federated/DistributedBank.lf @@ -7,7 +7,7 @@ target Python { reactor Node { preamble {= import sys =} timer t(0, 100 msec) - state count(0) + state count = 0 reaction(t) {= print("Hello world {}.".format(self.count)) diff --git a/test/Python/src/federated/DistributedCount.lf b/test/Python/src/federated/DistributedCount.lf index eb90b4d672..7713256520 100644 --- a/test/Python/src/federated/DistributedCount.lf +++ b/test/Python/src/federated/DistributedCount.lf @@ -15,7 +15,7 @@ import Count from "../lib/Count.lf" reactor Print { preamble {= import sys =} input in_ - state c(1) + state c = 1 reaction(in_) {= elapsed_time = lf.time.logical_elapsed() @@ -36,7 +36,7 @@ reactor Print { =} } -federated reactor DistributedCount(offset(200 msec)) { +federated reactor DistributedCount(offset = 200 msec) { c = new Count() p = new Print() c.out -> p.in_ after offset diff --git a/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf b/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf index e9a1bec87e..d806ab5453 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf @@ -21,7 +21,7 @@ reactor Receiver { # Force a timer to be invoke periodically timer t(0, 10 msec) # to ensure logical time will advance in the absence of incoming messages. - state c(0) + state c = 0 p = new Print() a = new ImportantActuator() inp -> p.inp diff --git a/test/Python/src/federated/DistributedDoublePort.lf b/test/Python/src/federated/DistributedDoublePort.lf index 03ad2c4d08..9eb24209e6 100644 --- a/test/Python/src/federated/DistributedDoublePort.lf +++ b/test/Python/src/federated/DistributedDoublePort.lf @@ -14,7 +14,7 @@ target Python { import Count from "../lib/Count.lf" reactor CountMicrostep { - state count(1) + state count = 1 output out logical action act timer t(0, 1 sec) diff --git a/test/Python/src/federated/DistributedMultiportToBank.lf b/test/Python/src/federated/DistributedMultiportToBank.lf index cbd500394e..69c87b7f0c 100644 --- a/test/Python/src/federated/DistributedMultiportToBank.lf +++ b/test/Python/src/federated/DistributedMultiportToBank.lf @@ -6,7 +6,7 @@ target Python { reactor Source { output[2] out timer t(0, 100 msec) - state count(0) + state count = 0 reaction(t) -> out {= for i in range(len(out)): @@ -18,7 +18,7 @@ reactor Source { reactor Destination { preamble {= import sys =} input in_ - state count(0) + state count = 0 reaction(in_) {= print("Received {}.".format(in_.value)) diff --git a/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf b/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf index 9dc86b3c60..2719fd57ba 100644 --- a/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf +++ b/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf @@ -14,11 +14,11 @@ target Python { timeout: 5 sec } -reactor Contained(incr(1)) { +reactor Contained(incr = 1) { timer t(0, 1 sec) input inp - state count(0) - state received_count(0) + state count = 0 + state received_count = 0 reaction(t) {= self.count += self.incr =} @@ -31,10 +31,10 @@ reactor Contained(incr(1)) { =} } -reactor Looper(incr(1), delay(0 msec)) { +reactor Looper(incr = 1, delay = 0 msec) { input inp output out - state count(0) + state count = 0 timer t(0, 1 sec) c = new Contained(incr = incr) @@ -59,7 +59,7 @@ reactor Looper(incr(1), delay(0 msec)) { =} } -federated reactor(delay(0)) { +federated reactor(delay = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.inp diff --git a/test/Python/src/federated/PhysicalSTP.lf b/test/Python/src/federated/PhysicalSTP.lf index 75e5071bca..5edc61df34 100644 --- a/test/Python/src/federated/PhysicalSTP.lf +++ b/test/Python/src/federated/PhysicalSTP.lf @@ -9,10 +9,10 @@ target Python { import Count from "../lib/Count.lf" -reactor Print(STP_offset(0)) { +reactor Print(STP_offset = 0) { preamble {= import sys =} input in_ - state c(1) + state c = 1 reaction(in_) {= elapsed_time = lf.time.logical_elapsed() diff --git a/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf b/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf index 9068ebfae8..12367332f4 100644 --- a/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf +++ b/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf @@ -16,11 +16,11 @@ target Python { timeout: 5 sec } -reactor Looper(incr(1), delay(0 msec)) { +reactor Looper(incr = 1, delay = 0 msec) { input in_ output out - state count(0) - state received_count(0) + state count = 0 + state received_count = 0 timer t(0, 1 sec) reaction(t) -> out {= @@ -50,7 +50,7 @@ reactor Looper(incr(1), delay(0 msec)) { =} } -federated reactor(delay(0)) { +federated reactor(delay = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in_ diff --git a/test/Python/src/federated/failing/LoopDistributedDouble.lf b/test/Python/src/federated/failing/LoopDistributedDouble.lf index 8788d09288..4ccee4acd6 100644 --- a/test/Python/src/federated/failing/LoopDistributedDouble.lf +++ b/test/Python/src/federated/failing/LoopDistributedDouble.lf @@ -24,13 +24,13 @@ preamble {= } =} -reactor Looper(incr(1), delay(0 msec)) { +reactor Looper(incr = 1, delay = 0 msec) { input in_ input in2 output out output out2 physical action a(delay) - state count(0) + state count = 0 timer t(0, 1 sec) reaction(startup) -> a {= @@ -79,7 +79,7 @@ reactor Looper(incr(1), delay(0 msec)) { =} } -federated reactor(delay(0)) { +federated reactor(delay = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.in_ diff --git a/test/Python/src/modal_models/ConvertCaseTest.lf b/test/Python/src/modal_models/ConvertCaseTest.lf index f391660322..f3bdee59fe 100644 --- a/test/Python/src/modal_models/ConvertCaseTest.lf +++ b/test/Python/src/modal_models/ConvertCaseTest.lf @@ -67,9 +67,9 @@ reactor Converter { } } -reactor InputFeeder(message("")) { +reactor InputFeeder(message = "") { output character - state idx(0) + state idx = 0 timer t(0, 250 msec) diff --git a/test/Python/src/modal_models/Count3Modes.lf b/test/Python/src/modal_models/Count3Modes.lf index e512e7d54a..7e2e9d98e2 100644 --- a/test/Python/src/modal_models/Count3Modes.lf +++ b/test/Python/src/modal_models/Count3Modes.lf @@ -34,7 +34,7 @@ main reactor { timer stepper(0, 250 msec) counter = new CounterCycle() - state expected_value(1) + state expected_value = 1 reaction(stepper) -> counter.next {= counter.next.set(True) =} # Trigger diff --git a/test/Python/src/modal_models/ModalAfter.lf b/test/Python/src/modal_models/ModalAfter.lf index c86002c9fa..19c84f33d5 100644 --- a/test/Python/src/modal_models/ModalAfter.lf +++ b/test/Python/src/modal_models/ModalAfter.lf @@ -45,7 +45,7 @@ reactor Modal { } } -reactor Producer(mode_id(0)) { +reactor Producer(mode_id = 0) { output product timer t(0, 750 msec) @@ -56,7 +56,7 @@ reactor Producer(mode_id(0)) { =} } -reactor Consumer(mode_id(0)) { +reactor Consumer(mode_id = 0) { input product output report diff --git a/test/Python/src/modal_models/ModalCycleBreaker.lf b/test/Python/src/modal_models/ModalCycleBreaker.lf index baafdf8378..1ceb2eb5d0 100644 --- a/test/Python/src/modal_models/ModalCycleBreaker.lf +++ b/test/Python/src/modal_models/ModalCycleBreaker.lf @@ -39,11 +39,11 @@ reactor Modal { } } -reactor Counter(period(1 sec)) { +reactor Counter(period = 1 sec) { output value timer t(0, period) - state curval(0) + state curval = 0 reaction(t) -> value {= value.set(self.curval) diff --git a/test/Python/src/modal_models/ModalStateReset.lf b/test/Python/src/modal_models/ModalStateReset.lf index 9bd969b15c..11b7425b63 100644 --- a/test/Python/src/modal_models/ModalStateReset.lf +++ b/test/Python/src/modal_models/ModalStateReset.lf @@ -14,7 +14,7 @@ reactor Modal { output count1 output count2 - state counter0(0) + state counter0 = 0 reaction(next) -> count0 {= print(f"Counter0: {self.counter0}") @@ -23,7 +23,7 @@ reactor Modal { =} initial mode One { - state counter1(0) + state counter1 = 0 timer T1(0 msec, 250 msec) reaction(reset) {= self.counter1 = 0 =} @@ -41,7 +41,7 @@ reactor Modal { } mode Two { - state counter2(-2) + state counter2 = -2 timer T2(0 msec, 250 msec) reaction(reset) {= self.counter2 = -2 =} diff --git a/test/Python/src/modal_models/ModalStateResetAuto.lf b/test/Python/src/modal_models/ModalStateResetAuto.lf index be664676db..492e12259b 100644 --- a/test/Python/src/modal_models/ModalStateResetAuto.lf +++ b/test/Python/src/modal_models/ModalStateResetAuto.lf @@ -14,7 +14,7 @@ reactor Modal { output count1 output count2 - state counter0(0) + state counter0 = 0 reaction(next) -> count0 {= print(f"Counter0: {self.counter0}") @@ -23,7 +23,7 @@ reactor Modal { =} initial mode One { - state counter1(0) + state counter1 = 0 timer T1(0 msec, 250 msec) reaction(T1) -> count1 {= print(f"Counter1: {self.counter1}") @@ -39,7 +39,7 @@ reactor Modal { } mode Two { - reset state counter2(-2) + reset state counter2 = -2 timer T2(0 msec, 250 msec) reaction(T2) -> count2 {= print(f"Counter2: {self.counter2}") diff --git a/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf b/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf index 5654dd9b1e..3dd42f67ce 100644 --- a/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf +++ b/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf @@ -28,11 +28,11 @@ reactor Modal { } } -reactor Counter(period(1 sec)) { +reactor Counter(period = 1 sec) { output value timer t(0, period) - reset state curval(0) + reset state curval = 0 reaction(t) -> value {= value.set(self.curval) diff --git a/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf b/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf index 80c4247972..86f5668357 100644 --- a/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf +++ b/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf @@ -31,11 +31,11 @@ reactor Modal { } } -reactor Counter(period(1 sec)) { +reactor Counter(period = 1 sec) { output value timer t(0, period) - reset state curval(0) + reset state curval = 0 reaction(t) -> value {= value.set(self.curval) diff --git a/test/Python/src/modal_models/util/TraceTesting.lf b/test/Python/src/modal_models/util/TraceTesting.lf index 1014ac3c8d..305ff31a5b 100644 --- a/test/Python/src/modal_models/util/TraceTesting.lf +++ b/test/Python/src/modal_models/util/TraceTesting.lf @@ -1,13 +1,13 @@ /** Utility reactor to record and test execution traces. */ target Python -reactor TraceTesting(events_size(0), trace({= [] =}), training(False)) { +reactor TraceTesting(events_size = 0, trace = {= [] =}, training = False) { input[events_size] events - state last_reaction_time(0) - state trace_idx(0) - state recorded_events({= [] =}) - state recorded_events_next(0) + state last_reaction_time = 0 + state trace_idx = 0 + state recorded_events = {= [] =} + state recorded_events_next = 0 reaction(startup) {= self.last_reaction_time = lf.time.logical() =} From 99fdf82ea895c1792b0a671960e76fa0a4e83c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Feb 2023 18:09:08 +0100 Subject: [PATCH 07/49] Format remaining tests --- test/TypeScript/src/ActionDelay.lf | 2 +- test/TypeScript/src/After.lf | 2 +- test/TypeScript/src/ArrayAsParameter.lf | 6 +++--- test/TypeScript/src/ArrayAsType.lf | 2 +- test/TypeScript/src/ArrayPrint.lf | 2 +- test/TypeScript/src/ArrayScale.lf | 2 +- test/TypeScript/src/Composition.lf | 6 +++--- test/TypeScript/src/CompositionAfter.lf | 8 ++++---- test/TypeScript/src/CountTest.lf | 2 +- test/TypeScript/src/Deadline.lf | 8 ++++---- test/TypeScript/src/DeadlineHandledAbove.lf | 4 ++-- test/TypeScript/src/DelayInt.lf | 6 +++--- test/TypeScript/src/DelayedAction.lf | 2 +- test/TypeScript/src/DoubleInvocation.lf | 4 ++-- test/TypeScript/src/DoubleReaction.lf | 6 +++--- test/TypeScript/src/DoubleTrigger.lf | 2 +- test/TypeScript/src/FloatLiteral.lf | 8 ++++---- test/TypeScript/src/Gain.lf | 4 ++-- test/TypeScript/src/Hello.lf | 10 +++++----- test/TypeScript/src/Hierarchy2.lf | 4 ++-- test/TypeScript/src/MovingAverage.lf | 8 ++++---- test/TypeScript/src/NativeListsAndTimes.lf | 14 +++++++------- test/TypeScript/src/ParameterizedState.lf | 4 ++-- test/TypeScript/src/PeriodicDesugared.lf | 4 ++-- .../TypeScript/src/ReadOutputOfContainedReactor.lf | 2 +- test/TypeScript/src/ScheduleLogicalAction.lf | 2 +- test/TypeScript/src/SendingInside.lf | 4 ++-- test/TypeScript/src/SendsPointerTest.lf | 2 +- test/TypeScript/src/SimpleDeadline.lf | 2 +- test/TypeScript/src/SlowingClock.lf | 4 ++-- test/TypeScript/src/SlowingClockPhysical.lf | 4 ++-- test/TypeScript/src/Stop.lf | 2 +- test/TypeScript/src/Stride.lf | 4 ++-- test/TypeScript/src/StructAsState.lf | 2 +- test/TypeScript/src/StructAsType.lf | 2 +- test/TypeScript/src/StructAsTypeDirect.lf | 2 +- test/TypeScript/src/StructPrint.lf | 2 +- test/TypeScript/src/StructScale.lf | 2 +- test/TypeScript/src/TimeLimit.lf | 8 ++++---- test/TypeScript/src/TimeState.lf | 4 ++-- test/TypeScript/src/concurrent/AsyncCallback.lf | 6 +++--- .../federated/DistributedCountContainerized.lf | 2 +- test/TypeScript/src/federated/DistributedCount.lf | 4 ++-- .../src/federated/DistributedDoublePort.lf | 2 +- .../src/federated/DistributedLoopedAction.lf | 8 ++++---- .../federated/DistributedLoopedPhysicalAction.lf | 12 ++++++------ test/TypeScript/src/federated/DistributedStop.lf | 6 +++--- test/TypeScript/src/federated/HelloDistributed.lf | 2 +- .../src/federated/LoopDistributedCentralized.lf | 6 +++--- .../src/federated/LoopDistributedDouble.lf | 6 +++--- .../src/federated/PingPongDistributed.lf | 10 +++++----- test/TypeScript/src/federated/TopLevelArtifacts.lf | 2 +- test/TypeScript/src/lib/Count.lf | 4 ++-- test/TypeScript/src/lib/InternalDelay.lf | 2 +- test/TypeScript/src/lib/LoopedActionSender.lf | 4 ++-- test/TypeScript/src/lib/TestCount.lf | 10 +++++++--- .../src/multiport/BankMultiportToReaction.lf | 4 ++-- .../src/multiport/BankReactionsInContainer.lf | 4 ++-- test/TypeScript/src/multiport/BankSelfBroadcast.lf | 2 +- test/TypeScript/src/multiport/BankToBank.lf | 6 +++--- .../src/multiport/BankToBankMultiport.lf | 10 +++++----- .../src/multiport/BankToBankMultiportAfter.lf | 10 +++++----- test/TypeScript/src/multiport/BankToMultiport.lf | 2 +- test/TypeScript/src/multiport/BankToReaction.lf | 2 +- test/TypeScript/src/multiport/BroadcastAfter.lf | 2 +- .../src/multiport/BroadcastMultipleAfter.lf | 4 ++-- test/TypeScript/src/multiport/FullyConnected.lf | 6 +++--- test/TypeScript/src/multiport/MultiportFromBank.lf | 6 +++--- .../src/multiport/MultiportFromBankHierarchy.lf | 2 +- .../src/multiport/MultiportFromHierarchy.lf | 14 +++++++------- .../src/multiport/MultiportFromReaction.lf | 8 ++++---- test/TypeScript/src/multiport/MultiportIn.lf | 4 ++-- .../src/multiport/MultiportInParameterized.lf | 6 +++--- .../src/multiport/MultiportMutableInput.lf | 4 ++-- .../src/multiport/MultiportMutableInputArray.lf | 4 ++-- test/TypeScript/src/multiport/MultiportOut.lf | 4 ++-- .../src/multiport/MultiportToBankAfter.lf | 6 +++--- .../src/multiport/MultiportToBankDouble.lf | 2 +- .../src/multiport/MultiportToBankHierarchy.lf | 2 +- .../src/multiport/MultiportToHierarchy.lf | 12 ++++++------ .../src/multiport/MultiportToMultiport.lf | 2 +- .../src/multiport/MultiportToMultiport2.lf | 4 ++-- .../src/multiport/MultiportToMultiport2After.lf | 4 ++-- .../src/multiport/MultiportToMultiportArray.lf | 4 ++-- .../src/multiport/MultiportToMultiportParameter.lf | 10 +++++----- test/TypeScript/src/multiport/MultiportToPort.lf | 4 ++-- .../src/multiport/MultiportToReaction.lf | 6 +++--- test/TypeScript/src/multiport/NestedBanks.lf | 6 +++--- .../src/multiport/ReactionToContainedBank.lf | 4 ++-- test/TypeScript/src/multiport/ReactionsToNested.lf | 4 ++-- test/TypeScript/src/target/AfterNoTypes.lf | 2 +- 91 files changed, 217 insertions(+), 213 deletions(-) diff --git a/test/TypeScript/src/ActionDelay.lf b/test/TypeScript/src/ActionDelay.lf index 387e0331de..5882d18962 100644 --- a/test/TypeScript/src/ActionDelay.lf +++ b/test/TypeScript/src/ActionDelay.lf @@ -4,7 +4,7 @@ target TypeScript reactor GeneratedDelay { input y_in: number output y_out: number - state y_state: number(0) + state y_state: number = 0 logical action act(100 msec) reaction(y_in) -> act {= diff --git a/test/TypeScript/src/After.lf b/test/TypeScript/src/After.lf index 24aa2cdb29..8a872103e9 100644 --- a/test/TypeScript/src/After.lf +++ b/test/TypeScript/src/After.lf @@ -13,7 +13,7 @@ reactor Foo { } reactor Print { - state expected_time: time(10 msec) + state expected_time: time = 10 msec input x: number reaction(x) {= diff --git a/test/TypeScript/src/ArrayAsParameter.lf b/test/TypeScript/src/ArrayAsParameter.lf index 7f5e272d46..1fd7e47bb3 100644 --- a/test/TypeScript/src/ArrayAsParameter.lf +++ b/test/TypeScript/src/ArrayAsParameter.lf @@ -1,9 +1,9 @@ // Source has an array as a parameter, the elements of which it passes to Print. target TypeScript -reactor Source(sequence: {= Array =}({= [0, 1, 2] =})) { +reactor Source(sequence: {= Array =} = {= [0, 1, 2] =}) { output out: number - state count: number(0) + state count: number = 0 logical action next reaction(startup, next) -> out, next {= @@ -17,7 +17,7 @@ reactor Source(sequence: {= Array =}({= [0, 1, 2] =})) { reactor Print { input x: number - state count: number(1) + state count: number = 1 reaction(x) {= console.log("Received: " + x + "."); diff --git a/test/TypeScript/src/ArrayAsType.lf b/test/TypeScript/src/ArrayAsType.lf index 651dc37f29..9e30764307 100644 --- a/test/TypeScript/src/ArrayAsType.lf +++ b/test/TypeScript/src/ArrayAsType.lf @@ -15,7 +15,7 @@ reactor Source { =} } -reactor Print(scale: number(1)) { // The scale parameter is just for testing. +reactor Print(scale: number = 1) { // The scale parameter is just for testing. input x: {= Array =} reaction(x) {= diff --git a/test/TypeScript/src/ArrayPrint.lf b/test/TypeScript/src/ArrayPrint.lf index 62312c6a8e..93b6486506 100644 --- a/test/TypeScript/src/ArrayPrint.lf +++ b/test/TypeScript/src/ArrayPrint.lf @@ -15,7 +15,7 @@ reactor Source { =} } -reactor Print(scale: number(1)) { // The scale parameter is just for testing. +reactor Print(scale: number = 1) { // The scale parameter is just for testing. input x: {= Array =} reaction(x) {= diff --git a/test/TypeScript/src/ArrayScale.lf b/test/TypeScript/src/ArrayScale.lf index 0b54e4a4ef..107ef8cf2f 100644 --- a/test/TypeScript/src/ArrayScale.lf +++ b/test/TypeScript/src/ArrayScale.lf @@ -6,7 +6,7 @@ target TypeScript import Source, Print from "ArrayPrint.lf" -reactor Scale(scale: number(2)) { +reactor Scale(scale: number = 2) { mutable input x: {= Array =} output out: {= Array =} diff --git a/test/TypeScript/src/Composition.lf b/test/TypeScript/src/Composition.lf index 35c259d967..e74bbe9aa9 100644 --- a/test/TypeScript/src/Composition.lf +++ b/test/TypeScript/src/Composition.lf @@ -4,10 +4,10 @@ target TypeScript { timeout: 5 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: number timer t(1 sec, period) - state count: number(0) + state count: number = 0 reaction(t) -> y {= count++; @@ -17,7 +17,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: number - state count: number(0) + state count: number = 0 reaction(x) {= count++; diff --git a/test/TypeScript/src/CompositionAfter.lf b/test/TypeScript/src/CompositionAfter.lf index afce86ccfe..8840298c2d 100644 --- a/test/TypeScript/src/CompositionAfter.lf +++ b/test/TypeScript/src/CompositionAfter.lf @@ -5,10 +5,10 @@ target TypeScript { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: number timer t(1 sec, period) - state count: number(0) + state count: number = 0 reaction(t) -> y {= count++; @@ -18,7 +18,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: number - state count: number(0) + state count: number = 0 reaction(x) {= count++; @@ -29,7 +29,7 @@ reactor Test { =} } -main reactor(delay: time(5 sec)) { +main reactor(delay: time = 5 sec) { s = new Source() d = new Test() s.y -> d.x after delay diff --git a/test/TypeScript/src/CountTest.lf b/test/TypeScript/src/CountTest.lf index 66737a6007..ba9e179b9b 100644 --- a/test/TypeScript/src/CountTest.lf +++ b/test/TypeScript/src/CountTest.lf @@ -6,7 +6,7 @@ import Count from "lib/Count.lf" reactor Test { input c: number - state i: number(0) + state i: number = 0 reaction(c) {= console.log("Received " + c); diff --git a/test/TypeScript/src/Deadline.lf b/test/TypeScript/src/Deadline.lf index 1d639e94f3..9f3086f1f5 100644 --- a/test/TypeScript/src/Deadline.lf +++ b/test/TypeScript/src/Deadline.lf @@ -5,10 +5,10 @@ target TypeScript { timeout: 4 sec } -reactor Source(period: time(2 sec)) { // run = "bin/Deadline -timeout 4 sec" +reactor Source(period: time = 2 sec) { // run = "bin/Deadline -timeout 4 sec" output y: number timer t(0, period) - state count: number(0) + state count: number = 0 reaction(t) -> y {= if (2 * Math.floor(count / 2) != count){ @@ -25,9 +25,9 @@ reactor Source(period: time(2 sec)) { // run = "bin/Deadline -timeout 4 sec" =} } -reactor Destination(timeout: time(1 sec)) { +reactor Destination(timeout: time = 1 sec) { input x: number - state count: number(0) + state count: number = 0 reaction(x) {= console.log("Destination receives: " + x); diff --git a/test/TypeScript/src/DeadlineHandledAbove.lf b/test/TypeScript/src/DeadlineHandledAbove.lf index 83ab279b23..ba47fd7aac 100644 --- a/test/TypeScript/src/DeadlineHandledAbove.lf +++ b/test/TypeScript/src/DeadlineHandledAbove.lf @@ -4,7 +4,7 @@ target TypeScript { timeout: 2 sec } -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: number output deadline_violation: boolean @@ -19,7 +19,7 @@ reactor Deadline(threshold: time(100 msec)) { } main reactor DeadlineHandledAbove { - state violation_detected: boolean(false) + state violation_detected: boolean = false d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/TypeScript/src/DelayInt.lf b/test/TypeScript/src/DelayInt.lf index d38e1103f5..224a7eab4a 100644 --- a/test/TypeScript/src/DelayInt.lf +++ b/test/TypeScript/src/DelayInt.lf @@ -2,7 +2,7 @@ // is a start at handling dynamic memory allocation for such actions. target TypeScript -reactor Delay(delay: time(100 msec)) { +reactor Delay(delay: time = 100 msec) { input x: number output out: number logical action a: number @@ -18,8 +18,8 @@ reactor Delay(delay: time(100 msec)) { reactor Test { input x: number - state start_time: time(0) - state received_value: boolean(false) + state start_time: time = 0 + state received_value: boolean = false reaction(startup) {= // Record the logical time at the start. diff --git a/test/TypeScript/src/DelayedAction.lf b/test/TypeScript/src/DelayedAction.lf index 6b6a155952..53ee33e963 100644 --- a/test/TypeScript/src/DelayedAction.lf +++ b/test/TypeScript/src/DelayedAction.lf @@ -5,7 +5,7 @@ target TypeScript { main reactor DelayedAction { timer t(0, 1 sec) logical action a - state count: number(0) + state count: number = 0 reaction(t) -> a {= actions.a.schedule(TimeValue.msec(100), null); =} diff --git a/test/TypeScript/src/DoubleInvocation.lf b/test/TypeScript/src/DoubleInvocation.lf index e2b61789e4..9557857ee2 100644 --- a/test/TypeScript/src/DoubleInvocation.lf +++ b/test/TypeScript/src/DoubleInvocation.lf @@ -13,7 +13,7 @@ target TypeScript { reactor Ball { output position: number output velocity: number - state p: number(200) + state p: number = 200 timer trigger(0, 1 sec) reaction(trigger) -> position, velocity {= @@ -26,7 +26,7 @@ reactor Ball { reactor Print { input velocity: number input position: number - state previous: number(-1) + state previous: number = -1 reaction(startup) {= console.log("####### Print startup"); diff --git a/test/TypeScript/src/DoubleReaction.lf b/test/TypeScript/src/DoubleReaction.lf index 26dccb8895..b172166613 100644 --- a/test/TypeScript/src/DoubleReaction.lf +++ b/test/TypeScript/src/DoubleReaction.lf @@ -5,10 +5,10 @@ target TypeScript { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: number timer t(offset, period) - state count: number(0) + state count: number = 0 reaction(t) -> y {= count++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: number input w: number - state s: number(2) + state s: number = 2 reaction(x, w) {= let sum = 0; diff --git a/test/TypeScript/src/DoubleTrigger.lf b/test/TypeScript/src/DoubleTrigger.lf index 34c1596325..fc8921622c 100644 --- a/test/TypeScript/src/DoubleTrigger.lf +++ b/test/TypeScript/src/DoubleTrigger.lf @@ -8,7 +8,7 @@ target TypeScript { main reactor DoubleTrigger { timer t1 timer t2 - state s: number(0) + state s: number = 0 reaction(t1, t2) {= s++; diff --git a/test/TypeScript/src/FloatLiteral.lf b/test/TypeScript/src/FloatLiteral.lf index 1d3e688deb..fb50d007d0 100644 --- a/test/TypeScript/src/FloatLiteral.lf +++ b/test/TypeScript/src/FloatLiteral.lf @@ -2,10 +2,10 @@ target TypeScript // This test verifies that floating-point literals are handled correctly. main reactor { - state N: number(6.0221409e+23) - state charge: number(-1.6021766E-19) - state minus_epsilon: number(-.01e0) - state expected: number(.964853323188E5) + state N: number = 6.0221409e+23 + state charge: number = -1.6021766E-19 + state minus_epsilon: number = -.01e0 + state expected: number = .964853323188E5 reaction(startup) {= const F: number = - N * charge; diff --git a/test/TypeScript/src/Gain.lf b/test/TypeScript/src/Gain.lf index 056b15e2d3..23558da9cf 100644 --- a/test/TypeScript/src/Gain.lf +++ b/test/TypeScript/src/Gain.lf @@ -1,7 +1,7 @@ // Example in the Wiki. target TypeScript -reactor Scale(scale: number(2)) { +reactor Scale(scale: number = 2) { input x: number output y: number @@ -10,7 +10,7 @@ reactor Scale(scale: number(2)) { reactor Test { input x: number - state received_value: boolean(false) + state received_value: boolean = false reaction(x) {= console.log("Received " + x + "."); diff --git a/test/TypeScript/src/Hello.lf b/test/TypeScript/src/Hello.lf index d762535149..c2806f83b8 100644 --- a/test/TypeScript/src/Hello.lf +++ b/test/TypeScript/src/Hello.lf @@ -8,9 +8,9 @@ target TypeScript { fast: true } -reactor Reschedule(period: time(2 sec), message: string("Hello TypeScript")) { - state count: number(0) - state previous_time: time(0) +reactor Reschedule(period: time = 2 sec, message: string = "Hello TypeScript") { + state count: number = 0 + state previous_time: time = 0 timer t(1 sec, period) logical action a @@ -38,8 +38,8 @@ reactor Reschedule(period: time(2 sec), message: string("Hello TypeScript")) { } reactor Inside( - period: time(1 sec), - message: string("Composite default message.") + period: time = 1 sec, + message: string = "Composite default message." ) { third_instance = new Reschedule(period = period, message = message) } diff --git a/test/TypeScript/src/Hierarchy2.lf b/test/TypeScript/src/Hierarchy2.lf index bd469242f7..da2db6308f 100644 --- a/test/TypeScript/src/Hierarchy2.lf +++ b/test/TypeScript/src/Hierarchy2.lf @@ -14,7 +14,7 @@ reactor Source { reactor Count { output out: number timer t(0, 1 sec) - state i: number(0) + state i: number = 0 reaction(t) -> out {= i++; @@ -37,7 +37,7 @@ reactor Add { reactor Print { input x: number - state expected: number(2) + state expected: number = 2 reaction(x) {= x = x as number; diff --git a/test/TypeScript/src/MovingAverage.lf b/test/TypeScript/src/MovingAverage.lf index b7b11dc7fd..19e767e3e2 100644 --- a/test/TypeScript/src/MovingAverage.lf +++ b/test/TypeScript/src/MovingAverage.lf @@ -8,7 +8,7 @@ target TypeScript { reactor Source { output out: number - state count: number(0) + state count: number = 0 timer clock(0, 200 msec) reaction(clock) -> out {= @@ -18,8 +18,8 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {= Array =}({= [0.0, 0.0, 0.0] =}) - state index: number(0) + state delay_line: {= Array =} = {= [0.0, 0.0, 0.0] =} + state index: number = 0 input x: number output out: number @@ -45,7 +45,7 @@ reactor MovingAverageImpl { reactor Print { input x: number - state count: number(0) + state count: number = 0 reaction(x) {= x = x as number; diff --git a/test/TypeScript/src/NativeListsAndTimes.lf b/test/TypeScript/src/NativeListsAndTimes.lf index 4a3751bd09..ad22d67d02 100644 --- a/test/TypeScript/src/NativeListsAndTimes.lf +++ b/test/TypeScript/src/NativeListsAndTimes.lf @@ -2,22 +2,22 @@ target TypeScript // This test passes if it is successfully compiled into valid target code. main reactor( - x: number(0), - y: time(0), // Units are missing but not required - z(1 msec), // Type is missing but not required + x: number = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required p: number[](1, 2, 3, 4), // List of integers q: TimeValue[](1 msec, 2 msec, 3 msec), // list of time values g: time[](1 msec, 2 msec) // List of time values ) { - state s: time(y) // Reference to explicitly typed time parameter - state t: time(z) // Reference to implicitly typed time parameter + state s: time = y // Reference to explicitly typed time parameter + state t: time = z // Reference to implicitly typed time parameter state v: boolean // Uninitialized boolean state variable state w: time // Uninitialized time state variable timer tick(0) // Units missing but not required timer tock(1 sec) // Implicit type time timer toe(z) // Implicit type time - state baz(p) // Implicit type int[] - state period(z) // Implicit type time + state baz = p // Implicit type int[] + state period = z // Implicit type time reaction(tick) {= // Target code diff --git a/test/TypeScript/src/ParameterizedState.lf b/test/TypeScript/src/ParameterizedState.lf index d2ea34da12..1484812489 100644 --- a/test/TypeScript/src/ParameterizedState.lf +++ b/test/TypeScript/src/ParameterizedState.lf @@ -1,7 +1,7 @@ target TypeScript -reactor Foo(bar: number(42)) { - state baz(bar) +reactor Foo(bar: number = 42) { + state baz = bar reaction(startup) {= console.log("Baz: " + baz); =} } diff --git a/test/TypeScript/src/PeriodicDesugared.lf b/test/TypeScript/src/PeriodicDesugared.lf index aaeac0e7d9..b99317e07a 100644 --- a/test/TypeScript/src/PeriodicDesugared.lf +++ b/test/TypeScript/src/PeriodicDesugared.lf @@ -1,9 +1,9 @@ target TypeScript -main reactor(offset: time(0), period: time(500 msec)) { +main reactor(offset: time = 0, period: time = 500 msec) { logical action init(offset) logical action recur(period) - state count: number(0) + state count: number = 0 reaction(startup) -> init, recur {= if (offset.isZero()) { diff --git a/test/TypeScript/src/ReadOutputOfContainedReactor.lf b/test/TypeScript/src/ReadOutputOfContainedReactor.lf index af1c4ed0e0..01b725e181 100644 --- a/test/TypeScript/src/ReadOutputOfContainedReactor.lf +++ b/test/TypeScript/src/ReadOutputOfContainedReactor.lf @@ -10,7 +10,7 @@ reactor Contained { main reactor ReadOutputOfContainedReactor { c = new Contained() - state count: number(0) + state count: number = 0 reaction(startup) c.out {= console.log("Startup reaction reading output of contained reactor: " + c.out); diff --git a/test/TypeScript/src/ScheduleLogicalAction.lf b/test/TypeScript/src/ScheduleLogicalAction.lf index 65fae1a237..84e8fbe1cb 100644 --- a/test/TypeScript/src/ScheduleLogicalAction.lf +++ b/test/TypeScript/src/ScheduleLogicalAction.lf @@ -21,7 +21,7 @@ reactor foo { } reactor print { - state expected_time: time(0) + state expected_time: time = 0 input x: number reaction(x) {= diff --git a/test/TypeScript/src/SendingInside.lf b/test/TypeScript/src/SendingInside.lf index 720ce71e64..ca4b6489b3 100644 --- a/test/TypeScript/src/SendingInside.lf +++ b/test/TypeScript/src/SendingInside.lf @@ -7,7 +7,7 @@ target TypeScript { reactor Printer { input x: number - state count: number(1) + state count: number = 1 reaction(x) {= console.log("Inside reactor received: " + x); @@ -19,7 +19,7 @@ reactor Printer { } main reactor SendingInside { - state count: number(0) + state count: number = 0 timer t(0, 1 sec) p = new Printer() diff --git a/test/TypeScript/src/SendsPointerTest.lf b/test/TypeScript/src/SendsPointerTest.lf index 55eb6eca26..3c80613b52 100644 --- a/test/TypeScript/src/SendsPointerTest.lf +++ b/test/TypeScript/src/SendsPointerTest.lf @@ -12,7 +12,7 @@ reactor SendsPointer { } // expected parameter is for testing. -reactor Print(expected: {= {value: number} =}({= { value: 42 } =})) { +reactor Print(expected: {= {value: number} =} = {= { value: 42 } =}) { input x: {= {value: number} =} reaction(x) {= diff --git a/test/TypeScript/src/SimpleDeadline.lf b/test/TypeScript/src/SimpleDeadline.lf index 7327dab0a3..a518e04e5e 100644 --- a/test/TypeScript/src/SimpleDeadline.lf +++ b/test/TypeScript/src/SimpleDeadline.lf @@ -3,7 +3,7 @@ // violation. target TypeScript -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: number output deadlineViolation: boolean diff --git a/test/TypeScript/src/SlowingClock.lf b/test/TypeScript/src/SlowingClock.lf index cc447bcd7c..772d2e2913 100644 --- a/test/TypeScript/src/SlowingClock.lf +++ b/test/TypeScript/src/SlowingClock.lf @@ -5,8 +5,8 @@ target TypeScript { main reactor SlowingClock { logical action a(100 msec) - state interval: time(100 msec) - state expected_time: time(100 msec) + state interval: time = 100 msec + state expected_time: time = 100 msec reaction(startup) -> a {= actions.a.schedule(0, null); =} diff --git a/test/TypeScript/src/SlowingClockPhysical.lf b/test/TypeScript/src/SlowingClockPhysical.lf index 4fa5907f73..53bc3f9da4 100644 --- a/test/TypeScript/src/SlowingClockPhysical.lf +++ b/test/TypeScript/src/SlowingClockPhysical.lf @@ -14,8 +14,8 @@ target TypeScript { main reactor SlowingClockPhysical { physical action a(100 msec) - state interval: time(100 msec) - state expected_time: time(100 msec) + state interval: time = 100 msec + state expected_time: time = 100 msec reaction(startup) -> a {= expected_time = TimeValue.msec(100); diff --git a/test/TypeScript/src/Stop.lf b/test/TypeScript/src/Stop.lf index 625cedaac7..6104c418d5 100644 --- a/test/TypeScript/src/Stop.lf +++ b/test/TypeScript/src/Stop.lf @@ -13,7 +13,7 @@ import Sender from "lib/LoopedActionSender.lf" reactor Consumer { input in1: number - state reactionInvokedCorrectly: boolean(false) + state reactionInvokedCorrectly: boolean = false reaction(in1) {= const currentTag = util.getCurrentTag(); diff --git a/test/TypeScript/src/Stride.lf b/test/TypeScript/src/Stride.lf index c8afaa63ad..04d7805d0b 100644 --- a/test/TypeScript/src/Stride.lf +++ b/test/TypeScript/src/Stride.lf @@ -5,8 +5,8 @@ target TypeScript { fast: true } -reactor Count(stride: number(1)) { - state count: number(0) +reactor Count(stride: number = 1) { + state count: number = 0 output y: number timer t(0, 100 msec) diff --git a/test/TypeScript/src/StructAsState.lf b/test/TypeScript/src/StructAsState.lf index 10da7b2876..a3b1cb081c 100644 --- a/test/TypeScript/src/StructAsState.lf +++ b/test/TypeScript/src/StructAsState.lf @@ -8,7 +8,7 @@ main reactor StructAsState { value: number; } =} - state s: hello_t({= {name: "Earth", value: 42} =}) + state s: hello_t = {= {name: "Earth", value: 42} =} reaction(startup) {= console.log("State s.name=" + s.name + ", s.value=" + s.value); diff --git a/test/TypeScript/src/StructAsType.lf b/test/TypeScript/src/StructAsType.lf index c9d092c7cb..ed70a46653 100644 --- a/test/TypeScript/src/StructAsType.lf +++ b/test/TypeScript/src/StructAsType.lf @@ -18,7 +18,7 @@ reactor Source { =} } -reactor Print(expected: number(42)) { // expected parameter is for testing. +reactor Print(expected: number = 42) { // expected parameter is for testing. input x: hello_t reaction(x) {= diff --git a/test/TypeScript/src/StructAsTypeDirect.lf b/test/TypeScript/src/StructAsTypeDirect.lf index 079735f108..3f891747fc 100644 --- a/test/TypeScript/src/StructAsTypeDirect.lf +++ b/test/TypeScript/src/StructAsTypeDirect.lf @@ -18,7 +18,7 @@ reactor Source { =} } -reactor Print(expected: number(42)) { // expected parameter is for testing. +reactor Print(expected: number = 42) { // expected parameter is for testing. input x: hello_t reaction(x) {= diff --git a/test/TypeScript/src/StructPrint.lf b/test/TypeScript/src/StructPrint.lf index 400d26b610..e75d9ead37 100644 --- a/test/TypeScript/src/StructPrint.lf +++ b/test/TypeScript/src/StructPrint.lf @@ -17,7 +17,7 @@ reactor Source { =} } -reactor Print(expected: number(42)) { // expected parameter is for testing. +reactor Print(expected: number = 42) { // expected parameter is for testing. input x: hello_t reaction(x) {= diff --git a/test/TypeScript/src/StructScale.lf b/test/TypeScript/src/StructScale.lf index 46bef4bc2d..788fd2fe61 100644 --- a/test/TypeScript/src/StructScale.lf +++ b/test/TypeScript/src/StructScale.lf @@ -6,7 +6,7 @@ target TypeScript import Print, Source from "StructPrint.lf" -reactor Scale(scale: number(2)) { +reactor Scale(scale: number = 2) { // Mutable keyword indicates that this reactor wants a writable copy of the // input. mutable input x: hello_t diff --git a/test/TypeScript/src/TimeLimit.lf b/test/TypeScript/src/TimeLimit.lf index d581c8c8a9..05a2a5a3b3 100644 --- a/test/TypeScript/src/TimeLimit.lf +++ b/test/TypeScript/src/TimeLimit.lf @@ -7,10 +7,10 @@ target TypeScript { logging: INFO } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: number timer t(offset, period) - state count: number(0) + state count: number = 0 reaction(t) -> y {= count++; @@ -20,7 +20,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: number - state s: number(1) + state s: number = 1 reaction(x) {= if (x != s) { @@ -30,7 +30,7 @@ reactor Destination { =} } -main reactor TimeLimit(period: time(1 msec)) { // usecs take a little too long +main reactor TimeLimit(period: time = 1 msec) { // usecs take a little too long timer stop(10 sec) c = new Clock(period = period) diff --git a/test/TypeScript/src/TimeState.lf b/test/TypeScript/src/TimeState.lf index 95d21f8f52..1dfa86312f 100644 --- a/test/TypeScript/src/TimeState.lf +++ b/test/TypeScript/src/TimeState.lf @@ -1,7 +1,7 @@ target TypeScript -reactor Foo(bar: number(42)) { - state baz: time(500 msec) +reactor Foo(bar: number = 42) { + state baz: time = 500 msec reaction(startup) {= console.log("Baz: " + baz); =} } diff --git a/test/TypeScript/src/concurrent/AsyncCallback.lf b/test/TypeScript/src/concurrent/AsyncCallback.lf index bedf2a47a8..2154d52533 100644 --- a/test/TypeScript/src/concurrent/AsyncCallback.lf +++ b/test/TypeScript/src/concurrent/AsyncCallback.lf @@ -17,11 +17,11 @@ main reactor AsyncCallback { } =} timer t(0, 200 msec) - state expected_time: time(100 msec) - state toggle: boolean(false) + state expected_time: time = 100 msec + state toggle: boolean = false physical action a(100 msec): number - state i: number(0) + state i: number = 0 reaction(t) -> a {= // set a timeout for the callback diff --git a/test/TypeScript/src/docker/federated/DistributedCountContainerized.lf b/test/TypeScript/src/docker/federated/DistributedCountContainerized.lf index 34813bef73..ee03246c37 100644 --- a/test/TypeScript/src/docker/federated/DistributedCountContainerized.lf +++ b/test/TypeScript/src/docker/federated/DistributedCountContainerized.lf @@ -11,7 +11,7 @@ target TypeScript { import Count from "../../lib/Count.lf" import Print from "../../federated/DistributedCount.lf" -federated reactor(offset: time(200 msec)) at rti { +federated reactor(offset: time = 200 msec) at rti { c = new Count() p = new Print() c.out -> p.inp after offset diff --git a/test/TypeScript/src/federated/DistributedCount.lf b/test/TypeScript/src/federated/DistributedCount.lf index 423dadd499..50f510cdcd 100644 --- a/test/TypeScript/src/federated/DistributedCount.lf +++ b/test/TypeScript/src/federated/DistributedCount.lf @@ -14,7 +14,7 @@ import Count from "../lib/Count.lf" reactor Print { input inp: number - state c: number(1) + state c: number = 1 reaction(inp) {= const elapsedTime = util.getElapsedLogicalTime(); @@ -35,7 +35,7 @@ reactor Print { =} } -federated reactor DistributedCount(offset: time(200 msec)) { +federated reactor DistributedCount(offset: time = 200 msec) { c = new Count() p = new Print() c.out -> p.inp after offset diff --git a/test/TypeScript/src/federated/DistributedDoublePort.lf b/test/TypeScript/src/federated/DistributedDoublePort.lf index d8677d65a4..d3a2636661 100644 --- a/test/TypeScript/src/federated/DistributedDoublePort.lf +++ b/test/TypeScript/src/federated/DistributedDoublePort.lf @@ -17,7 +17,7 @@ target TypeScript { import Count from "../lib/Count.lf" reactor CountMicrostep { - state count: number(1) + state count: number = 1 output out: number logical action act: number timer t(0, 1 sec) diff --git a/test/TypeScript/src/federated/DistributedLoopedAction.lf b/test/TypeScript/src/federated/DistributedLoopedAction.lf index 5e8619395f..02a7f5dc62 100644 --- a/test/TypeScript/src/federated/DistributedLoopedAction.lf +++ b/test/TypeScript/src/federated/DistributedLoopedAction.lf @@ -11,11 +11,11 @@ target TypeScript { import Sender from "../lib/LoopedActionSender.lf" -reactor Receiver(takeBreakAfter: number(10), breakInterval: time(400 msec)) { +reactor Receiver(takeBreakAfter: number = 10, breakInterval: time = 400 msec) { input inp: number - state receivedMessages: number(0) - state totalReceivedMessages: number(0) - state breaks: number(0) + state receivedMessages: number = 0 + state totalReceivedMessages: number = 0 + state breaks: number = 0 timer t(0, 1 msec) // This will impact the performance // but forces the logical time to advance Comment this line for a more diff --git a/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf b/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf index c747061578..842f13f74c 100644 --- a/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf @@ -10,10 +10,10 @@ target TypeScript { timeout: 1 sec } -reactor Sender(takeBreakAfter: number(10), breakInterval: time(550 msec)) { +reactor Sender(takeBreakAfter: number = 10, breakInterval: time = 550 msec) { output out: number physical action act - state sentMessages: number(0) + state sentMessages: number = 0 reaction(startup, act) -> act, out {= // Send a message on out @@ -29,11 +29,11 @@ reactor Sender(takeBreakAfter: number(10), breakInterval: time(550 msec)) { =} } -reactor Receiver(takeBreakAfter: number(10), breakInterval: time(550 msec)) { +reactor Receiver(takeBreakAfter: number = 10, breakInterval: time = 550 msec) { input inp: number - state receivedMessages: number(0) - state totalReceivedMessages: number(0) - state breaks: number(0) + state receivedMessages: number = 0 + state totalReceivedMessages: number = 0 + state breaks: number = 0 timer t(0, 1 msec) // This will impact the performance // but forces the logical time to advance Comment this line for a more diff --git a/test/TypeScript/src/federated/DistributedStop.lf b/test/TypeScript/src/federated/DistributedStop.lf index 2983ff3f7a..c0dd04149a 100644 --- a/test/TypeScript/src/federated/DistributedStop.lf +++ b/test/TypeScript/src/federated/DistributedStop.lf @@ -11,7 +11,7 @@ reactor Sender { output out: number timer t(0, 1 usec) logical action act - state reaction_invoked_correctly: boolean(false) + state reaction_invoked_correctly: boolean = false reaction(t, act) -> out, act {= console.log(`Sending 42 at (${util.getElapsedLogicalTime()}, ` @@ -58,10 +58,10 @@ reactor Sender { } reactor Receiver( - stp_offset: time(10 msec) // Used in the decentralized variant of the test + stp_offset: time = 10 msec // Used in the decentralized variant of the test ) { input in1: number - state reaction_invoked_correctly: boolean(false) + state reaction_invoked_correctly: boolean = false reaction(in1) {= console.log(`Received ${in1} at (${util.getElapsedLogicalTime()}, ` diff --git a/test/TypeScript/src/federated/HelloDistributed.lf b/test/TypeScript/src/federated/HelloDistributed.lf index 12533129e4..1189270ab1 100644 --- a/test/TypeScript/src/federated/HelloDistributed.lf +++ b/test/TypeScript/src/federated/HelloDistributed.lf @@ -20,7 +20,7 @@ reactor Source { reactor Destination { input inp: string - state received: boolean(false) + state received: boolean = false reaction(startup) {= console.log("Destination started."); =} diff --git a/test/TypeScript/src/federated/LoopDistributedCentralized.lf b/test/TypeScript/src/federated/LoopDistributedCentralized.lf index d5fdae2635..bb52679489 100644 --- a/test/TypeScript/src/federated/LoopDistributedCentralized.lf +++ b/test/TypeScript/src/federated/LoopDistributedCentralized.lf @@ -9,11 +9,11 @@ target TypeScript { timeout: 5 sec } -reactor Looper(incr: number(1), delay: time(0 msec)) { +reactor Looper(incr: number = 1, delay: time = 0 msec) { input inp: number output out: number physical action a(delay) - state count: number(0) + state count: number = 0 preamble {= let stop = false; @@ -57,7 +57,7 @@ reactor Looper(incr: number(1), delay: time(0 msec)) { =} } -federated reactor LoopDistributedCentralized(delay: time(0)) { +federated reactor LoopDistributedCentralized(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.inp diff --git a/test/TypeScript/src/federated/LoopDistributedDouble.lf b/test/TypeScript/src/federated/LoopDistributedDouble.lf index b86e55feaa..2c791377f7 100644 --- a/test/TypeScript/src/federated/LoopDistributedDouble.lf +++ b/test/TypeScript/src/federated/LoopDistributedDouble.lf @@ -13,13 +13,13 @@ target TypeScript { } } -reactor Looper(incr: number(1), delay: time(0 msec)) { +reactor Looper(incr: number = 1, delay: time = 0 msec) { input inp: number input inp2: number output out: number output out2: number physical action a(delay) - state count: number(0) + state count: number = 0 timer t(0, 1 sec) preamble {= @@ -71,7 +71,7 @@ reactor Looper(incr: number(1), delay: time(0 msec)) { =} } -federated reactor(delay: time(0)) { +federated reactor(delay: time = 0) { left = new Looper() right = new Looper(incr = -1) left.out -> right.inp diff --git a/test/TypeScript/src/federated/PingPongDistributed.lf b/test/TypeScript/src/federated/PingPongDistributed.lf index 0c362b1bf7..34a633aba4 100644 --- a/test/TypeScript/src/federated/PingPongDistributed.lf +++ b/test/TypeScript/src/federated/PingPongDistributed.lf @@ -1,10 +1,10 @@ /** This checks communication between federates */ target TypeScript -reactor Ping(count: number(10)) { +reactor Ping(count: number = 10) { input receive: number output send: number - state pingsLeft: number(count) + state pingsLeft: number = count logical action serve reaction(startup, serve) -> send {= @@ -23,10 +23,10 @@ reactor Ping(count: number(10)) { =} } -reactor Pong(expected: number(10)) { +reactor Pong(expected: number = 10) { input receive: number output send: number - state count: number(0) + state count: number = 0 reaction(receive) -> send {= count += 1; @@ -45,7 +45,7 @@ reactor Pong(expected: number(10)) { =} } -federated reactor PingPongDistributed(count: number(10)) { +federated reactor PingPongDistributed(count: number = 10) { ping = new Ping(count = count) pong = new Pong(expected = count) ping.send -> pong.receive diff --git a/test/TypeScript/src/federated/TopLevelArtifacts.lf b/test/TypeScript/src/federated/TopLevelArtifacts.lf index 89bdfd9a68..917da033f5 100644 --- a/test/TypeScript/src/federated/TopLevelArtifacts.lf +++ b/test/TypeScript/src/federated/TopLevelArtifacts.lf @@ -16,7 +16,7 @@ import Count from "../lib/Count.lf" import TestCount from "../lib/TestCount.lf" federated reactor { - state successes: number(0) + state successes: number = 0 logical action act timer t(0, 1 sec) diff --git a/test/TypeScript/src/lib/Count.lf b/test/TypeScript/src/lib/Count.lf index b61aaa92e3..d848d8e9d4 100644 --- a/test/TypeScript/src/lib/Count.lf +++ b/test/TypeScript/src/lib/Count.lf @@ -1,9 +1,9 @@ target TypeScript -reactor Count(offset: time(0), period: time(1 sec)) { +reactor Count(offset: time = 0, period: time = 1 sec) { output out: number timer t(offset, period) - state count: number(1) + state count: number = 1 reaction(t) -> out {= out = count++; =} } diff --git a/test/TypeScript/src/lib/InternalDelay.lf b/test/TypeScript/src/lib/InternalDelay.lf index ace3c21c12..0f6f109322 100644 --- a/test/TypeScript/src/lib/InternalDelay.lf +++ b/test/TypeScript/src/lib/InternalDelay.lf @@ -1,7 +1,7 @@ /** @author Youri Su */ target TypeScript -reactor InternalDelay(delay: TimeValue(10 msec)) { +reactor InternalDelay(delay: TimeValue = 10 msec) { input inp: number output out: number logical action d: number diff --git a/test/TypeScript/src/lib/LoopedActionSender.lf b/test/TypeScript/src/lib/LoopedActionSender.lf index f72a427bf1..7da4c133b0 100644 --- a/test/TypeScript/src/lib/LoopedActionSender.lf +++ b/test/TypeScript/src/lib/LoopedActionSender.lf @@ -12,10 +12,10 @@ target TypeScript * @param breakInterval: Determines how long the reactor should take a break * after sending takeBreakAfter messages. */ -reactor Sender(takeBreakAfter: number(10), breakInterval: time(400 msec)) { +reactor Sender(takeBreakAfter: number = 10, breakInterval: time = 400 msec) { output out: number logical action act - state sentMessages: number(0) + state sentMessages: number = 0 reaction(startup, act) -> act, out {= // Send a message on out diff --git a/test/TypeScript/src/lib/TestCount.lf b/test/TypeScript/src/lib/TestCount.lf index 5a4b9067df..822b4c64b1 100644 --- a/test/TypeScript/src/lib/TestCount.lf +++ b/test/TypeScript/src/lib/TestCount.lf @@ -9,9 +9,13 @@ */ target TypeScript -reactor TestCount(start: number(1), stride: number(1), numInputs: number(1)) { - state count: number(start) - state inputsReceived: number(0) +reactor TestCount( + start: number = 1, + stride: number = 1, + numInputs: number = 1 +) { + state count: number = start + state inputsReceived: number = 0 input inp: number reaction(inp) {= diff --git a/test/TypeScript/src/multiport/BankMultiportToReaction.lf b/test/TypeScript/src/multiport/BankMultiportToReaction.lf index 0119785cd5..6516749418 100644 --- a/test/TypeScript/src/multiport/BankMultiportToReaction.lf +++ b/test/TypeScript/src/multiport/BankMultiportToReaction.lf @@ -12,8 +12,8 @@ reactor DoubleCount { } main reactor { - state count: number(1) - state received: boolean(false) + state count: number = 1 + state received: boolean = false s = new[2] DoubleCount() diff --git a/test/TypeScript/src/multiport/BankReactionsInContainer.lf b/test/TypeScript/src/multiport/BankReactionsInContainer.lf index 1628dce060..b14ca33f70 100644 --- a/test/TypeScript/src/multiport/BankReactionsInContainer.lf +++ b/test/TypeScript/src/multiport/BankReactionsInContainer.lf @@ -8,7 +8,7 @@ target TypeScript { reactor R { output[2] out: number input[2] inp: number - state received: boolean(false) + state received: boolean = false reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { @@ -41,7 +41,7 @@ reactor R { main reactor { s = new[2] R() - state received: boolean(false) + state received: boolean = false reaction(startup) -> s.inp {= let count = 0; diff --git a/test/TypeScript/src/multiport/BankSelfBroadcast.lf b/test/TypeScript/src/multiport/BankSelfBroadcast.lf index dcd2aa8dfc..cf5af4bee3 100644 --- a/test/TypeScript/src/multiport/BankSelfBroadcast.lf +++ b/test/TypeScript/src/multiport/BankSelfBroadcast.lf @@ -12,7 +12,7 @@ target TypeScript reactor A { input[4] inp: number output out: number - state received: boolean(false) + state received: boolean = false reaction(startup) -> out {= out = this.getBankIndex(); =} diff --git a/test/TypeScript/src/multiport/BankToBank.lf b/test/TypeScript/src/multiport/BankToBank.lf index 0a4583c65a..5258616899 100644 --- a/test/TypeScript/src/multiport/BankToBank.lf +++ b/test/TypeScript/src/multiport/BankToBank.lf @@ -6,7 +6,7 @@ target TypeScript { reactor Source { timer t(0, 200 msec) output out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= out = s; @@ -15,7 +15,7 @@ reactor Source { } reactor Destination { - state s: number(0) + state s: number = 0 input inp: number reaction(inp) {= @@ -34,7 +34,7 @@ reactor Destination { =} } -main reactor BankToBank(width: number(4)) { +main reactor BankToBank(width: number = 4) { // FIXME: Should set the width to "width" rather than "4". a = new[4] Source() b = new[4] Destination() diff --git a/test/TypeScript/src/multiport/BankToBankMultiport.lf b/test/TypeScript/src/multiport/BankToBankMultiport.lf index ce82471f64..ef58c43ead 100644 --- a/test/TypeScript/src/multiport/BankToBankMultiport.lf +++ b/test/TypeScript/src/multiport/BankToBankMultiport.lf @@ -3,10 +3,10 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(1)) { +reactor Source(width: number = 1) { timer t(0, 200 msec) output[width] out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= for(let i = 0; i < out.length; i++) { @@ -15,8 +15,8 @@ reactor Source(width: number(1)) { =} } -reactor Destination(width: number(1)) { - state s: number(6) +reactor Destination(width: number = 1) { + state s: number = 6 input[width] inp: number reaction(inp) {= @@ -40,7 +40,7 @@ reactor Destination(width: number(1)) { =} } -main reactor BankToBankMultiport(bankWidth: number(4)) { +main reactor BankToBankMultiport(bankWidth: number = 4) { a = new[bankWidth] Source(width = 4) b = new[bankWidth] Destination(width = 4) a.out -> b.inp diff --git a/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf b/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf index 8ad676de36..51c095119b 100644 --- a/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf +++ b/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf @@ -3,10 +3,10 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(1)) { +reactor Source(width: number = 1) { timer t(0, 200 msec) output[width] out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= for(let i = 0; i < out.length; i++) { @@ -15,8 +15,8 @@ reactor Source(width: number(1)) { =} } -reactor Destination(width: number(1)) { - state s: number(6) +reactor Destination(width: number = 1) { + state s: number = 6 input[width] inp: number reaction(inp) {= @@ -40,7 +40,7 @@ reactor Destination(width: number(1)) { =} } -main reactor(bankWidth: number(4)) { +main reactor(bankWidth: number = 4) { a = new[bankWidth] Source(width = 4) b = new[bankWidth] Destination(width = 4) a.out -> b.inp after 200 msec diff --git a/test/TypeScript/src/multiport/BankToMultiport.lf b/test/TypeScript/src/multiport/BankToMultiport.lf index ecaacb52df..43dc7ee1bb 100644 --- a/test/TypeScript/src/multiport/BankToMultiport.lf +++ b/test/TypeScript/src/multiport/BankToMultiport.lf @@ -9,7 +9,7 @@ reactor Source { reactor Sink { input[4] inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= for (let i = 0; i < inp.length; i++) { diff --git a/test/TypeScript/src/multiport/BankToReaction.lf b/test/TypeScript/src/multiport/BankToReaction.lf index 89b189748d..df65c3063e 100644 --- a/test/TypeScript/src/multiport/BankToReaction.lf +++ b/test/TypeScript/src/multiport/BankToReaction.lf @@ -5,7 +5,7 @@ target TypeScript { import Count from "../lib/Count.lf" main reactor { - state count: number(1) + state count: number = 1 s = new[2] Count() diff --git a/test/TypeScript/src/multiport/BroadcastAfter.lf b/test/TypeScript/src/multiport/BroadcastAfter.lf index 3cf5eb3850..83cf34ddff 100644 --- a/test/TypeScript/src/multiport/BroadcastAfter.lf +++ b/test/TypeScript/src/multiport/BroadcastAfter.lf @@ -10,7 +10,7 @@ reactor Source { reactor Destination { input inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); diff --git a/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf b/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf index 598ec737e6..755cf01107 100644 --- a/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf +++ b/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf @@ -2,7 +2,7 @@ target TypeScript { timeout: 2 sec } -reactor Source(value: number(42)) { +reactor Source(value: number = 42) { output out: number reaction(startup) -> out {= out = value; =} @@ -10,7 +10,7 @@ reactor Source(value: number(42)) { reactor Destination { input inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); diff --git a/test/TypeScript/src/multiport/FullyConnected.lf b/test/TypeScript/src/multiport/FullyConnected.lf index cf84e92242..e40009ed90 100644 --- a/test/TypeScript/src/multiport/FullyConnected.lf +++ b/test/TypeScript/src/multiport/FullyConnected.lf @@ -1,10 +1,10 @@ target TypeScript -reactor Node(numNodes: number(4)) { +reactor Node(numNodes: number = 4) { input[numNodes] inp: number output out: number - state received: boolean(false) + state received: boolean = false reaction(startup) -> out {= console.log("Hello from node " + this.getBankIndex() + "!"); @@ -36,7 +36,7 @@ reactor Node(numNodes: number(4)) { =} } -main reactor(numNodes: number(4)) { +main reactor(numNodes: number = 4) { nodes = new[numNodes] Node(numNodes = numNodes) (nodes.out)+ -> nodes.inp } diff --git a/test/TypeScript/src/multiport/MultiportFromBank.lf b/test/TypeScript/src/multiport/MultiportFromBank.lf index 489a9df4a8..18896eed2a 100644 --- a/test/TypeScript/src/multiport/MultiportFromBank.lf +++ b/test/TypeScript/src/multiport/MultiportFromBank.lf @@ -10,9 +10,9 @@ reactor Source { reaction(startup) -> out {= out = this.getBankIndex(); =} } -reactor Destination(portWidth: number(3)) { +reactor Destination(portWidth: number = 3) { input[portWidth] inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= for (let i = 0; i < inp.length; i++) { @@ -32,7 +32,7 @@ reactor Destination(portWidth: number(3)) { =} } -main reactor(width: number(4)) { +main reactor(width: number = 4) { a = new[width] Source() b = new Destination(portWidth = width) a.out -> b.inp diff --git a/test/TypeScript/src/multiport/MultiportFromBankHierarchy.lf b/test/TypeScript/src/multiport/MultiportFromBankHierarchy.lf index e050682ab6..ffc394b26c 100644 --- a/test/TypeScript/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportFromBankHierarchy.lf @@ -6,7 +6,7 @@ target TypeScript { import Source, Destination from "MultiportFromBank.lf" -reactor Container(portWidth: number(3)) { +reactor Container(portWidth: number = 3) { output[portWidth] out: number s = new[portWidth] Source() s.out -> out diff --git a/test/TypeScript/src/multiport/MultiportFromHierarchy.lf b/test/TypeScript/src/multiport/MultiportFromHierarchy.lf index 5922d2f911..5627652b2f 100644 --- a/test/TypeScript/src/multiport/MultiportFromHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportFromHierarchy.lf @@ -4,10 +4,10 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(3)) { +reactor Source(width: number = 3) { timer t(0, 200 msec) output[width] out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= for(let i = 0; i < out.length; i++) { @@ -16,8 +16,8 @@ reactor Source(width: number(3)) { =} } -reactor Destination(width: number(3)) { - state s: number(6) +reactor Destination(width: number = 3) { + state s: number = 6 input[width] inp: number reaction(inp) {= @@ -41,19 +41,19 @@ reactor Destination(width: number(3)) { =} } -reactor Container(width: number(3)) { +reactor Container(width: number = 3) { output[width] out: number src = new InsideContainer(width = width) src.out -> out } -reactor InsideContainer(width: number(3)) { +reactor InsideContainer(width: number = 3) { output[width] out: number src = new Source(width = width) src.out -> out } -main reactor MultiportFromHierarchy(width: number(4)) { +main reactor MultiportFromHierarchy(width: number = 4) { a = new Container(width = width) b = new Destination(width = width) a.out -> b.inp diff --git a/test/TypeScript/src/multiport/MultiportFromReaction.lf b/test/TypeScript/src/multiport/MultiportFromReaction.lf index 6670c2aa5a..ba386bd379 100644 --- a/test/TypeScript/src/multiport/MultiportFromReaction.lf +++ b/test/TypeScript/src/multiport/MultiportFromReaction.lf @@ -3,8 +3,8 @@ target TypeScript { timeout: 2 sec } -reactor Destination(width: number(1)) { - state s: number(6) +reactor Destination(width: number = 1) { + state s: number = 6 input[width] inp: number reaction(inp) {= @@ -28,9 +28,9 @@ reactor Destination(width: number(1)) { =} } -main reactor MultiportFromReaction(width: number(4)) { +main reactor MultiportFromReaction(width: number = 4) { timer t(0, 200 msec) - state s: number(0) + state s: number = 0 b = new Destination(width = width) reaction(t) -> b.inp {= diff --git a/test/TypeScript/src/multiport/MultiportIn.lf b/test/TypeScript/src/multiport/MultiportIn.lf index c409969657..97a36c08d2 100644 --- a/test/TypeScript/src/multiport/MultiportIn.lf +++ b/test/TypeScript/src/multiport/MultiportIn.lf @@ -7,7 +7,7 @@ target TypeScript { reactor Source { timer t(0, 200 msec) output out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= out = s++; =} } @@ -20,7 +20,7 @@ reactor Computation { } reactor Destination { - state s: number(0) + state s: number = 0 input[4] inp: number reaction(inp) {= diff --git a/test/TypeScript/src/multiport/MultiportInParameterized.lf b/test/TypeScript/src/multiport/MultiportInParameterized.lf index c189e56ef4..fb11c5e102 100644 --- a/test/TypeScript/src/multiport/MultiportInParameterized.lf +++ b/test/TypeScript/src/multiport/MultiportInParameterized.lf @@ -7,7 +7,7 @@ target TypeScript { reactor Source { timer t(0, 200 msec) output out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= out = s; @@ -22,8 +22,8 @@ reactor Computation { reaction(inp) -> out {= out = inp; =} } -reactor Destination(width: number(1)) { - state s: number(0) +reactor Destination(width: number = 1) { + state s: number = 0 input[width] inp: number reaction(inp) {= diff --git a/test/TypeScript/src/multiport/MultiportMutableInput.lf b/test/TypeScript/src/multiport/MultiportMutableInput.lf index f04131e411..11120e8d30 100644 --- a/test/TypeScript/src/multiport/MultiportMutableInput.lf +++ b/test/TypeScript/src/multiport/MultiportMutableInput.lf @@ -12,7 +12,7 @@ reactor Source { =} } -reactor Print(scale: number(1)) { // The scale parameter is just for testing. +reactor Print(scale: number = 1) { // The scale parameter is just for testing. input[2] inp: number reaction(inp) {= @@ -27,7 +27,7 @@ reactor Print(scale: number(1)) { // The scale parameter is just for testing. =} } -reactor Scale(scale: number(2)) { +reactor Scale(scale: number = 2) { mutable input[2] inp: number output[2] out: number diff --git a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf index 26b5c3b87c..382f444df7 100644 --- a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf +++ b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf @@ -26,7 +26,7 @@ reactor Source { =} } -reactor Print(scale: number(1)) { // The scale parameter is just for testing. +reactor Print(scale: number = 1) { // The scale parameter is just for testing. input[2] inp: {= Array =} reaction(inp) {= @@ -55,7 +55,7 @@ reactor Print(scale: number(1)) { // The scale parameter is just for testing. =} } -reactor Scale(scale: number(2)) { +reactor Scale(scale: number = 2) { mutable input[2] inp: {= Array =} output[2] out: {= Array =} diff --git a/test/TypeScript/src/multiport/MultiportOut.lf b/test/TypeScript/src/multiport/MultiportOut.lf index 9fa72bf3e2..04588b86b5 100644 --- a/test/TypeScript/src/multiport/MultiportOut.lf +++ b/test/TypeScript/src/multiport/MultiportOut.lf @@ -6,7 +6,7 @@ target TypeScript { reactor Source { timer t(0, 200 msec) output[4] out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= for(let i = 0; i < 4; i++) { @@ -27,7 +27,7 @@ reactor Computation { } reactor Destination { - state s: number(0) + state s: number = 0 input[4] inp: number reaction(inp) {= diff --git a/test/TypeScript/src/multiport/MultiportToBankAfter.lf b/test/TypeScript/src/multiport/MultiportToBankAfter.lf index 357dc1d0e1..ee10df94c6 100644 --- a/test/TypeScript/src/multiport/MultiportToBankAfter.lf +++ b/test/TypeScript/src/multiport/MultiportToBankAfter.lf @@ -4,7 +4,7 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(2)) { +reactor Source(width: number = 2) { output[width] out: number reaction(startup) -> out {= @@ -16,7 +16,7 @@ reactor Source(width: number(2)) { reactor Destination { input inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); @@ -39,7 +39,7 @@ reactor Destination { =} } -main reactor(width: number(3)) { +main reactor(width: number = 3) { a = new Source(width = width) b = new[width] Destination() a.out -> b.inp after 1 sec // Width of the bank of delays will be inferred. diff --git a/test/TypeScript/src/multiport/MultiportToBankDouble.lf b/test/TypeScript/src/multiport/MultiportToBankDouble.lf index b429a846a4..e618dd898d 100644 --- a/test/TypeScript/src/multiport/MultiportToBankDouble.lf +++ b/test/TypeScript/src/multiport/MultiportToBankDouble.lf @@ -25,7 +25,7 @@ reactor Source { reactor Destination { input inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); diff --git a/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf b/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf index 3e5c499d06..7420704ce1 100644 --- a/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf @@ -16,7 +16,7 @@ reactor Source { reactor Destination { input inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); diff --git a/test/TypeScript/src/multiport/MultiportToHierarchy.lf b/test/TypeScript/src/multiport/MultiportToHierarchy.lf index 4673ff1e22..c620000872 100644 --- a/test/TypeScript/src/multiport/MultiportToHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportToHierarchy.lf @@ -5,10 +5,10 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(4)) { +reactor Source(width: number = 4) { timer t(0, 200 msec) output[width] out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= for(let i = 0; i < 4; i++) { @@ -17,8 +17,8 @@ reactor Source(width: number(4)) { =} } -reactor Destination(width: number(4)) { - state s: number(6) +reactor Destination(width: number = 4) { + state s: number = 6 input[width] inp: number reaction(inp) {= @@ -42,13 +42,13 @@ reactor Destination(width: number(4)) { =} } -reactor Container(width: number(4)) { +reactor Container(width: number = 4) { input[width] inp: number dst = new Destination() inp -> dst.inp } -main reactor MultiportToHierarchy(width: number(4)) { +main reactor MultiportToHierarchy(width: number = 4) { a = new Source(width = width) b = new Container(width = width) a.out -> b.inp diff --git a/test/TypeScript/src/multiport/MultiportToMultiport.lf b/test/TypeScript/src/multiport/MultiportToMultiport.lf index 54bac4fbfb..ecd774e7b6 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiport.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiport.lf @@ -12,7 +12,7 @@ reactor Source { reactor Sink { input[4] inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= for (let i = 0; i < inp.length; i++) { diff --git a/test/TypeScript/src/multiport/MultiportToMultiport2.lf b/test/TypeScript/src/multiport/MultiportToMultiport2.lf index 73b3cfedc5..9e9856af63 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiport2.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiport2.lf @@ -1,7 +1,7 @@ // Test multiport to multiport connections. See also MultiportToMultiport. target TypeScript -reactor Source(width: number(2)) { +reactor Source(width: number = 2) { output[width] out: number reaction(startup) -> out {= @@ -11,7 +11,7 @@ reactor Source(width: number(2)) { =} } -reactor Destination(width: number(2)) { +reactor Destination(width: number = 2) { input[width] inp: number reaction(inp) {= diff --git a/test/TypeScript/src/multiport/MultiportToMultiport2After.lf b/test/TypeScript/src/multiport/MultiportToMultiport2After.lf index 1bca78675c..04890686ab 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiport2After.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiport2After.lf @@ -1,7 +1,7 @@ // Test multiport to multiport connections. See also MultiportToMultiport. target TypeScript -reactor Source(width: number(2)) { +reactor Source(width: number = 2) { output[width] out: number reaction(startup) -> out {= @@ -11,7 +11,7 @@ reactor Source(width: number(2)) { =} } -reactor Destination(width: number(2)) { +reactor Destination(width: number = 2) { input[width] inp: number reaction(inp) {= diff --git a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf index 8e08494cad..737603a5bd 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf @@ -7,7 +7,7 @@ target TypeScript { reactor Source { timer t(0, 200 msec) output[2] out: {= Array =} - state s: number(0) + state s: number = 0 reaction(t) -> out {= for(let i = 0; i < 2; i++) { @@ -24,7 +24,7 @@ reactor Source { } reactor Destination { - state s: number(15) + state s: number = 15 input[2] inp: {= Array =} reaction(inp) {= diff --git a/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf b/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf index d1be5397dd..5252783498 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf @@ -3,10 +3,10 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(1)) { +reactor Source(width: number = 1) { timer t(0, 200 msec) output[width] out: number - state s: number(0) + state s: number = 0 reaction(t) -> out {= for (let i = 0; i < out.length; i++) { @@ -15,8 +15,8 @@ reactor Source(width: number(1)) { =} } -reactor Destination(width: number(1)) { - state s: number(6) +reactor Destination(width: number = 1) { + state s: number = 6 input[width] inp: number // Width is one larger than that of the source. reaction(inp) {= @@ -39,7 +39,7 @@ reactor Destination(width: number(1)) { =} } -main reactor(width: number(4)) { +main reactor(width: number = 4) { a = new Source(width = width) b = new Destination(width = width) a.out -> b.inp diff --git a/test/TypeScript/src/multiport/MultiportToPort.lf b/test/TypeScript/src/multiport/MultiportToPort.lf index a366089fd9..a00d482fe8 100644 --- a/test/TypeScript/src/multiport/MultiportToPort.lf +++ b/test/TypeScript/src/multiport/MultiportToPort.lf @@ -15,9 +15,9 @@ reactor Source { =} } -reactor Destination(expected: number(0)) { +reactor Destination(expected: number = 0) { input inp: number - state received: boolean(false) + state received: boolean = false reaction(inp) {= console.log("Received " + inp); diff --git a/test/TypeScript/src/multiport/MultiportToReaction.lf b/test/TypeScript/src/multiport/MultiportToReaction.lf index 84d33b642f..e7b5af4c00 100644 --- a/test/TypeScript/src/multiport/MultiportToReaction.lf +++ b/test/TypeScript/src/multiport/MultiportToReaction.lf @@ -3,9 +3,9 @@ target TypeScript { timeout: 2 sec } -reactor Source(width: number(1)) { +reactor Source(width: number = 1) { timer t(0, 200 msec) - state s: number(0) + state s: number = 0 output[width] out: number reaction(t) -> out {= @@ -17,7 +17,7 @@ reactor Source(width: number(1)) { } main reactor MultiportToReaction { - state s: number(6) + state s: number = 6 b = new Source(width = 4) reaction(b.out) {= diff --git a/test/TypeScript/src/multiport/NestedBanks.lf b/test/TypeScript/src/multiport/NestedBanks.lf index fea594d1ea..a5c31d38d9 100644 --- a/test/TypeScript/src/multiport/NestedBanks.lf +++ b/test/TypeScript/src/multiport/NestedBanks.lf @@ -20,7 +20,7 @@ reactor A { b.y -> x } -reactor B(aBankIndex: number(0)) { +reactor B(aBankIndex: number = 0) { output[2] y: number reaction(startup) -> y {= @@ -60,7 +60,7 @@ reactor E { =} } -reactor F(cBankIndex: number(0)) { +reactor F(cBankIndex: number = 0) { input w: number reaction(w) {= @@ -71,7 +71,7 @@ reactor F(cBankIndex: number(0)) { =} } -reactor G(cBankIndex: number(0)) { +reactor G(cBankIndex: number = 0) { input s: number reaction(s) {= diff --git a/test/TypeScript/src/multiport/ReactionToContainedBank.lf b/test/TypeScript/src/multiport/ReactionToContainedBank.lf index 9f54a0123b..9b058671cc 100644 --- a/test/TypeScript/src/multiport/ReactionToContainedBank.lf +++ b/test/TypeScript/src/multiport/ReactionToContainedBank.lf @@ -5,9 +5,9 @@ target TypeScript { import TestCount from "../lib/TestCount.lf" -main reactor ReactionToContainedBank(width: number(2)) { +main reactor ReactionToContainedBank(width: number = 2) { timer t(0, 100 msec) - state count: number(1) + state count: number = 1 test = new[width] TestCount(numInputs = 11) diff --git a/test/TypeScript/src/multiport/ReactionsToNested.lf b/test/TypeScript/src/multiport/ReactionsToNested.lf index dbc20ef8ed..055e08d086 100644 --- a/test/TypeScript/src/multiport/ReactionsToNested.lf +++ b/test/TypeScript/src/multiport/ReactionsToNested.lf @@ -4,9 +4,9 @@ target TypeScript { timeout: 1 sec } -reactor T(expected: number(0)) { +reactor T(expected: number = 0) { input z: number - state received: boolean(false) + state received: boolean = false reaction(z) {= console.log("T received " + z); diff --git a/test/TypeScript/src/target/AfterNoTypes.lf b/test/TypeScript/src/target/AfterNoTypes.lf index 2293faf601..b3477bbf55 100644 --- a/test/TypeScript/src/target/AfterNoTypes.lf +++ b/test/TypeScript/src/target/AfterNoTypes.lf @@ -15,7 +15,7 @@ reactor Foo { } reactor Print { - state expected_time: time(10 msec) + state expected_time: time = 10 msec input x reaction(x) {= From bd7522a37aef410f6f3b87cdb0f739d042c925e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 2 Feb 2023 14:45:41 +0100 Subject: [PATCH 08/49] Improve warning --- .../org/lflang/validation/LFValidator.java | 19 +++++++++++++++---- test/C/src/concurrent/ScheduleAt.lf | 6 +++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/org.lflang/src/org/lflang/validation/LFValidator.java b/org.lflang/src/org/lflang/validation/LFValidator.java index 69107d96e4..bfdb92fc3e 100644 --- a/org.lflang/src/org/lflang/validation/LFValidator.java +++ b/org.lflang/src/org/lflang/validation/LFValidator.java @@ -171,10 +171,21 @@ public void checkAction(Action action) { public void checkInitializer(Initializer init) { if (init.isBraces() && target != Target.CPP) { error("Brace initializers are only supported for the C++ target", Literals.INITIALIZER__BRACES); - } - if (init.isParens() && target.mandatesEqualsInitializers()) { - warning("This syntax is deprecated in the " + target - + " target, use an equal sign instead of parentheses for assignment (run the formatter to fix this automatically).", Literals.INITIALIZER__PARENS); + } else if (init.isParens() && target.mandatesEqualsInitializers()) { + var message = "This syntax is deprecated in the " + target + + " target, use an equal sign instead of parentheses for assignment."; + if (init.getExprs().size() == 1) { + message += " (run the formatter to fix this automatically)"; + } + warning(message, Literals.INITIALIZER__PARENS); + } else if (!init.isAssign() && init.eContainer() instanceof Assignment) { + var feature = init.isBraces() ? Literals.INITIALIZER__BRACES + : Literals.INITIALIZER__PARENS; + var message = "This syntax is deprecated, do not use parentheses or braces but an equal sign."; + if (init.getExprs().size() == 1) { + message += " (run the formatter to fix this automatically)"; + } + warning(message, feature); } } diff --git a/test/C/src/concurrent/ScheduleAt.lf b/test/C/src/concurrent/ScheduleAt.lf index 9fa09138b6..0e35f49a94 100644 --- a/test/C/src/concurrent/ScheduleAt.lf +++ b/test/C/src/concurrent/ScheduleAt.lf @@ -12,7 +12,7 @@ target C { reactor Scheduler { logical action act // List of microsteps. Size = 16 - state microstep_delay_list: uint32_t[]( + state microstep_delay_list: uint32_t[] = {={ 0, 1, 1, @@ -29,7 +29,7 @@ reactor Scheduler { 4, 4, 5 - ) + }=} state times: int[]( 0, 0, @@ -49,7 +49,7 @@ reactor Scheduler { 900 msec ) // Size = 9 - state action_hit_list_microstep: int[](1, 2, 0, 1, 0, 2, 3, 4, 5) + state action_hit_list_microstep: int[] = {={1, 2, 0, 1, 0, 2, 3, 4, 5}=} state action_hit_list_times: int[]( 0, 0, From bf3ad074d8ecf20c3f02edf99ba2306018c9b668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 2 Feb 2023 15:47:49 +0100 Subject: [PATCH 09/49] Format C++ tests --- test/Cpp/src/ActionDelay.lf | 2 +- test/Cpp/src/ActionIsPresent.lf | 6 ++-- test/Cpp/src/ActionValues.lf | 4 +-- test/Cpp/src/After.lf | 4 +-- test/Cpp/src/AfterOverlapped.lf | 2 +- test/Cpp/src/AfterZero.lf | 4 +-- test/Cpp/src/Alignment.lf | 2 +- test/Cpp/src/ArrayAsParameter.lf | 4 +-- test/Cpp/src/ArrayPrint.lf | 2 +- test/Cpp/src/ArrayScale.lf | 2 +- test/Cpp/src/CharLiteralInitializer.lf | 2 +- test/Cpp/src/Composition.lf | 6 ++-- test/Cpp/src/CompositionAfter.lf | 8 +++--- test/Cpp/src/CountTest.lf | 2 +- test/Cpp/src/Deadline.lf | 8 +++--- test/Cpp/src/DeadlineHandledAbove.lf | 4 +-- test/Cpp/src/DelayInt.lf | 2 +- test/Cpp/src/DelayedAction.lf | 2 +- test/Cpp/src/DoubleInvocation.lf | 4 +-- test/Cpp/src/DoublePort.lf | 2 +- test/Cpp/src/DoubleReaction.lf | 6 ++-- test/Cpp/src/DoubleTrigger.lf | 2 +- test/Cpp/src/FloatLiteral.lf | 8 +++--- test/Cpp/src/Gain.lf | 2 +- test/Cpp/src/GetMicroStep.lf | 2 +- test/Cpp/src/Hello.lf | 11 +++++--- test/Cpp/src/Hierarchy2.lf | 4 +-- test/Cpp/src/ImportComposition.lf | 2 +- test/Cpp/src/ManualDelayedReaction.lf | 2 +- test/Cpp/src/Methods.lf | 2 +- test/Cpp/src/MovingAverage.lf | 6 ++-- test/Cpp/src/NativeListsAndTimes.lf | 14 +++++----- test/Cpp/src/NestedTriggeredReactions.lf | 4 +-- test/Cpp/src/ParameterHierarchy.lf | 6 ++-- test/Cpp/src/ParameterizedState.lf | 4 +-- test/Cpp/src/ParametersOutOfOrder.lf | 2 +- test/Cpp/src/PeriodicDesugared.lf | 4 +-- test/Cpp/src/Pipeline.lf | 4 +-- test/Cpp/src/ReadOutputOfContainedReactor.lf | 2 +- test/Cpp/src/ScheduleLogicalAction.lf | 2 +- test/Cpp/src/SelfLoop.lf | 2 +- test/Cpp/src/SendingInside.lf | 4 +-- test/Cpp/src/SimpleDeadline.lf | 2 +- test/Cpp/src/SlowingClock.lf | 4 +-- test/Cpp/src/SlowingClockPhysical.lf | 4 +-- test/Cpp/src/Stride.lf | 4 +-- test/Cpp/src/StructPrint.lf | 4 +-- test/Cpp/src/StructScale.lf | 2 +- test/Cpp/src/TimeLimit.lf | 8 +++--- test/Cpp/src/TimeState.lf | 4 +-- test/Cpp/src/Timeout_Test.lf | 2 +- test/Cpp/src/ToReactionNested.lf | 4 +-- .../src/TriggerDownstreamOnlyIfPresent2.lf | 2 +- test/Cpp/src/concurrent/AsyncCallback.lf | 6 ++-- test/Cpp/src/concurrent/AsyncCallback2.lf | 4 +-- .../Cpp/src/concurrent/CompositionThreaded.lf | 6 ++-- .../DeadlineHandledAboveThreaded.lf | 4 +-- test/Cpp/src/concurrent/DeadlineThreaded.lf | 8 +++--- test/Cpp/src/concurrent/DelayIntThreaded.lf | 2 +- .../src/concurrent/DoubleReactionThreaded.lf | 6 ++-- test/Cpp/src/concurrent/GainThreaded.lf | 2 +- test/Cpp/src/concurrent/HelloThreaded.lf | 11 +++++--- .../src/concurrent/SendingInsideThreaded.lf | 4 +-- test/Cpp/src/concurrent/Threaded.lf | 4 +-- test/Cpp/src/concurrent/ThreadedThreaded.lf | 4 +-- test/Cpp/src/concurrent/TimeLimitThreaded.lf | 8 +++--- test/Cpp/src/enclave/EnclaveBank.lf | 8 +++--- test/Cpp/src/enclave/EnclaveBankEach.lf | 8 +++--- test/Cpp/src/enclave/EnclaveHelloWorld.lf | 4 +-- test/Cpp/src/enclave/EnclaveHierarchy.lf | 6 ++-- test/Cpp/src/enclave/EnclaveShutdown.lf | 6 ++-- test/Cpp/src/enclave/EnclaveTimeout.lf | 2 +- test/Cpp/src/lib/Count.lf | 2 +- test/Cpp/src/lib/LoopedActionSender.lf | 4 +-- test/Cpp/src/multiport/BankSelfBroadcast.lf | 4 +-- test/Cpp/src/multiport/BankToBank.lf | 10 +++---- test/Cpp/src/multiport/BankToBankMultiport.lf | 10 +++---- .../src/multiport/BankToBankMultiportAfter.lf | 12 ++++---- test/Cpp/src/multiport/BankToMultiport.lf | 4 +-- test/Cpp/src/multiport/Broadcast.lf | 2 +- test/Cpp/src/multiport/BroadcastAfter.lf | 4 +-- .../src/multiport/BroadcastMultipleAfter.lf | 6 ++-- test/Cpp/src/multiport/FullyConnected.lf | 6 ++-- .../multiport/FullyConnectedAddressable.lf | 6 ++-- .../FullyConnectedAddressableAfter.lf | 2 +- .../src/multiport/IndexIntoMultiportOutput.lf | 10 +++---- test/Cpp/src/multiport/Multiport.lf | 2 +- test/Cpp/src/multiport/MultiportFromBank.lf | 8 +++--- .../multiport/MultiportFromBankHierarchy.lf | 4 +-- .../MultiportFromBankHierarchyAfter.lf | 4 +-- .../src/multiport/MultiportFromHierarchy.lf | 4 +-- test/Cpp/src/multiport/MultiportIn.lf | 4 +-- test/Cpp/src/multiport/MultiportOut.lf | 4 +-- test/Cpp/src/multiport/MultiportToBank.lf | 2 +- .../Cpp/src/multiport/MultiportToBankAfter.lf | 2 +- .../src/multiport/MultiportToBankHierarchy.lf | 4 +-- .../Cpp/src/multiport/MultiportToHierarchy.lf | 12 ++++---- .../Cpp/src/multiport/MultiportToMultiport.lf | 2 +- .../src/multiport/MultiportToMultiport2.lf | 4 +-- .../multiport/MultiportToMultiport2After.lf | 4 +-- .../multiport/MultiportToMultiportArray.lf | 4 +-- test/Cpp/src/multiport/MultiportToPort.lf | 4 +-- .../ReadMultiportOutputOfContainedBank.lf | 4 +-- .../multiport/ReadOutputOfContainedBank.lf | 4 +-- test/Cpp/src/multiport/WidthGivenByCode.lf | 2 +- .../multiport/WriteInputOfContainedBank.lf | 4 +-- .../WriteMultiportInputOfContainedBank.lf | 4 +-- test/Cpp/src/properties/Fast.lf | 2 +- test/Cpp/src/properties/Keepalive.lf | 2 +- test/Cpp/src/properties/Timeout.lf | 2 +- test/Cpp/src/properties/TimeoutZero.lf | 2 +- test/Cpp/src/target/AfterVoid.lf | 4 +-- .../src/target/CliParserGenericArguments.lf | 28 +++++++++---------- test/Cpp/src/target/CombinedTypeNames.lf | 10 +++---- test/Cpp/src/target/GenericDelay.lf | 2 +- .../src/target/GenericParameterAndState.lf | 4 +-- test/Cpp/src/target/PointerParameters.lf | 2 +- 117 files changed, 271 insertions(+), 265 deletions(-) diff --git a/test/Cpp/src/ActionDelay.lf b/test/Cpp/src/ActionDelay.lf index 5bb1402e05..14210e1009 100644 --- a/test/Cpp/src/ActionDelay.lf +++ b/test/Cpp/src/ActionDelay.lf @@ -4,7 +4,7 @@ target Cpp reactor GeneratedDelay { input y_in: int output y_out: int - state y_state: int{0} + state y_state: int = 0 logical action act(100 msec): void reaction(y_in) -> act {= diff --git a/test/Cpp/src/ActionIsPresent.lf b/test/Cpp/src/ActionIsPresent.lf index 7b8267d606..aff1daeb63 100644 --- a/test/Cpp/src/ActionIsPresent.lf +++ b/test/Cpp/src/ActionIsPresent.lf @@ -1,10 +1,10 @@ // Tests the is_present variable for actions in cpp target Cpp -main reactor ActionIsPresent(offset: time(1 nsec), period: time(500 msec)) { +main reactor ActionIsPresent(offset: time = 1 nsec, period: time = 500 msec) { logical action a - state success: bool(false) - state zero: time(0 nsec) + state success: bool = false + state zero: time = 0 nsec reaction(startup, a) -> a {= if (!a.is_present()) { diff --git a/test/Cpp/src/ActionValues.lf b/test/Cpp/src/ActionValues.lf index 18d06b7b3c..8d115c60fa 100644 --- a/test/Cpp/src/ActionValues.lf +++ b/test/Cpp/src/ActionValues.lf @@ -2,8 +2,8 @@ target Cpp main reactor ActionValues { - state r1done: bool(false) - state r2done: bool(false) + state r1done: bool = false + state r2done: bool = false logical action act(100 msec): int reaction(startup) -> act {= diff --git a/test/Cpp/src/After.lf b/test/Cpp/src/After.lf index 177ebfbe01..bbcc287b78 100644 --- a/test/Cpp/src/After.lf +++ b/test/Cpp/src/After.lf @@ -13,8 +13,8 @@ reactor foo { } reactor print { - state expected_time: time(10 msec) - state i: int(0) + state expected_time: time = 10 msec + state i: int = 0 input x: int reaction(x) {= diff --git a/test/Cpp/src/AfterOverlapped.lf b/test/Cpp/src/AfterOverlapped.lf index 926c4609c2..6a85eaf5bc 100644 --- a/test/Cpp/src/AfterOverlapped.lf +++ b/test/Cpp/src/AfterOverlapped.lf @@ -8,7 +8,7 @@ import Count from "lib/Count.lf" reactor Test { input c: int - state i: int(0) + state i: int = 0 reaction(c) {= std::cout << "Received " << *c.get() << '\n'; diff --git a/test/Cpp/src/AfterZero.lf b/test/Cpp/src/AfterZero.lf index 8baa157e99..152b87cfc2 100644 --- a/test/Cpp/src/AfterZero.lf +++ b/test/Cpp/src/AfterZero.lf @@ -13,8 +13,8 @@ reactor foo { } reactor print { - state expected_time: time(0) - state i: int(0) + state expected_time: time = 0 + state i: int = 0 input x: int reaction(x) {= diff --git a/test/Cpp/src/Alignment.lf b/test/Cpp/src/Alignment.lf index 45e52cb573..1bd3562f41 100644 --- a/test/Cpp/src/Alignment.lf +++ b/test/Cpp/src/Alignment.lf @@ -8,7 +8,7 @@ target Cpp { reactor Source { output out: int - state count: int(1) + state count: int = 1 timer t(0, 100 msec) reaction(t) -> out {= diff --git a/test/Cpp/src/ArrayAsParameter.lf b/test/Cpp/src/ArrayAsParameter.lf index 77795deb56..db9f564890 100644 --- a/test/Cpp/src/ArrayAsParameter.lf +++ b/test/Cpp/src/ArrayAsParameter.lf @@ -4,7 +4,7 @@ target Cpp reactor Source(sequence: int[]{0, 1, 2}) { output out: size_t - state count: size_t{0} + state count: size_t = 0 logical action next: void reaction(startup, next) -> out, next {= @@ -18,7 +18,7 @@ reactor Source(sequence: int[]{0, 1, 2}) { reactor Print { input in: size_t - state count: size_t{1} + state count: size_t = 1 reaction(in) {= std::cout << "Received: " << *in.get() << '\n'; diff --git a/test/Cpp/src/ArrayPrint.lf b/test/Cpp/src/ArrayPrint.lf index 420f7902db..3bdf494107 100644 --- a/test/Cpp/src/ArrayPrint.lf +++ b/test/Cpp/src/ArrayPrint.lf @@ -18,7 +18,7 @@ reactor Source { =} } -reactor Print(scale: int(1)) { +reactor Print(scale: int = 1) { input in: int[3] reaction(in) {= diff --git a/test/Cpp/src/ArrayScale.lf b/test/Cpp/src/ArrayScale.lf index f5b2e56b30..b52e7305b7 100644 --- a/test/Cpp/src/ArrayScale.lf +++ b/test/Cpp/src/ArrayScale.lf @@ -5,7 +5,7 @@ target Cpp import Source, Print from "ArrayPrint.lf" -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { input in: int[3] output out: int[3] diff --git a/test/Cpp/src/CharLiteralInitializer.lf b/test/Cpp/src/CharLiteralInitializer.lf index 2d0edb71b8..e01e5973a6 100644 --- a/test/Cpp/src/CharLiteralInitializer.lf +++ b/test/Cpp/src/CharLiteralInitializer.lf @@ -2,7 +2,7 @@ target Cpp main reactor CharLiteralInitializer { - state c: char('x') + state c: char = 'x' reaction(startup) {= if (c != 'x') { diff --git a/test/Cpp/src/Composition.lf b/test/Cpp/src/Composition.lf index 6ac7364a51..0a341d5e4f 100644 --- a/test/Cpp/src/Composition.lf +++ b/test/Cpp/src/Composition.lf @@ -5,10 +5,10 @@ target Cpp { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -18,7 +18,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= count++; diff --git a/test/Cpp/src/CompositionAfter.lf b/test/Cpp/src/CompositionAfter.lf index 06f71a6fbb..15d68e13ea 100644 --- a/test/Cpp/src/CompositionAfter.lf +++ b/test/Cpp/src/CompositionAfter.lf @@ -5,10 +5,10 @@ target Cpp { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -18,7 +18,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= count++; @@ -38,7 +38,7 @@ reactor Test { =} } -main reactor(delay: time(5 sec)) { +main reactor(delay: time = 5 sec) { s = new Source() d = new Test() s.y -> d.x after delay diff --git a/test/Cpp/src/CountTest.lf b/test/Cpp/src/CountTest.lf index 63a494bc61..838d84a998 100644 --- a/test/Cpp/src/CountTest.lf +++ b/test/Cpp/src/CountTest.lf @@ -7,7 +7,7 @@ import Count from "lib/Count.lf" reactor Test { input c: int - state i: int(0) + state i: int = 0 reaction(c) {= i++; diff --git a/test/Cpp/src/Deadline.lf b/test/Cpp/src/Deadline.lf index 81eab8a004..19a41ff057 100644 --- a/test/Cpp/src/Deadline.lf +++ b/test/Cpp/src/Deadline.lf @@ -5,13 +5,13 @@ target Cpp { timeout: 4 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { private preamble {= #include =} output y: int timer t(0, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= if (count % 2 == 1) { @@ -25,9 +25,9 @@ reactor Source(period: time(2 sec)) { =} } -reactor Destination(timeout: time(1 sec)) { +reactor Destination(timeout: time = 1 sec) { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= std::cout << "Destination receives: " << *x.get() << std::endl; diff --git a/test/Cpp/src/DeadlineHandledAbove.lf b/test/Cpp/src/DeadlineHandledAbove.lf index 76a790fcbf..b2a6c7658a 100644 --- a/test/Cpp/src/DeadlineHandledAbove.lf +++ b/test/Cpp/src/DeadlineHandledAbove.lf @@ -2,7 +2,7 @@ // container reacts to that output. target Cpp -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: int output deadline_violation: bool @@ -16,7 +16,7 @@ reactor Deadline(threshold: time(100 msec)) { } main reactor DeadlineHandledAbove { - state violation_detected: bool({= false =}) + state violation_detected: bool = {= false =} d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/Cpp/src/DelayInt.lf b/test/Cpp/src/DelayInt.lf index 379e22a3ec..f58e5ef45b 100644 --- a/test/Cpp/src/DelayInt.lf +++ b/test/Cpp/src/DelayInt.lf @@ -1,7 +1,7 @@ // This tests actions with payloads by delaying an input by a fixed amount. target Cpp -reactor Delay(delay: time(100 msec)) { +reactor Delay(delay: time = 100 msec) { input in: int output out: int logical action d: int diff --git a/test/Cpp/src/DelayedAction.lf b/test/Cpp/src/DelayedAction.lf index 0b2b748909..1ce1aea63f 100644 --- a/test/Cpp/src/DelayedAction.lf +++ b/test/Cpp/src/DelayedAction.lf @@ -6,7 +6,7 @@ target Cpp { main reactor DelayedAction { timer t(0, 1 sec) logical action a: void - state count: int(0) + state count: int = 0 reaction(t) -> a {= a.schedule(100ms); =} diff --git a/test/Cpp/src/DoubleInvocation.lf b/test/Cpp/src/DoubleInvocation.lf index 3315fafae4..956b54bb17 100644 --- a/test/Cpp/src/DoubleInvocation.lf +++ b/test/Cpp/src/DoubleInvocation.lf @@ -14,7 +14,7 @@ target Cpp { reactor Ball { output position: int output velocity: int - state p: int(200) + state p: int = 200 timer trigger(0, 1 sec) reaction(trigger) -> position, velocity {= @@ -27,7 +27,7 @@ reactor Ball { reactor Print { input velocity: int input position: int - state previous: int(-1) + state previous: int = -1 reaction(startup) {= reactor::log::Info() << "####### Print startup"; diff --git a/test/Cpp/src/DoublePort.lf b/test/Cpp/src/DoublePort.lf index 00950b1331..faaa474db5 100644 --- a/test/Cpp/src/DoublePort.lf +++ b/test/Cpp/src/DoublePort.lf @@ -13,7 +13,7 @@ target Cpp { import Count from "lib/Count.lf" reactor CountMicrostep { - state count: int(1) + state count: int = 1 output out: int logical action act: int timer t(0, 1 sec) diff --git a/test/Cpp/src/DoubleReaction.lf b/test/Cpp/src/DoubleReaction.lf index d5e8964089..1128d63f97 100644 --- a/test/Cpp/src/DoubleReaction.lf +++ b/test/Cpp/src/DoubleReaction.lf @@ -5,10 +5,10 @@ target Cpp { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int input w: int - state s: int(2) + state s: int = 2 reaction(x, w) {= int sum = 0; diff --git a/test/Cpp/src/DoubleTrigger.lf b/test/Cpp/src/DoubleTrigger.lf index c714d83e9c..5db4818048 100644 --- a/test/Cpp/src/DoubleTrigger.lf +++ b/test/Cpp/src/DoubleTrigger.lf @@ -5,7 +5,7 @@ target Cpp main reactor DoubleTrigger { timer t1 timer t2 - state s: int(0) + state s: int = 0 reaction(t1, t2) {= s++; diff --git a/test/Cpp/src/FloatLiteral.lf b/test/Cpp/src/FloatLiteral.lf index a65af798b4..6ad95f9e55 100644 --- a/test/Cpp/src/FloatLiteral.lf +++ b/test/Cpp/src/FloatLiteral.lf @@ -2,10 +2,10 @@ target Cpp // This test verifies that floating-point literals are handled correctly. main reactor { - state N: double(6.0221409e+23) - state charge: double(-1.6021766E-19) - state minus_epsilon: double(-.01e0) - state expected: double(.964853323188E5) + state N: double = 6.0221409e+23 + state charge: double = -1.6021766E-19 + state minus_epsilon: double = -.01e0 + state expected: double = .964853323188E5 reaction(startup) {= auto F = - N * charge; diff --git a/test/Cpp/src/Gain.lf b/test/Cpp/src/Gain.lf index 4a62a62a8e..4b123cc992 100644 --- a/test/Cpp/src/Gain.lf +++ b/test/Cpp/src/Gain.lf @@ -1,7 +1,7 @@ // Example in the Wiki. target Cpp -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { input x: int output y: int diff --git a/test/Cpp/src/GetMicroStep.lf b/test/Cpp/src/GetMicroStep.lf index c8eb89a4fa..8370a21403 100644 --- a/test/Cpp/src/GetMicroStep.lf +++ b/test/Cpp/src/GetMicroStep.lf @@ -2,7 +2,7 @@ target Cpp main reactor GetMicroStep { - state s: {= reactor::mstep_t =}(1) + state s: {= reactor::mstep_t =} = 1 logical action l diff --git a/test/Cpp/src/Hello.lf b/test/Cpp/src/Hello.lf index c63afbabe4..f74acf6688 100644 --- a/test/Cpp/src/Hello.lf +++ b/test/Cpp/src/Hello.lf @@ -8,8 +8,11 @@ target Cpp { fast: true } -reactor HelloCpp(period: time(2 sec), message: {= std::string =}("Hello C++")) { - state count: int(0) +reactor HelloCpp( + period: time = 2 sec, + message: {= std::string =} = "Hello C++" +) { + state count: int = 0 state previous_time: {= reactor::TimePoint =} timer t(1 sec, period) logical action a: void @@ -37,8 +40,8 @@ reactor HelloCpp(period: time(2 sec), message: {= std::string =}("Hello C++")) { } reactor Inside( - period: time(1 sec), - message: std::string("Composite default message.") + period: time = 1 sec, + message: std::string = "Composite default message." ) { third_instance = new HelloCpp(period = period, message = message) } diff --git a/test/Cpp/src/Hierarchy2.lf b/test/Cpp/src/Hierarchy2.lf index 4e78e3406e..db81bf4971 100644 --- a/test/Cpp/src/Hierarchy2.lf +++ b/test/Cpp/src/Hierarchy2.lf @@ -14,7 +14,7 @@ reactor Source { reactor Count { output out: int timer t(0, 1 sec) - state i: int(0) + state i: int = 0 reaction(t) -> out {= i++; @@ -37,7 +37,7 @@ reactor Add { reactor Print { input in: int - state expected: int(2) + state expected: int = 2 reaction(in) {= auto value = *in.get(); diff --git a/test/Cpp/src/ImportComposition.lf b/test/Cpp/src/ImportComposition.lf index 4b8649a243..0559edacd1 100644 --- a/test/Cpp/src/ImportComposition.lf +++ b/test/Cpp/src/ImportComposition.lf @@ -16,7 +16,7 @@ main reactor ImportComposition { =} imp_comp = new ImportedComposition() - state received: bool(false) + state received: bool = false reaction(startup) -> imp_comp.x {= imp_comp.x.set(42); =} diff --git a/test/Cpp/src/ManualDelayedReaction.lf b/test/Cpp/src/ManualDelayedReaction.lf index 2d426bffb7..3c55bdcaf1 100644 --- a/test/Cpp/src/ManualDelayedReaction.lf +++ b/test/Cpp/src/ManualDelayedReaction.lf @@ -4,7 +4,7 @@ target Cpp reactor GeneratedDelay { input y_in: int output y_out: int - state y_state: int(0) + state y_state: int = 0 logical action act(100 msec): int diff --git a/test/Cpp/src/Methods.lf b/test/Cpp/src/Methods.lf index fc4decbcbd..ff94460b62 100644 --- a/test/Cpp/src/Methods.lf +++ b/test/Cpp/src/Methods.lf @@ -1,7 +1,7 @@ target Cpp main reactor { - state foo: int(2) + state foo: int = 2 const method getFoo(): int {= return foo; =} diff --git a/test/Cpp/src/MovingAverage.lf b/test/Cpp/src/MovingAverage.lf index 160688c2ed..af202ca0a0 100644 --- a/test/Cpp/src/MovingAverage.lf +++ b/test/Cpp/src/MovingAverage.lf @@ -8,7 +8,7 @@ target Cpp { reactor Source { output out: double - state count: int{0} + state count: int = 0 timer clock(0, 200 msec) reaction(clock) -> out {= @@ -19,7 +19,7 @@ reactor Source { reactor MovingAverageImpl { state delay_line: double[3]{0.0, 0.0, 0.0} - state index: int{0} + state index: int = 0 input in: double output out: double @@ -44,7 +44,7 @@ reactor MovingAverageImpl { reactor Print { input in: double - state count: int{0} + state count: int = 0 reaction(in) {= std::cout << "Received: " << *in.get() << '\n'; diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index 5ec46d2930..2881ffb796 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -2,24 +2,24 @@ target Cpp // This test passes if it is successfully compiled into valid target code. reactor Foo( - x: int(0), - y: time(0), // Units are missing but not required - z(1 msec), // Type is missing but not required + x: int = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required p: int[]{1, 2, 3, 4}, // List of integers q: {= // list of time values std::vector =}{1 msec, 2 msec, 3 msec}, g: time[]{1 msec, 2 msec} // List of time values ) { - state s: time(y) // Reference to explicitly typed time parameter - state t: time(z) // Reference to implicitly typed time parameter + state s: time = y // Reference to explicitly typed time parameter + state t: time = z // Reference to implicitly typed time parameter state v: bool // Uninitialized boolean state variable state w: time // Uninitialized time state variable timer tick(0) // Units missing but not required timer tock(1 sec) // Implicit type time timer toe(z) // Implicit type time - state baz(p) // Implicit type int[] - state period(z) // Implicit type time + state baz = p // Implicit type int[] + state period = z // Implicit type time state times: std::vector< // a list of lists std::vector<{= reactor::Duration =}> >{q, g} diff --git a/test/Cpp/src/NestedTriggeredReactions.lf b/test/Cpp/src/NestedTriggeredReactions.lf index dcaa64b179..783dcefc7e 100644 --- a/test/Cpp/src/NestedTriggeredReactions.lf +++ b/test/Cpp/src/NestedTriggeredReactions.lf @@ -3,7 +3,7 @@ target Cpp reactor Container { input in: void - state triggered: bool{false} + state triggered: bool = false contained = new Contained() @@ -22,7 +22,7 @@ reactor Container { reactor Contained { input in: void - state triggered: bool{false} + state triggered: bool = false reaction(in) {= triggered = true; =} diff --git a/test/Cpp/src/ParameterHierarchy.lf b/test/Cpp/src/ParameterHierarchy.lf index acd051a5ce..c183cbca03 100644 --- a/test/Cpp/src/ParameterHierarchy.lf +++ b/test/Cpp/src/ParameterHierarchy.lf @@ -7,7 +7,7 @@ */ target Cpp -reactor Deep(p: int(0)) { +reactor Deep(p: int = 0) { reaction(startup) {= if(p != 42) { reactor::log::Error() << "Parameter value is: " << p << ". Should have been 42."; @@ -18,11 +18,11 @@ reactor Deep(p: int(0)) { =} } -reactor Intermediate(p: int(10)) { +reactor Intermediate(p: int = 10) { a = new Deep(p = p) } -reactor Another(p: int(20)) { +reactor Another(p: int = 20) { // also test forwarding parameters via target code blocks a = new Intermediate(p = {= p =}) } diff --git a/test/Cpp/src/ParameterizedState.lf b/test/Cpp/src/ParameterizedState.lf index be03a52b9a..1c39043a75 100644 --- a/test/Cpp/src/ParameterizedState.lf +++ b/test/Cpp/src/ParameterizedState.lf @@ -1,7 +1,7 @@ target Cpp -reactor Foo(bar: int(4)) { - state baz(bar) +reactor Foo(bar: int = 4) { + state baz = bar reaction(startup) {= std::cout << "Baz: " << baz << std::endl; diff --git a/test/Cpp/src/ParametersOutOfOrder.lf b/test/Cpp/src/ParametersOutOfOrder.lf index 64dcbc6ef3..7ef28b914a 100644 --- a/test/Cpp/src/ParametersOutOfOrder.lf +++ b/test/Cpp/src/ParametersOutOfOrder.lf @@ -2,7 +2,7 @@ // definition order. Compilation without errors is success. target Cpp -reactor Foo(a: int(0), b: std::string(""), c: float(0.0)) { +reactor Foo(a: int = 0, b: std::string = "", c: float = 0.0) { reaction(startup) {= if (a != 42 || b != "bar" || c < 3.1) { reactor::log::Error() << "received an unexpected parameter!"; diff --git a/test/Cpp/src/PeriodicDesugared.lf b/test/Cpp/src/PeriodicDesugared.lf index 2b6e92c750..2823835687 100644 --- a/test/Cpp/src/PeriodicDesugared.lf +++ b/test/Cpp/src/PeriodicDesugared.lf @@ -3,10 +3,10 @@ target Cpp { timeout: 5 secs } -main reactor(offset: time(50 msec), period: time(500 msec)) { +main reactor(offset: time = 50 msec, period: time = 500 msec) { logical action init(offset): void logical action recur(period): void - state expected(offset) + state expected = offset reaction(startup) -> init {= std::cout << "Hello from Periodic!\n"; diff --git a/test/Cpp/src/Pipeline.lf b/test/Cpp/src/Pipeline.lf index c4300f13c9..cc86ef67a0 100644 --- a/test/Cpp/src/Pipeline.lf +++ b/test/Cpp/src/Pipeline.lf @@ -6,7 +6,7 @@ import Computation from "concurrent/Threaded.lf" reactor Print { input in: int - state count: int(0) + state count: int = 0 reaction(in) {= std::cout << "Received: " << *in.get() << '\n'; @@ -27,7 +27,7 @@ reactor Print { main reactor Pipeline { timer t(0, 200 msec) - state count: int(0) + state count: int = 0 c1 = new Computation() c2 = new Computation() diff --git a/test/Cpp/src/ReadOutputOfContainedReactor.lf b/test/Cpp/src/ReadOutputOfContainedReactor.lf index 6cba642f04..c7e85083b4 100644 --- a/test/Cpp/src/ReadOutputOfContainedReactor.lf +++ b/test/Cpp/src/ReadOutputOfContainedReactor.lf @@ -10,7 +10,7 @@ reactor Contained { main reactor ReadOutputOfContainedReactor { c = new Contained() - state count: int(0) + state count: int = 0 reaction(startup) c.out {= std::cout << "Startup reaction reading output of contained " diff --git a/test/Cpp/src/ScheduleLogicalAction.lf b/test/Cpp/src/ScheduleLogicalAction.lf index c8eaea1a30..96fd5382b7 100644 --- a/test/Cpp/src/ScheduleLogicalAction.lf +++ b/test/Cpp/src/ScheduleLogicalAction.lf @@ -26,7 +26,7 @@ reactor foo { } reactor print { - state expected_time: time(0) + state expected_time: time = 0 input x: int reaction(x) {= diff --git a/test/Cpp/src/SelfLoop.lf b/test/Cpp/src/SelfLoop.lf index be08cc771b..2be47e3d4e 100644 --- a/test/Cpp/src/SelfLoop.lf +++ b/test/Cpp/src/SelfLoop.lf @@ -12,7 +12,7 @@ reactor Self { input x: int output y: int logical action a: int - state expected: int(43) + state expected: int = 43 reaction(a) -> y {= reactor::log::Info() << "a = " << *a.get(); diff --git a/test/Cpp/src/SendingInside.lf b/test/Cpp/src/SendingInside.lf index 2d947f686b..2f73122bc8 100644 --- a/test/Cpp/src/SendingInside.lf +++ b/test/Cpp/src/SendingInside.lf @@ -7,7 +7,7 @@ target Cpp { reactor Printer { input x: int - state count: int(1) + state count: int = 1 reaction(x) {= std::cout << "Inside reactor received: " << *x.get() << std::endl; @@ -20,7 +20,7 @@ reactor Printer { } main reactor SendingInside { - state count: int(0) + state count: int = 0 timer t(0, 1 sec) p = new Printer() diff --git a/test/Cpp/src/SimpleDeadline.lf b/test/Cpp/src/SimpleDeadline.lf index 17c354108a..be10b55d43 100644 --- a/test/Cpp/src/SimpleDeadline.lf +++ b/test/Cpp/src/SimpleDeadline.lf @@ -3,7 +3,7 @@ // violation. target Cpp -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { private preamble {= #include =} diff --git a/test/Cpp/src/SlowingClock.lf b/test/Cpp/src/SlowingClock.lf index 41dda03dba..adbe93e418 100644 --- a/test/Cpp/src/SlowingClock.lf +++ b/test/Cpp/src/SlowingClock.lf @@ -15,8 +15,8 @@ target Cpp { main reactor SlowingClock { logical action a(100 msec) - state interval: time(100 msec) - state expected_time: time(100 msec) + state interval: time = 100 msec + state expected_time: time = 100 msec reaction(startup) -> a {= a.schedule(0ns); =} diff --git a/test/Cpp/src/SlowingClockPhysical.lf b/test/Cpp/src/SlowingClockPhysical.lf index 24f77cf2be..919f9d6cdf 100644 --- a/test/Cpp/src/SlowingClockPhysical.lf +++ b/test/Cpp/src/SlowingClockPhysical.lf @@ -15,8 +15,8 @@ target Cpp { main reactor SlowingClockPhysical { physical action a - state interval: time(100 msec) - state expected_time: time(100 msec) + state interval: time = 100 msec + state expected_time: time = 100 msec reaction(startup) -> a {= expected_time=100ms; diff --git a/test/Cpp/src/Stride.lf b/test/Cpp/src/Stride.lf index 8adeaa69b0..5f469e4c70 100644 --- a/test/Cpp/src/Stride.lf +++ b/test/Cpp/src/Stride.lf @@ -5,8 +5,8 @@ target Cpp { fast: true } -reactor Count(stride: int(1)) { - state count: int(0) +reactor Count(stride: int = 1) { + state count: int = 0 output y: int timer t(0, 100 msec) diff --git a/test/Cpp/src/StructPrint.lf b/test/Cpp/src/StructPrint.lf index 9e0bc35d45..4ee404b8bf 100644 --- a/test/Cpp/src/StructPrint.lf +++ b/test/Cpp/src/StructPrint.lf @@ -19,8 +19,8 @@ reactor Source { } reactor Print( - expected_value: int(42), - expected_name: {= std::string =}("Earth") + expected_value: int = 42, + expected_name: {= std::string =} = "Earth" ) { input in: Hello diff --git a/test/Cpp/src/StructScale.lf b/test/Cpp/src/StructScale.lf index cf818f710f..776dad14b1 100644 --- a/test/Cpp/src/StructScale.lf +++ b/test/Cpp/src/StructScale.lf @@ -9,7 +9,7 @@ public preamble {= #include "include/hello.h" =} -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { input in: Hello output out: Hello diff --git a/test/Cpp/src/TimeLimit.lf b/test/Cpp/src/TimeLimit.lf index ec8d43af42..8b33dcd967 100644 --- a/test/Cpp/src/TimeLimit.lf +++ b/test/Cpp/src/TimeLimit.lf @@ -5,10 +5,10 @@ target Cpp { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int - state s: int(1) + state s: int = 1 reaction(x) {= //std::cout << "Received " << *x.get() << '\n'; @@ -39,7 +39,7 @@ reactor Destination { =} } -main reactor TimeLimit(period: time(1 sec)) { +main reactor TimeLimit(period: time = 1 sec) { timer stop(10 sec) c = new Clock(period = period) d = new Destination() diff --git a/test/Cpp/src/TimeState.lf b/test/Cpp/src/TimeState.lf index 28228c11ec..aefac79b1c 100644 --- a/test/Cpp/src/TimeState.lf +++ b/test/Cpp/src/TimeState.lf @@ -1,7 +1,7 @@ target Cpp -reactor Foo(bar: time(42 msec)) { - state baz(bar) +reactor Foo(bar: time = 42 msec) { + state baz = bar reaction(startup) {= std::cout << "Baz: " << baz << std::endl; =} } diff --git a/test/Cpp/src/Timeout_Test.lf b/test/Cpp/src/Timeout_Test.lf index 53ff8480dd..c3fe1ffbf9 100644 --- a/test/Cpp/src/Timeout_Test.lf +++ b/test/Cpp/src/Timeout_Test.lf @@ -13,7 +13,7 @@ import Sender from "lib/LoopedActionSender.lf" reactor Consumer { input in: int - state success: bool(false) + state success: bool = false reaction(in) {= auto current{get_elapsed_logical_time()}; diff --git a/test/Cpp/src/ToReactionNested.lf b/test/Cpp/src/ToReactionNested.lf index ff391229a0..5b048bc0a7 100644 --- a/test/Cpp/src/ToReactionNested.lf +++ b/test/Cpp/src/ToReactionNested.lf @@ -12,8 +12,8 @@ reactor CountContainer { } main reactor { - state count: int(1) - state received: bool(false) + state count: int = 1 + state received: bool = false s = new CountContainer() diff --git a/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf b/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf index d46507fce4..b8c304b164 100644 --- a/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf @@ -13,7 +13,7 @@ target Cpp { reactor Source { output[2] out: int - state count: int(0) + state count: int = 0 timer t(0, 200 msec) reaction(t) -> out {= diff --git a/test/Cpp/src/concurrent/AsyncCallback.lf b/test/Cpp/src/concurrent/AsyncCallback.lf index 29fedc41e8..49558f066e 100644 --- a/test/Cpp/src/concurrent/AsyncCallback.lf +++ b/test/Cpp/src/concurrent/AsyncCallback.lf @@ -12,11 +12,11 @@ main reactor AsyncCallback { timer t(0, 200 msec) state thread: {= std::thread =} - state expected_time: time(100 msec) - state toggle: bool(false) + state expected_time: time = 100 msec + state toggle: bool = false physical action a: int - state i: int(0) + state i: int = 0 reaction(t) -> a {= // make sure to join the old thread first diff --git a/test/Cpp/src/concurrent/AsyncCallback2.lf b/test/Cpp/src/concurrent/AsyncCallback2.lf index ea493a32cd..ab9f7daa9f 100644 --- a/test/Cpp/src/concurrent/AsyncCallback2.lf +++ b/test/Cpp/src/concurrent/AsyncCallback2.lf @@ -11,10 +11,10 @@ main reactor AsyncCallback2 { =} timer t(0, 200 msec) - state expected_time: time(0) + state expected_time: time = 0 logical action a: int - state i: int(0) + state i: int = 0 reaction(t) -> a {= // start new thread diff --git a/test/Cpp/src/concurrent/CompositionThreaded.lf b/test/Cpp/src/concurrent/CompositionThreaded.lf index 393b08e060..42817e8b1d 100644 --- a/test/Cpp/src/concurrent/CompositionThreaded.lf +++ b/test/Cpp/src/concurrent/CompositionThreaded.lf @@ -5,10 +5,10 @@ target Cpp { timeout: 10 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { output y: int timer t(1 sec, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -18,7 +18,7 @@ reactor Source(period: time(2 sec)) { reactor Test { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= count++; diff --git a/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf b/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf index eb88c997eb..bb380fe14c 100644 --- a/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf +++ b/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf @@ -2,7 +2,7 @@ // container reacts to that output. target Cpp -reactor Deadline(threshold: time(100 msec)) { +reactor Deadline(threshold: time = 100 msec) { input x: int output deadline_violation: bool @@ -16,7 +16,7 @@ reactor Deadline(threshold: time(100 msec)) { } main reactor { - state violation_detected: bool({= false =}) + state violation_detected: bool = {= false =} d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/Cpp/src/concurrent/DeadlineThreaded.lf b/test/Cpp/src/concurrent/DeadlineThreaded.lf index ad87c5a052..cb794f5050 100644 --- a/test/Cpp/src/concurrent/DeadlineThreaded.lf +++ b/test/Cpp/src/concurrent/DeadlineThreaded.lf @@ -5,13 +5,13 @@ target Cpp { timeout: 4 sec } -reactor Source(period: time(2 sec)) { +reactor Source(period: time = 2 sec) { private preamble {= #include =} output y: int timer t(0, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= if (count % 2 == 1) { @@ -25,9 +25,9 @@ reactor Source(period: time(2 sec)) { =} } -reactor Destination(timeout: time(1 sec)) { +reactor Destination(timeout: time = 1 sec) { input x: int - state count: int(0) + state count: int = 0 reaction(x) {= std::cout << "Destination receives: " << *x.get() << std::endl; diff --git a/test/Cpp/src/concurrent/DelayIntThreaded.lf b/test/Cpp/src/concurrent/DelayIntThreaded.lf index d935ae12e5..319cae8b76 100644 --- a/test/Cpp/src/concurrent/DelayIntThreaded.lf +++ b/test/Cpp/src/concurrent/DelayIntThreaded.lf @@ -1,7 +1,7 @@ // This tests actions with payloads by delaying an input by a fixed amount. target Cpp -reactor Delay(delay: time(100 msec)) { +reactor Delay(delay: time = 100 msec) { input in: int output out: int logical action d: int diff --git a/test/Cpp/src/concurrent/DoubleReactionThreaded.lf b/test/Cpp/src/concurrent/DoubleReactionThreaded.lf index 1c9c3041b6..d68f2e8b60 100644 --- a/test/Cpp/src/concurrent/DoubleReactionThreaded.lf +++ b/test/Cpp/src/concurrent/DoubleReactionThreaded.lf @@ -5,10 +5,10 @@ target Cpp { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -19,7 +19,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int input w: int - state s: int(2) + state s: int = 2 reaction(x, w) {= int sum = 0; diff --git a/test/Cpp/src/concurrent/GainThreaded.lf b/test/Cpp/src/concurrent/GainThreaded.lf index 8e96f44ed1..e88801f5a1 100644 --- a/test/Cpp/src/concurrent/GainThreaded.lf +++ b/test/Cpp/src/concurrent/GainThreaded.lf @@ -1,7 +1,7 @@ // Example in the Wiki. target Cpp -reactor Scale(scale: int(2)) { +reactor Scale(scale: int = 2) { input x: int output y: int diff --git a/test/Cpp/src/concurrent/HelloThreaded.lf b/test/Cpp/src/concurrent/HelloThreaded.lf index 7515d76d38..2c849b94dc 100644 --- a/test/Cpp/src/concurrent/HelloThreaded.lf +++ b/test/Cpp/src/concurrent/HelloThreaded.lf @@ -8,8 +8,11 @@ target Cpp { fast: true } -reactor HelloCpp(period: time(2 sec), message: {= std::string =}("Hello C++")) { - state count: int(0) +reactor HelloCpp( + period: time = 2 sec, + message: {= std::string =} = "Hello C++" +) { + state count: int = 0 state previous_time: {= reactor::TimePoint =} timer t(1 sec, period) logical action a: void @@ -37,8 +40,8 @@ reactor HelloCpp(period: time(2 sec), message: {= std::string =}("Hello C++")) { } reactor Inside( - period: time(1 sec), - message: {= std::string =}("Composite default message.") + period: time = 1 sec, + message: {= std::string =} = "Composite default message." ) { third_instance = new HelloCpp(period = period, message = message) } diff --git a/test/Cpp/src/concurrent/SendingInsideThreaded.lf b/test/Cpp/src/concurrent/SendingInsideThreaded.lf index a0e0fcc250..51ca511e26 100644 --- a/test/Cpp/src/concurrent/SendingInsideThreaded.lf +++ b/test/Cpp/src/concurrent/SendingInsideThreaded.lf @@ -7,7 +7,7 @@ target Cpp { reactor Printer { input x: int - state count: int(1) + state count: int = 1 reaction(x) {= std::cout << "Inside reactor received: " << *x.get() << std::endl; @@ -20,7 +20,7 @@ reactor Printer { } main reactor { - state count: int(0) + state count: int = 0 timer t(0, 1 sec) p = new Printer() diff --git a/test/Cpp/src/concurrent/Threaded.lf b/test/Cpp/src/concurrent/Threaded.lf index 0a0d857030..9ad4fcbe56 100644 --- a/test/Cpp/src/concurrent/Threaded.lf +++ b/test/Cpp/src/concurrent/Threaded.lf @@ -13,7 +13,7 @@ target Cpp { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= out.set(s); @@ -35,7 +35,7 @@ reactor Computation { } reactor Destination { - state s: int(0) + state s: int = 0 input in1: int input in2: int input in3: int diff --git a/test/Cpp/src/concurrent/ThreadedThreaded.lf b/test/Cpp/src/concurrent/ThreadedThreaded.lf index 2a6680273b..f8b21a6121 100644 --- a/test/Cpp/src/concurrent/ThreadedThreaded.lf +++ b/test/Cpp/src/concurrent/ThreadedThreaded.lf @@ -13,7 +13,7 @@ target Cpp { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= out.set(s); @@ -35,7 +35,7 @@ reactor Computation { } reactor Destination { - state s: int(0) + state s: int = 0 input[4] in: int reaction(in) {= diff --git a/test/Cpp/src/concurrent/TimeLimitThreaded.lf b/test/Cpp/src/concurrent/TimeLimitThreaded.lf index 5afcf05299..47371f72d7 100644 --- a/test/Cpp/src/concurrent/TimeLimitThreaded.lf +++ b/test/Cpp/src/concurrent/TimeLimitThreaded.lf @@ -6,10 +6,10 @@ target Cpp { fast: true } -reactor Clock(offset: time(0), period: time(1 sec)) { +reactor Clock(offset: time = 0, period: time = 1 sec) { output y: int timer t(offset, period) - state count: int(0) + state count: int = 0 reaction(t) -> y {= count++; @@ -20,7 +20,7 @@ reactor Clock(offset: time(0), period: time(1 sec)) { reactor Destination { input x: int - state s: int(1) + state s: int = 1 reaction(x) {= //std::cout << "Received " << *x.get() << '\n'; @@ -40,7 +40,7 @@ reactor Destination { =} } -main reactor(period: time(1 sec)) { +main reactor(period: time = 1 sec) { timer stop(10 sec) c = new Clock(period = period) d = new Destination() diff --git a/test/Cpp/src/enclave/EnclaveBank.lf b/test/Cpp/src/enclave/EnclaveBank.lf index b155bd9f57..8894526927 100644 --- a/test/Cpp/src/enclave/EnclaveBank.lf +++ b/test/Cpp/src/enclave/EnclaveBank.lf @@ -4,10 +4,10 @@ target Cpp { } reactor Node( - bank_index: size_t(0), - id: std::string({= "node" + std::to_string(bank_index) =}), - period: time(500 msec), - duration: time(10 msec) + bank_index: size_t = 0, + id: std::string = {= "node" + std::to_string(bank_index) =}, + period: time = 500 msec, + duration: time = 10 msec ) { logical action a: void diff --git a/test/Cpp/src/enclave/EnclaveBankEach.lf b/test/Cpp/src/enclave/EnclaveBankEach.lf index c632d2ae79..c6cdeac564 100644 --- a/test/Cpp/src/enclave/EnclaveBankEach.lf +++ b/test/Cpp/src/enclave/EnclaveBankEach.lf @@ -5,10 +5,10 @@ target Cpp { } reactor Node( - bank_index: size_t(0), - id: std::string({= "node" + std::to_string(bank_index) =}), - period: {= reactor::Duration =}({= 100ms * (bank_index+1) =}), - duration: {= reactor::Duration =}({= 50ms + 100ms * bank_index =}) + bank_index: size_t = 0, + id: std::string = {= "node" + std::to_string(bank_index) =}, + period: {= reactor::Duration =} = {= 100ms * (bank_index+1) =}, + duration: {= reactor::Duration =} = {= 50ms + 100ms * bank_index =} ) { logical action a: void diff --git a/test/Cpp/src/enclave/EnclaveHelloWorld.lf b/test/Cpp/src/enclave/EnclaveHelloWorld.lf index ab28317cf9..7ca051533b 100644 --- a/test/Cpp/src/enclave/EnclaveHelloWorld.lf +++ b/test/Cpp/src/enclave/EnclaveHelloWorld.lf @@ -1,10 +1,10 @@ target Cpp -reactor Hello(msg: std::string("World")) { +reactor Hello(msg: std::string = "World") { reaction(startup) {= reactor::log::Info() << "Hello " << msg << '!'; =} } -main reactor(msg1: std::string("World"), msg2: std::string("Enclave")) { +main reactor(msg1: std::string = "World", msg2: std::string = "Enclave") { hello1 = new Hello(msg = msg1) @enclave diff --git a/test/Cpp/src/enclave/EnclaveHierarchy.lf b/test/Cpp/src/enclave/EnclaveHierarchy.lf index 87c811f859..9063942575 100644 --- a/test/Cpp/src/enclave/EnclaveHierarchy.lf +++ b/test/Cpp/src/enclave/EnclaveHierarchy.lf @@ -4,9 +4,9 @@ target Cpp { } reactor Node( - id: std::string("node"), - period: time(100 msec), - duration: time(50 msec) + id: std::string = "node", + period: time = 100 msec, + duration: time = 50 msec ) { timer t(0, period) diff --git a/test/Cpp/src/enclave/EnclaveShutdown.lf b/test/Cpp/src/enclave/EnclaveShutdown.lf index 7d25a53643..831adcde9c 100644 --- a/test/Cpp/src/enclave/EnclaveShutdown.lf +++ b/test/Cpp/src/enclave/EnclaveShutdown.lf @@ -1,9 +1,9 @@ target Cpp reactor Node( - message: std::string("Hello"), - period: time(1 sec), - stop: time(3 sec) + message: std::string = "Hello", + period: time = 1 sec, + stop: time = 3 sec ) { timer t(0, period) timer s(stop) diff --git a/test/Cpp/src/enclave/EnclaveTimeout.lf b/test/Cpp/src/enclave/EnclaveTimeout.lf index c9dd51498f..dc87acbd26 100644 --- a/test/Cpp/src/enclave/EnclaveTimeout.lf +++ b/test/Cpp/src/enclave/EnclaveTimeout.lf @@ -2,7 +2,7 @@ target Cpp { timeout: 1 sec } -reactor Node(message: std::string("Hello"), period: time(1 sec)) { +reactor Node(message: std::string = "Hello", period: time = 1 sec) { timer t(0, period) reaction(t) {= reactor::log::Info() << message; =} diff --git a/test/Cpp/src/lib/Count.lf b/test/Cpp/src/lib/Count.lf index aaf689b720..7b56233019 100644 --- a/test/Cpp/src/lib/Count.lf +++ b/test/Cpp/src/lib/Count.lf @@ -3,7 +3,7 @@ target Cpp reactor Count { output c: int timer t(0, 1 sec) - state i: int(0) + state i: int = 0 reaction(t) -> c {= i++; diff --git a/test/Cpp/src/lib/LoopedActionSender.lf b/test/Cpp/src/lib/LoopedActionSender.lf index db35b7a606..3c1cc13631 100644 --- a/test/Cpp/src/lib/LoopedActionSender.lf +++ b/test/Cpp/src/lib/LoopedActionSender.lf @@ -13,10 +13,10 @@ target Cpp * @param break_interval: Determines how long the reactor should take a break * after sending take_a_break_after messages. */ -reactor Sender(take_a_break_after: int(10), break_interval: time(400 msec)) { +reactor Sender(take_a_break_after: int = 10, break_interval: time = 400 msec) { output out: int logical action act - state sent_messages: int(0) + state sent_messages: int = 0 reaction(startup, act) -> act, out {= out.set(sent_messages); diff --git a/test/Cpp/src/multiport/BankSelfBroadcast.lf b/test/Cpp/src/multiport/BankSelfBroadcast.lf index a32e3a8eac..07da948506 100644 --- a/test/Cpp/src/multiport/BankSelfBroadcast.lf +++ b/test/Cpp/src/multiport/BankSelfBroadcast.lf @@ -8,10 +8,10 @@ */ target Cpp -reactor A(bank_index: size_t(0)) { +reactor A(bank_index: size_t = 0) { input[4] in: size_t output out: size_t - state received: bool(false) + state received: bool = false reaction(startup) -> out {= out.set(bank_index); =} diff --git a/test/Cpp/src/multiport/BankToBank.lf b/test/Cpp/src/multiport/BankToBank.lf index 84fc29ea09..f70cfd83e4 100644 --- a/test/Cpp/src/multiport/BankToBank.lf +++ b/test/Cpp/src/multiport/BankToBank.lf @@ -4,10 +4,10 @@ target Cpp { fast: true } -reactor Source(bank_index: size_t(0)) { +reactor Source(bank_index: size_t = 0) { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= out.set(s); @@ -15,8 +15,8 @@ reactor Source(bank_index: size_t(0)) { =} } -reactor Destination(bank_index: size_t(0)) { - state s: int(0) +reactor Destination(bank_index: size_t = 0) { + state s: int = 0 input in: int reaction(in) {= @@ -37,7 +37,7 @@ reactor Destination(bank_index: size_t(0)) { =} } -main reactor BankToBank(width: int(4)) { +main reactor BankToBank(width: int = 4) { // FIXME: Should set the width to "width" rather than "4". a = new[4] Source() b = new[4] Destination() diff --git a/test/Cpp/src/multiport/BankToBankMultiport.lf b/test/Cpp/src/multiport/BankToBankMultiport.lf index e5c26a4d2b..bdb3e9a880 100644 --- a/test/Cpp/src/multiport/BankToBankMultiport.lf +++ b/test/Cpp/src/multiport/BankToBankMultiport.lf @@ -4,10 +4,10 @@ target Cpp { fast: true } -reactor Source(width: size_t(1)) { +reactor Source(width: size_t = 1) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(size_t i = 0; i < out.size(); i++) { @@ -16,8 +16,8 @@ reactor Source(width: size_t(1)) { =} } -reactor Destination(width: size_t(1)) { - state s: int(6) +reactor Destination(width: size_t = 1) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -44,7 +44,7 @@ reactor Destination(width: size_t(1)) { =} } -main reactor(bank_width: size_t(4)) { +main reactor(bank_width: size_t = 4) { a = new[bank_width] Source(width = 4) b = new[bank_width] Destination(width = 4) a.out -> b.in diff --git a/test/Cpp/src/multiport/BankToBankMultiportAfter.lf b/test/Cpp/src/multiport/BankToBankMultiportAfter.lf index 436a647f94..78d832a5ea 100644 --- a/test/Cpp/src/multiport/BankToBankMultiportAfter.lf +++ b/test/Cpp/src/multiport/BankToBankMultiportAfter.lf @@ -4,10 +4,10 @@ target Cpp { fast: true } -reactor Source(width: size_t(1)) { +reactor Source(width: size_t = 1) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(size_t i = 0; i < out.size(); i++) { @@ -16,9 +16,9 @@ reactor Source(width: size_t(1)) { =} } -reactor Destination(width: size_t(1)) { - state s: int(6) - state iterations: unsigned(0) +reactor Destination(width: size_t = 1) { + state s: int = 6 + state iterations: unsigned = 0 input[width] in: int reaction(in) {= @@ -52,7 +52,7 @@ reactor Destination(width: size_t(1)) { =} } -main reactor(bank_width: size_t(4)) { +main reactor(bank_width: size_t = 4) { a = new[bank_width] Source(width = 4) b = new[bank_width] Destination(width = 4) a.out -> b.in after 200 msec diff --git a/test/Cpp/src/multiport/BankToMultiport.lf b/test/Cpp/src/multiport/BankToMultiport.lf index d8132b2630..6b1acf7591 100644 --- a/test/Cpp/src/multiport/BankToMultiport.lf +++ b/test/Cpp/src/multiport/BankToMultiport.lf @@ -1,7 +1,7 @@ // Test bank of reactors to multiport input with id parameter in the bank. target Cpp -reactor Source(bank_index: size_t(0)) { +reactor Source(bank_index: size_t = 0) { output out: unsigned reaction(startup) -> out {= out.set(bank_index); =} @@ -9,7 +9,7 @@ reactor Source(bank_index: size_t(0)) { reactor Sink { input[4] in: unsigned - state received: bool(false) + state received: bool = false reaction(in) {= for (unsigned i = 0; i < in.size(); i++) { diff --git a/test/Cpp/src/multiport/Broadcast.lf b/test/Cpp/src/multiport/Broadcast.lf index 471bc92172..077ca75247 100644 --- a/test/Cpp/src/multiport/Broadcast.lf +++ b/test/Cpp/src/multiport/Broadcast.lf @@ -6,7 +6,7 @@ reactor Source { reaction(startup) -> out {= out.set(42); =} } -reactor Sink(bank_index: size_t(0)) { +reactor Sink(bank_index: size_t = 0) { input in: unsigned reaction(in) {= diff --git a/test/Cpp/src/multiport/BroadcastAfter.lf b/test/Cpp/src/multiport/BroadcastAfter.lf index 7f0ee66712..6cb7f84f4d 100644 --- a/test/Cpp/src/multiport/BroadcastAfter.lf +++ b/test/Cpp/src/multiport/BroadcastAfter.lf @@ -8,9 +8,9 @@ reactor Source { reaction(startup) -> out {= out.set(42); =} } -reactor Sink(bank_index: size_t(0)) { +reactor Sink(bank_index: size_t = 0) { input in: unsigned - state received: bool{false} + state received: bool = false reaction(in) {= std::cout << bank_index << " received " << *in.get() << '\n'; diff --git a/test/Cpp/src/multiport/BroadcastMultipleAfter.lf b/test/Cpp/src/multiport/BroadcastMultipleAfter.lf index 84051887ca..065e9bf403 100644 --- a/test/Cpp/src/multiport/BroadcastMultipleAfter.lf +++ b/test/Cpp/src/multiport/BroadcastMultipleAfter.lf @@ -2,15 +2,15 @@ target Cpp { fast: true } -reactor Source(value: unsigned(42)) { +reactor Source(value: unsigned = 42) { output out: unsigned reaction(startup) -> out {= out.set(value); =} } -reactor Sink(bank_index: size_t(0)) { +reactor Sink(bank_index: size_t = 0) { input in: unsigned - state received: bool{false} + state received: bool = false reaction(in) {= std::cout << bank_index << " received " << *in.get() << '\n'; diff --git a/test/Cpp/src/multiport/FullyConnected.lf b/test/Cpp/src/multiport/FullyConnected.lf index c925460402..0b0a66405e 100644 --- a/test/Cpp/src/multiport/FullyConnected.lf +++ b/test/Cpp/src/multiport/FullyConnected.lf @@ -1,10 +1,10 @@ target Cpp -reactor Node(bank_index: size_t(0), num_nodes: size_t(4)) { +reactor Node(bank_index: size_t = 0, num_nodes: size_t = 4) { input[num_nodes] in: size_t output out: size_t - state received: bool{false} + state received: bool = false reaction(startup) -> out {= std::cout << "Hello from node " << bank_index << "!\n"; @@ -36,7 +36,7 @@ reactor Node(bank_index: size_t(0), num_nodes: size_t(4)) { =} } -main reactor(num_nodes: size_t(4)) { +main reactor(num_nodes: size_t = 4) { nodes = new[num_nodes] Node(num_nodes = num_nodes) (nodes.out)+ -> nodes.in } diff --git a/test/Cpp/src/multiport/FullyConnectedAddressable.lf b/test/Cpp/src/multiport/FullyConnectedAddressable.lf index 2a756c328f..5385c44222 100644 --- a/test/Cpp/src/multiport/FullyConnectedAddressable.lf +++ b/test/Cpp/src/multiport/FullyConnectedAddressable.lf @@ -1,11 +1,11 @@ // In this pattern, each node can send direct messages to individual other nodes target Cpp -reactor Node(bank_index: size_t(0), num_nodes: size_t(4)) { +reactor Node(bank_index: size_t = 0, num_nodes: size_t = 4) { input[num_nodes] in: size_t output[num_nodes] out: size_t - state received: bool{false} + state received: bool = false reaction(startup) -> out {= std::cout << "Hello from node " << bank_index << "!\n"; @@ -41,7 +41,7 @@ reactor Node(bank_index: size_t(0), num_nodes: size_t(4)) { =} } -main reactor(num_nodes: size_t(4)) { +main reactor(num_nodes: size_t = 4) { nodes1 = new[num_nodes] Node(num_nodes = num_nodes) nodes1.out -> interleaved (nodes1.in) diff --git a/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf b/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf index e331494b1b..c6fcb4c9e6 100644 --- a/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf +++ b/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf @@ -3,7 +3,7 @@ target Cpp import Node from "FullyConnectedAddressable.lf" -main reactor(num_nodes: size_t(4)) { +main reactor(num_nodes: size_t = 4) { nodes1 = new[num_nodes] Node(num_nodes = num_nodes) nodes1.out -> interleaved (nodes1.in) after 200 msec diff --git a/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf b/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf index bf00c15081..964e2e7095 100644 --- a/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf +++ b/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf @@ -8,7 +8,7 @@ */ target Cpp -reactor ReactorWithMultiport(width: size_t(3)) { +reactor ReactorWithMultiport(width: size_t = 3) { output[width] out: int reaction(startup) -> out {= @@ -18,7 +18,7 @@ reactor ReactorWithMultiport(width: size_t(3)) { =} } -reactor MultiportSplitter(width: size_t(3)) { +reactor MultiportSplitter(width: size_t = 3) { input[width] in: int output out0: int @@ -34,9 +34,9 @@ main reactor IndexIntoMultiportOutput { source.out -> splitter.in - state received0: bool{false} - state received1: bool{false} - state received2: bool{false} + state received0: bool = false + state received1: bool = false + state received2: bool = false reaction(splitter.out0) {= received0 = true; diff --git a/test/Cpp/src/multiport/Multiport.lf b/test/Cpp/src/multiport/Multiport.lf index 946282566f..a63924c67c 100644 --- a/test/Cpp/src/multiport/Multiport.lf +++ b/test/Cpp/src/multiport/Multiport.lf @@ -21,7 +21,7 @@ reactor Test { main reactor Multiport { test = new Test() - state received: bool(false) + state received: bool = false reaction(startup) -> test.sink {= for (auto i = 0; i < 30; i++) { diff --git a/test/Cpp/src/multiport/MultiportFromBank.lf b/test/Cpp/src/multiport/MultiportFromBank.lf index 61d33e2a4c..b7339a9184 100644 --- a/test/Cpp/src/multiport/MultiportFromBank.lf +++ b/test/Cpp/src/multiport/MultiportFromBank.lf @@ -5,15 +5,15 @@ target Cpp { fast: true } -reactor Source(bank_index: size_t(0)) { +reactor Source(bank_index: size_t = 0) { output out: unsigned reaction(startup) -> out {= out.set(bank_index); =} } -reactor Destination(port_width: size_t(2)) { +reactor Destination(port_width: size_t = 2) { input[port_width] in: unsigned - state received: bool(false) + state received: bool = false reaction(in) {= for (size_t i = 0; i < in.size(); i++) { @@ -35,7 +35,7 @@ reactor Destination(port_width: size_t(2)) { =} } -main reactor(width: size_t(4)) { +main reactor(width: size_t = 4) { a = new[width] Source() b = new Destination(port_width = width) a.out -> b.in diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf index ec75a59be4..673ef6889a 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf @@ -5,7 +5,7 @@ target Cpp { fast: true } -reactor Source(bank_index: size_t(0)) { +reactor Source(bank_index: size_t = 0) { output out: unsigned reaction(startup) -> out {= out.set(bank_index); =} @@ -19,7 +19,7 @@ reactor Container { reactor Destination { input[3] in: unsigned - state received: bool(false) + state received: bool = false reaction(in) {= for (size_t i = 0; i < in.size(); i++) { diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf index fd0cb4c693..fe27c74f35 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf @@ -5,7 +5,7 @@ target Cpp { fast: true } -reactor Source(bank_index: size_t(0)) { +reactor Source(bank_index: size_t = 0) { output out: int reaction(startup) -> out {= out.set(bank_index); =} @@ -19,7 +19,7 @@ reactor Container { reactor Destination { input[3] in: int - state received: bool(false) + state received: bool = false reaction(in) {= for (int i = 0; i < in.size(); i++) { diff --git a/test/Cpp/src/multiport/MultiportFromHierarchy.lf b/test/Cpp/src/multiport/MultiportFromHierarchy.lf index c63285af13..fae914b609 100644 --- a/test/Cpp/src/multiport/MultiportFromHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportFromHierarchy.lf @@ -8,7 +8,7 @@ target Cpp { reactor Source { timer t(0, 200 msec) output[4] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < 4; i++) { @@ -18,7 +18,7 @@ reactor Source { } reactor Destination { - state s: int(6) + state s: int = 6 input[4] in: int reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportIn.lf b/test/Cpp/src/multiport/MultiportIn.lf index 31f06bd956..39fce6f8ff 100644 --- a/test/Cpp/src/multiport/MultiportIn.lf +++ b/test/Cpp/src/multiport/MultiportIn.lf @@ -8,7 +8,7 @@ target Cpp { reactor Source { timer t(0, 200 msec) output out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= out.set(s++); =} } @@ -21,7 +21,7 @@ reactor Computation { } reactor Destination { - state s: int(0) + state s: int = 0 input[4] in: int reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportOut.lf b/test/Cpp/src/multiport/MultiportOut.lf index b4d5e00425..53f2a5bb23 100644 --- a/test/Cpp/src/multiport/MultiportOut.lf +++ b/test/Cpp/src/multiport/MultiportOut.lf @@ -7,7 +7,7 @@ target Cpp { reactor Source { timer t(0, 200 msec) output[4] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < 4; i++) { @@ -31,7 +31,7 @@ reactor Computation { } reactor Destination { - state s: int(0) + state s: int = 0 input[4] in: int reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportToBank.lf b/test/Cpp/src/multiport/MultiportToBank.lf index 898ccf7b97..fa2f79419f 100644 --- a/test/Cpp/src/multiport/MultiportToBank.lf +++ b/test/Cpp/src/multiport/MultiportToBank.lf @@ -10,7 +10,7 @@ reactor Source { =} } -reactor Sink(bank_index: size_t(0)) { +reactor Sink(bank_index: size_t = 0) { input in: unsigned reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportToBankAfter.lf b/test/Cpp/src/multiport/MultiportToBankAfter.lf index 546e569e24..c05730680f 100644 --- a/test/Cpp/src/multiport/MultiportToBankAfter.lf +++ b/test/Cpp/src/multiport/MultiportToBankAfter.lf @@ -10,7 +10,7 @@ reactor Source { =} } -reactor Sink(bank_index: size_t(0)) { +reactor Sink(bank_index: size_t = 0) { input in: unsigned reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportToBankHierarchy.lf b/test/Cpp/src/multiport/MultiportToBankHierarchy.lf index 11671f98bb..f9cef6a676 100644 --- a/test/Cpp/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportToBankHierarchy.lf @@ -15,9 +15,9 @@ reactor Source { =} } -reactor Destination(bank_index: size_t(0)) { +reactor Destination(bank_index: size_t = 0) { input in: unsigned - state received: bool(false) + state received: bool = false reaction(in) {= std::cout << "Destination " << bank_index << " received " << *in.get() << ".\n"; diff --git a/test/Cpp/src/multiport/MultiportToHierarchy.lf b/test/Cpp/src/multiport/MultiportToHierarchy.lf index e0daa5a4c0..573a0e06da 100644 --- a/test/Cpp/src/multiport/MultiportToHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportToHierarchy.lf @@ -6,10 +6,10 @@ target Cpp { fast: true } -reactor Source(width: size_t(4)) { +reactor Source(width: size_t = 4) { timer t(0, 200 msec) output[width] out: int - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(size_t i = 0; i < 4; i++) { @@ -18,8 +18,8 @@ reactor Source(width: size_t(4)) { =} } -reactor Destination(width: size_t(4)) { - state s: int(6) +reactor Destination(width: size_t = 4) { + state s: int = 6 input[width] in: int reaction(in) {= @@ -45,13 +45,13 @@ reactor Destination(width: size_t(4)) { =} } -reactor Container(width: size_t(4)) { +reactor Container(width: size_t = 4) { input[width] in: int dst = new Destination() in -> dst.in } -main reactor MultiportToHierarchy(width: size_t(4)) { +main reactor MultiportToHierarchy(width: size_t = 4) { a = new Source(width = width) b = new Container(width = width) a.out -> b.in diff --git a/test/Cpp/src/multiport/MultiportToMultiport.lf b/test/Cpp/src/multiport/MultiportToMultiport.lf index c7b673ea11..37a1ee5222 100644 --- a/test/Cpp/src/multiport/MultiportToMultiport.lf +++ b/test/Cpp/src/multiport/MultiportToMultiport.lf @@ -12,7 +12,7 @@ reactor Source { reactor Sink { input[4] in: unsigned - state received: bool(false) + state received: bool = false reaction(in) {= for (unsigned i = 0; i < in.size(); i++) { diff --git a/test/Cpp/src/multiport/MultiportToMultiport2.lf b/test/Cpp/src/multiport/MultiportToMultiport2.lf index ac0151731f..165f3201ce 100644 --- a/test/Cpp/src/multiport/MultiportToMultiport2.lf +++ b/test/Cpp/src/multiport/MultiportToMultiport2.lf @@ -1,7 +1,7 @@ // Test multiport to multiport connections. See also MultiportToMultiport. target Cpp -reactor Source(width: size_t(2)) { +reactor Source(width: size_t = 2) { output[width] out: size_t reaction(startup) -> out {= @@ -11,7 +11,7 @@ reactor Source(width: size_t(2)) { =} } -reactor Destination(width: size_t(2)) { +reactor Destination(width: size_t = 2) { input[width] in: size_t reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportToMultiport2After.lf b/test/Cpp/src/multiport/MultiportToMultiport2After.lf index b015bfe827..781275b2f4 100644 --- a/test/Cpp/src/multiport/MultiportToMultiport2After.lf +++ b/test/Cpp/src/multiport/MultiportToMultiport2After.lf @@ -1,7 +1,7 @@ // Test multiport to multiport connections. See also MultiportToMultiport. target Cpp -reactor Source(width: size_t(2)) { +reactor Source(width: size_t = 2) { output[width] out: size_t reaction(startup) -> out {= @@ -11,7 +11,7 @@ reactor Source(width: size_t(2)) { =} } -reactor Destination(width: size_t(2)) { +reactor Destination(width: size_t = 2) { input[width] in: size_t reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportToMultiportArray.lf b/test/Cpp/src/multiport/MultiportToMultiportArray.lf index 077aab0f9d..6c96d17150 100644 --- a/test/Cpp/src/multiport/MultiportToMultiportArray.lf +++ b/test/Cpp/src/multiport/MultiportToMultiportArray.lf @@ -8,7 +8,7 @@ target Cpp { reactor Source { timer t(0, 200 msec) output[2] out: int[3] - state s: int(0) + state s: int = 0 reaction(t) -> out {= for(int i = 0; i < 2; i++) { @@ -25,7 +25,7 @@ reactor Source { } reactor Destination { - state s: int(15) + state s: int = 15 input[2] in: int[3] reaction(in) {= diff --git a/test/Cpp/src/multiport/MultiportToPort.lf b/test/Cpp/src/multiport/MultiportToPort.lf index 107198c9cc..c2b0bd66ef 100644 --- a/test/Cpp/src/multiport/MultiportToPort.lf +++ b/test/Cpp/src/multiport/MultiportToPort.lf @@ -16,9 +16,9 @@ reactor Source { =} } -reactor Destination(expected: int(0)) { +reactor Destination(expected: int = 0) { input in: int - state received: bool(false) + state received: bool = false reaction(in) {= std::cout << "Received: " << *in.get() << ".\n"; diff --git a/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf b/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf index c6bbcf1242..6fa6dbb87b 100644 --- a/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf +++ b/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf @@ -2,7 +2,7 @@ // multiport target Cpp -reactor Contained(bank_index: size_t(0)) { +reactor Contained(bank_index: size_t = 0) { output[3] out: unsigned reaction(startup) -> out {= @@ -14,7 +14,7 @@ reactor Contained(bank_index: size_t(0)) { main reactor { c = new[3] Contained() - state count: int(0) + state count: int = 0 reaction(startup) c.out {= for (size_t i = 0; i < c.size(); i++) { diff --git a/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf b/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf index 81deaf91f2..18179b9086 100644 --- a/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf +++ b/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf @@ -2,7 +2,7 @@ // permutations. target Cpp -reactor Contained(bank_index: size_t(0)) { +reactor Contained(bank_index: size_t = 0) { output out: unsigned reaction(startup) -> out {= out.set(42 * bank_index); =} @@ -10,7 +10,7 @@ reactor Contained(bank_index: size_t(0)) { main reactor { c = new[4] Contained() - state count: int(0) + state count: int = 0 reaction(startup) c.out {= for (size_t i = 0; i < c.size(); i++) { diff --git a/test/Cpp/src/multiport/WidthGivenByCode.lf b/test/Cpp/src/multiport/WidthGivenByCode.lf index 52c2f84b36..10a2a59489 100644 --- a/test/Cpp/src/multiport/WidthGivenByCode.lf +++ b/test/Cpp/src/multiport/WidthGivenByCode.lf @@ -1,6 +1,6 @@ target Cpp -reactor Foo(a: size_t{8}, b: size_t{2}) { +reactor Foo(a: size_t = 8, b: size_t = 2) { input[{= a*b =}] in: size_t output[{= a/b =}] out: size_t diff --git a/test/Cpp/src/multiport/WriteInputOfContainedBank.lf b/test/Cpp/src/multiport/WriteInputOfContainedBank.lf index 3824664e35..b8f8d50958 100644 --- a/test/Cpp/src/multiport/WriteInputOfContainedBank.lf +++ b/test/Cpp/src/multiport/WriteInputOfContainedBank.lf @@ -1,9 +1,9 @@ // Test writing inputs to a contained reactor bank target Cpp -reactor Contained(bank_index: size_t(0)) { +reactor Contained(bank_index: size_t = 0) { input in: unsigned - state count: int(0) + state count: int = 0 reaction(in) {= unsigned result = *in.get(); diff --git a/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf b/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf index 49e0614842..5ffe567dfb 100644 --- a/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf +++ b/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf @@ -1,9 +1,9 @@ // Test writing multiport inputs to a contained reactor bank target Cpp -reactor Contained(bank_index: size_t(0)) { +reactor Contained(bank_index: size_t = 0) { input[4] in: unsigned - state count: int(0) + state count: int = 0 reaction(in) {= for (size_t i = 0; i < 3; i++) { diff --git a/test/Cpp/src/properties/Fast.lf b/test/Cpp/src/properties/Fast.lf index a12cbfaf01..1d4ba25d2f 100644 --- a/test/Cpp/src/properties/Fast.lf +++ b/test/Cpp/src/properties/Fast.lf @@ -5,7 +5,7 @@ target Cpp { main reactor { logical action a - state triggered: bool{false} + state triggered: bool = false reaction(startup) -> a {= a.schedule(2s); =} diff --git a/test/Cpp/src/properties/Keepalive.lf b/test/Cpp/src/properties/Keepalive.lf index 1fe6c5e1bc..78c347c8fd 100644 --- a/test/Cpp/src/properties/Keepalive.lf +++ b/test/Cpp/src/properties/Keepalive.lf @@ -11,7 +11,7 @@ main reactor { state thread: std::thread physical action a - state success: bool{false} + state success: bool = false reaction(startup) -> a {= // start new thread diff --git a/test/Cpp/src/properties/Timeout.lf b/test/Cpp/src/properties/Timeout.lf index 50f647349f..57c55ad24c 100644 --- a/test/Cpp/src/properties/Timeout.lf +++ b/test/Cpp/src/properties/Timeout.lf @@ -5,7 +5,7 @@ target Cpp { main reactor { timer t(1 sec, 1 sec) - state triggered: bool{false} + state triggered: bool = false reaction(t) {= triggered = true; diff --git a/test/Cpp/src/properties/TimeoutZero.lf b/test/Cpp/src/properties/TimeoutZero.lf index 96409f692e..9d04fa8048 100644 --- a/test/Cpp/src/properties/TimeoutZero.lf +++ b/test/Cpp/src/properties/TimeoutZero.lf @@ -5,7 +5,7 @@ target Cpp { main reactor { timer t(0, 1 sec) - state triggered: bool{false} + state triggered: bool = false reaction(t) {= triggered = true; diff --git a/test/Cpp/src/target/AfterVoid.lf b/test/Cpp/src/target/AfterVoid.lf index 0b9beadcff..555e024e6b 100644 --- a/test/Cpp/src/target/AfterVoid.lf +++ b/test/Cpp/src/target/AfterVoid.lf @@ -12,8 +12,8 @@ reactor foo { } reactor print { - state expected_time: time(10 msec) - state i: int(0) + state expected_time: time = 10 msec + state i: int = 0 input x: void reaction(x) {= diff --git a/test/Cpp/src/target/CliParserGenericArguments.lf b/test/Cpp/src/target/CliParserGenericArguments.lf index eb75ac2ef6..da95c78d5f 100644 --- a/test/Cpp/src/target/CliParserGenericArguments.lf +++ b/test/Cpp/src/target/CliParserGenericArguments.lf @@ -43,20 +43,20 @@ private preamble {= =} main reactor CliParserGenericArguments( - int_value: int(10), - signed_value: signed(-10), - unsigned_value: unsigned(11), - long_value: long(-100), - unsigned_long_value: {= unsigned_long =}(42), - long_long_value: {= long_long =}(-42), - ull_value: {= uns_long_long =}(42), - bool_value: bool(false), - char_value: char('T'), - double_value: double(4.2), - long_double_value: {= long_double =}(4.2), - float_value: float(10.5), - string_value: string("This is a testvalue"), - custom_class_value: {= CustomClass =}("Peter") + int_value: int = 10, + signed_value: signed = -10, + unsigned_value: unsigned = 11, + long_value: long = -100, + unsigned_long_value: {= unsigned_long =} = 42, + long_long_value: {= long_long =} = -42, + ull_value: {= uns_long_long =} = 42, + bool_value: bool = false, + char_value: char = 'T', + double_value: double = 4.2, + long_double_value: {= long_double =} = 4.2, + float_value: float = 10.5, + string_value: string = "This is a testvalue", + custom_class_value: {= CustomClass =} = "Peter" ) { reaction(startup) {= std::cout << "Hello World!\n"; =} } diff --git a/test/Cpp/src/target/CombinedTypeNames.lf b/test/Cpp/src/target/CombinedTypeNames.lf index 28182b7bf7..d55c70a823 100644 --- a/test/Cpp/src/target/CombinedTypeNames.lf +++ b/test/Cpp/src/target/CombinedTypeNames.lf @@ -3,11 +3,11 @@ target Cpp reactor Foo( - bar: {= unsigned int =}(0), - baz: {= const unsigned int* =}({= nullptr =}) + bar: {= unsigned int =} = 0, + baz: {= const unsigned int* =} = {= nullptr =} ) { - state s_bar: {= unsigned int =}(bar) - state s_baz: {= const unsigned int* =}(baz) + state s_bar: {= unsigned int =} = bar + state s_baz: {= const unsigned int* =} = baz reaction(startup) {= if (bar != 42 || s_bar != 42 || *baz != 42 || *s_baz != 42) { @@ -17,6 +17,6 @@ reactor Foo( =} } -main reactor(bar: {= unsigned int =}(42)) { +main reactor(bar: {= unsigned int =} = 42) { foo = new Foo(bar = bar, baz = {= &bar =}) } diff --git a/test/Cpp/src/target/GenericDelay.lf b/test/Cpp/src/target/GenericDelay.lf index 135c04f417..5efa81b011 100644 --- a/test/Cpp/src/target/GenericDelay.lf +++ b/test/Cpp/src/target/GenericDelay.lf @@ -2,7 +2,7 @@ target Cpp import Test from "../DelayInt.lf" -reactor Delay(delay: time(0)) { +reactor Delay(delay: time = 0) { output out: T input in: T logical action a(delay): T diff --git a/test/Cpp/src/target/GenericParameterAndState.lf b/test/Cpp/src/target/GenericParameterAndState.lf index d259bf3b22..6803eb9509 100644 --- a/test/Cpp/src/target/GenericParameterAndState.lf +++ b/test/Cpp/src/target/GenericParameterAndState.lf @@ -1,7 +1,7 @@ target Cpp -reactor Foo(bar: T(0), expected: T(14542135)) { - state baz: T(bar) +reactor Foo(bar: T = 0, expected: T = 14542135) { + state baz: T = bar reaction(startup) {= if (bar != expected) { diff --git a/test/Cpp/src/target/PointerParameters.lf b/test/Cpp/src/target/PointerParameters.lf index cb8675d014..a769f20da3 100644 --- a/test/Cpp/src/target/PointerParameters.lf +++ b/test/Cpp/src/target/PointerParameters.lf @@ -2,7 +2,7 @@ // Compilation without errors is success. target Cpp -reactor Foo(ptr: int*{{= nullptr =}}) { +reactor Foo(ptr: int* = {= nullptr =}) { reaction(startup) {= if (ptr == nullptr || *ptr != 42) { reactor::log::Error() << "received an unexpected value!"; From 227010908250e84fbed8466154344f983d2fbcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 2 Feb 2023 15:55:24 +0100 Subject: [PATCH 10/49] Codegen C++ assignment differently --- org.lflang/src/org/lflang/generator/cpp/CppTypes.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt index e0a7103f20..066f4716b6 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt @@ -71,14 +71,15 @@ val TimeUnit?.cppUnit /** * Returns a C++ variable initializer. */ -fun CppTypes.getCppInitializer(init: Initializer?, inferredType: InferredType): String { - return if (init == null) { +fun CppTypes.getCppInitializer(init: Initializer?, inferredType: InferredType): String = + if (init == null) { "/*uninitialized*/" + } else if (init.isAssign) { + val e = init.exprs.single() + " = " + getTargetExpr(e, inferredType) } else { - assert(init.isBraces || init.isParens) val (prefix, postfix) = if (init.isBraces) Pair("{", "}") else Pair("(", ")") init.exprs.joinToString(", ", prefix, postfix) { getTargetExpr(it, inferredType.componentType) } } -} \ No newline at end of file From 78eacad6a6c2b01e4dac758dc88ab321ba9a8b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 2 Feb 2023 16:28:35 +0100 Subject: [PATCH 11/49] Probably fix C++ gen --- .../src/org/lflang/generator/cpp/CppParameterGenerator.kt | 2 +- org.lflang/src/org/lflang/generator/cpp/CppStateGenerator.kt | 2 +- org.lflang/src/org/lflang/generator/cpp/CppTypes.kt | 4 ++-- test/Cpp/src/ActionIsPresent.lf | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt b/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt index a460290287..fcefc8be41 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt @@ -53,7 +53,7 @@ class CppParameterGenerator(private val reactor: Reactor) { """ using $typeAlias = $targetType; const $typeAlias $name${ - if (init == null) "" else " = " + typeAlias + CppTypes.getCppInitializer( + if (init == null) "" else CppTypes.getCppInitializer( init, inferredType ) diff --git a/org.lflang/src/org/lflang/generator/cpp/CppStateGenerator.kt b/org.lflang/src/org/lflang/generator/cpp/CppStateGenerator.kt index 4b26328155..1d5050fee9 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppStateGenerator.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppStateGenerator.kt @@ -42,6 +42,6 @@ class CppStateGenerator(private val reactor: Reactor) { fun generateInitializers(): String = reactor.stateVars.filter { it.isInitialized } .joinWithLn(prefix = "// state variables\n") { - ", " + it.name + CppTypes.getCppInitializer(it.init, it.inferredType) + ", " + it.name + CppTypes.getCppInitializer(it.init, it.inferredType, disableEquals = true) } } diff --git a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt index 066f4716b6..fbfcb73452 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt @@ -71,10 +71,10 @@ val TimeUnit?.cppUnit /** * Returns a C++ variable initializer. */ -fun CppTypes.getCppInitializer(init: Initializer?, inferredType: InferredType): String = +fun CppTypes.getCppInitializer(init: Initializer?, inferredType: InferredType, disableEquals: Boolean = false): String = if (init == null) { "/*uninitialized*/" - } else if (init.isAssign) { + } else if (init.isAssign && !disableEquals) { val e = init.exprs.single() " = " + getTargetExpr(e, inferredType) } else { diff --git a/test/Cpp/src/ActionIsPresent.lf b/test/Cpp/src/ActionIsPresent.lf index aff1daeb63..e98c2a2a32 100644 --- a/test/Cpp/src/ActionIsPresent.lf +++ b/test/Cpp/src/ActionIsPresent.lf @@ -1,7 +1,7 @@ // Tests the is_present variable for actions in cpp target Cpp -main reactor ActionIsPresent(offset: time = 1 nsec, period: time = 500 msec) { +main reactor ActionIsPresent(offset: time = 1 nsec, period: time(500 msec)) { logical action a state success: bool = false state zero: time = 0 nsec From 148583366386f8184c6d50039a68c2421805c9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 3 Feb 2023 16:54:13 +0100 Subject: [PATCH 12/49] Fix some problems --- .../org/lflang/generator/GeneratorUtils.java | 19 +++++++++++-------- .../src/target/CliParserGenericArguments.lf | 2 +- test/Rust/src/MovingAverage.lf | 3 +-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/GeneratorUtils.java b/org.lflang/src/org/lflang/generator/GeneratorUtils.java index f51439c390..98315701d1 100644 --- a/org.lflang/src/org/lflang/generator/GeneratorUtils.java +++ b/org.lflang/src/org/lflang/generator/GeneratorUtils.java @@ -8,6 +8,7 @@ import java.util.Iterator; import java.util.List; import java.util.Properties; +import java.util.Set; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; @@ -15,6 +16,7 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.diagnostics.Severity; import org.eclipse.xtext.generator.IGeneratorContext; import org.eclipse.xtext.resource.XtextResource; import org.eclipse.xtext.validation.CheckMode; @@ -238,20 +240,21 @@ public static void validate( // and yet it used to only report errors in the files doing the importing. IResourceValidator validator = ((XtextResource) fileConfig.resource).getResourceServiceProvider() .getResourceValidator(); - HashSet bad = new HashSet<>(); - HashSet visited = new HashSet<>(); + Set bad = new HashSet<>(); + Set visited = new HashSet<>(); // The graph must be traversed in topological order so that errors will propagate through arbitrarily many // levels. for (Reactor reactor : instantiationGraph.nodesInTopologicalOrder()) { Resource resource = reactor.eResource(); - if (visited.contains(resource)) continue; - visited.add(resource); + if (!visited.add(resource)) { + continue; + } List issues = validator.validate(resource, CheckMode.ALL, context.getCancelIndicator()); - if ( - bad.contains(resource) || issues.size() > 0 - ) { + // warnings and such are not reported on included files. + issues.removeIf(it -> it.getSeverity() != Severity.ERROR); + if (bad.contains(resource) || !issues.isEmpty()) { // Report the error on this resource. - Path path = null; + Path path; try { path = FileUtil.toPath(resource); } catch (IOException e) { diff --git a/test/Cpp/src/target/CliParserGenericArguments.lf b/test/Cpp/src/target/CliParserGenericArguments.lf index da95c78d5f..9a008ebcab 100644 --- a/test/Cpp/src/target/CliParserGenericArguments.lf +++ b/test/Cpp/src/target/CliParserGenericArguments.lf @@ -56,7 +56,7 @@ main reactor CliParserGenericArguments( long_double_value: {= long_double =} = 4.2, float_value: float = 10.5, string_value: string = "This is a testvalue", - custom_class_value: {= CustomClass =} = "Peter" + custom_class_value: {= CustomClass =}("Peter") ) { reaction(startup) {= std::cout << "Hello World!\n"; =} } diff --git a/test/Rust/src/MovingAverage.lf b/test/Rust/src/MovingAverage.lf index 33e686cf42..65132ce1d0 100644 --- a/test/Rust/src/MovingAverage.lf +++ b/test/Rust/src/MovingAverage.lf @@ -17,8 +17,7 @@ reactor Source { } reactor MovingAverageImpl { - // fixme inaccessible ({=[0.0 ; 4]=}); - state delay_line: f64[4](0.0, 0.0, 0.0, 0.0) + state delay_line: {=[f64 ; 4]=} = {= [ 0.0 ; 4 ] =} state index: usize = 0 input in_: f64 output out: f64 From 67e545e6ab119f309adae1015dd2a1f9706cde5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 15 Feb 2023 15:23:46 +0100 Subject: [PATCH 13/49] Fix C++ paren initializers --- .../lflang/generator/cpp/CppParameterGenerator.kt | 9 ++------- org.lflang/src/org/lflang/generator/cpp/CppTypes.kt | 12 +++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt b/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt index fcefc8be41..b5664538d7 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt @@ -40,12 +40,6 @@ class CppParameterGenerator(private val reactor: Reactor) { val Parameter.typeAlias get(): String = "__lf_${name}_t" } - /** Generate all constructor initializers for parameters */ - fun generateInitializers() = - reactor.parameters.joinWithLn(prefix = "// parameters\n") { - ", ${it.name}(parameters.${it.name})" - } - /** Generate all parameter declarations as used in the parameter struct */ fun generateParameterStructDeclarations() = reactor.parameters.joinToString("\n", postfix = "\n") { @@ -55,7 +49,8 @@ class CppParameterGenerator(private val reactor: Reactor) { const $typeAlias $name${ if (init == null) "" else CppTypes.getCppInitializer( init, - inferredType + inferredType, + typeAlias = typeAlias ) }; """.trimIndent() diff --git a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt index fbfcb73452..d5ec0498c1 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt @@ -28,6 +28,7 @@ import org.lflang.InferredType import org.lflang.TimeUnit import org.lflang.TimeValue import org.lflang.generator.TargetTypes +import org.lflang.joinWithCommas import org.lflang.lf.Initializer import org.lflang.lf.ParameterReference @@ -71,12 +72,21 @@ val TimeUnit?.cppUnit /** * Returns a C++ variable initializer. */ -fun CppTypes.getCppInitializer(init: Initializer?, inferredType: InferredType, disableEquals: Boolean = false): String = +fun CppTypes.getCppInitializer( + init: Initializer?, + inferredType: InferredType, + disableEquals: Boolean = false, + typeAlias: String? = null +): String = if (init == null) { "/*uninitialized*/" } else if (init.isAssign && !disableEquals) { val e = init.exprs.single() " = " + getTargetExpr(e, inferredType) + } else if (init.isParens && typeAlias != null && !disableEquals) { + " = $typeAlias" + init.exprs.joinWithCommas("(", ")", trailing = false) { + getTargetExpr(it, inferredType.componentType) + } } else { val (prefix, postfix) = if (init.isBraces) Pair("{", "}") else Pair("(", ")") init.exprs.joinToString(", ", prefix, postfix) { From 09ba2d1e74e0174095f0534423b5132b7c5c3a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 15 Feb 2023 15:24:48 +0100 Subject: [PATCH 14/49] Format --- test/C/src/concurrent/ScheduleAt.lf | 40 +++++++++++++++-------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/test/C/src/concurrent/ScheduleAt.lf b/test/C/src/concurrent/ScheduleAt.lf index 0e35f49a94..9ff100ebd0 100644 --- a/test/C/src/concurrent/ScheduleAt.lf +++ b/test/C/src/concurrent/ScheduleAt.lf @@ -12,24 +12,26 @@ target C { reactor Scheduler { logical action act // List of microsteps. Size = 16 - state microstep_delay_list: uint32_t[] = {={ - 0, - 1, - 1, - 2, - 2, - 0, - 0, - 1, - 1, - 0, - 2, - 3, - 3, - 4, - 4, - 5 - }=} + state microstep_delay_list: uint32_t[] = {= + { + 0, + 1, + 1, + 2, + 2, + 0, + 0, + 1, + 1, + 0, + 2, + 3, + 3, + 4, + 4, + 5 + } + =} state times: int[]( 0, 0, @@ -49,7 +51,7 @@ reactor Scheduler { 900 msec ) // Size = 9 - state action_hit_list_microstep: int[] = {={1, 2, 0, 1, 0, 2, 3, 4, 5}=} + state action_hit_list_microstep: int[] = {= {1, 2, 0, 1, 0, 2, 3, 4, 5} =} state action_hit_list_times: int[]( 0, 0, From 753ec48de7404db3b83ccabaccab2755fd5ca849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 20 Feb 2023 14:42:37 +0100 Subject: [PATCH 15/49] Format tests --- test/Python/src/ActionDelay.lf | 2 +- test/Python/src/ActionIsPresent.lf | 6 +++--- test/Python/src/After.lf | 4 ++-- test/Python/src/AfterCycles.lf | 2 +- test/Python/src/ArrayAsType.lf | 2 +- test/Python/src/ArrayFree.lf | 2 +- test/Python/src/ArrayPrint.lf | 2 +- test/Python/src/Composition.lf | 6 +++--- test/Python/src/CompositionAfter.lf | 8 ++++---- test/Python/src/CompositionInheritance.lf | 6 +++--- test/Python/src/CountSelf.lf | 4 ++-- test/Python/src/CountTest.lf | 2 +- test/Python/src/Deadline.lf | 8 ++++---- test/Python/src/DelayInt.lf | 6 +++--- test/Python/src/DelayString.lf | 4 ++-- test/Python/src/DelayStructWithAfter.lf | 2 +- test/Python/src/DelayStructWithAfterOverlapped.lf | 4 ++-- test/Python/src/DelayedAction.lf | 2 +- test/Python/src/DoubleInvocation.lf | 4 ++-- test/Python/src/DoubleReaction.lf | 6 +++--- test/Python/src/FloatLiteral.lf | 8 ++++---- test/Python/src/Gain.lf | 4 ++-- test/Python/src/GetMicroStep.lf | 2 +- test/Python/src/Hierarchy2.lf | 4 ++-- test/Python/src/IdentifierLength.lf | 6 +++--- test/Python/src/ManualDelayedReaction.lf | 2 +- test/Python/src/MethodsRecursive.lf | 2 +- test/Python/src/MethodsSameName.lf | 4 ++-- test/Python/src/MultipleContained.lf | 2 +- test/Python/src/NativeListsAndTimes.lf | 14 +++++++------- test/Python/src/PeriodicDesugared.lf | 2 +- test/Python/src/PingPong.lf | 8 ++++---- test/Python/src/Pipeline.lf | 6 +++--- test/Python/src/ReadOutputOfContainedReactor.lf | 2 +- test/Python/src/ScheduleLogicalAction.lf | 2 +- test/Python/src/SelfLoop.lf | 2 +- test/Python/src/SendingInside.lf | 4 ++-- test/Python/src/SetArray.lf | 2 +- test/Python/src/SimpleDeadline.lf | 2 +- test/Python/src/SlowingClock.lf | 4 ++-- test/Python/src/Stride.lf | 6 +++--- test/Python/src/StructAsState.lf | 2 +- test/Python/src/StructAsTypeDirect.lf | 2 +- test/Python/src/StructPrint.lf | 2 +- test/Python/src/StructScale.lf | 4 ++-- test/Python/src/SubclassesAndStartup.lf | 6 +++--- test/Python/src/TimeState.lf | 4 ++-- test/Python/src/Timers.lf | 2 +- test/Python/src/TriggerDownstreamOnlyIfPresent.lf | 2 +- test/Python/src/TriggerDownstreamOnlyIfPresent2.lf | 2 +- test/Python/src/UnconnectedInput.lf | 4 ++-- test/Python/src/concurrent/AsyncCallback.lf | 8 ++++---- test/Python/src/concurrent/AsyncCallbackNoTimer.lf | 8 ++++---- .../src/docker/FilesPropertyContainerized.lf | 2 +- .../federated/DistributedCountContainerized.lf | 2 +- test/Python/src/federated/BroadcastFeedback.lf | 2 +- .../federated/BroadcastFeedbackWithHierarchy.lf | 4 ++-- test/Python/src/federated/CycleDetection.lf | 2 +- test/Python/src/federated/DecentralizedP2PComm.lf | 6 +++--- .../src/federated/DistributedBankToMultiport.lf | 2 +- .../src/federated/DistributedCountDecentralized.lf | 2 +- .../federated/DistributedCountDecentralizedLate.lf | 6 +++--- .../DistributedCountDecentralizedLateDownstream.lf | 8 ++++---- .../src/federated/DistributedCountPhysical.lf | 4 ++-- .../DistributedCountPhysicalAfterDelay.lf | 4 ++-- .../DistributedCountPhysicalDecentralized.lf | 4 ++-- .../src/federated/DistributedLoopedAction.lf | 8 ++++---- .../federated/DistributedLoopedPhysicalAction.lf | 12 ++++++------ test/Python/src/federated/DistributedMultiport.lf | 4 ++-- .../src/federated/DistributedMultiportToken.lf | 2 +- test/Python/src/federated/DistributedStop.lf | 6 +++--- test/Python/src/federated/HelloDistributed.lf | 2 +- test/Python/src/federated/PingPongDistributed.lf | 10 +++++----- test/Python/src/lib/Count.lf | 4 ++-- test/Python/src/lib/InternalDelay.lf | 2 +- test/Python/src/lib/LoopedActionSender.lf | 4 ++-- test/Python/src/lib/Test.lf | 2 +- test/Python/src/lib/TestCount.lf | 6 +++--- test/Python/src/lib/TestCountMultiport.lf | 6 +++--- test/Python/src/multiport/BankIndexInitializer.lf | 8 ++++---- .../src/multiport/BankReactionsInContainer.lf | 6 +++--- test/Python/src/multiport/BankToBank.lf | 10 +++++----- test/Python/src/multiport/BankToBankMultiport.lf | 10 +++++----- .../src/multiport/BankToBankMultiportAfter.lf | 2 +- test/Python/src/multiport/BankToMultiport.lf | 8 ++++---- test/Python/src/multiport/Broadcast.lf | 6 +++--- .../Python/src/multiport/BroadcastMultipleAfter.lf | 4 ++-- test/Python/src/multiport/MultiportFromBank.lf | 4 ++-- .../src/multiport/MultiportFromBankHierarchy.lf | 2 +- .../Python/src/multiport/MultiportFromHierarchy.lf | 4 ++-- test/Python/src/multiport/MultiportFromReaction.lf | 6 +++--- test/Python/src/multiport/MultiportIn.lf | 4 ++-- .../src/multiport/MultiportInParameterized.lf | 6 +++--- test/Python/src/multiport/MultiportMutableInput.lf | 4 ++-- .../src/multiport/MultiportMutableInputArray.lf | 4 ++-- test/Python/src/multiport/MultiportOut.lf | 4 ++-- test/Python/src/multiport/MultiportToBank.lf | 4 ++-- test/Python/src/multiport/MultiportToBankAfter.lf | 4 ++-- .../src/multiport/MultiportToBankHierarchy.lf | 4 ++-- test/Python/src/multiport/MultiportToHierarchy.lf | 8 ++++---- test/Python/src/multiport/MultiportToMultiport.lf | 4 ++-- test/Python/src/multiport/MultiportToMultiport2.lf | 4 ++-- .../src/multiport/MultiportToMultiport2After.lf | 2 +- .../src/multiport/MultiportToMultiportArray.lf | 4 ++-- .../src/multiport/MultiportToMultiportParameter.lf | 2 +- test/Python/src/multiport/MultiportToPort.lf | 4 ++-- test/Python/src/multiport/MultiportToReaction.lf | 6 +++--- test/Python/src/multiport/NestedBanks.lf | 10 +++++----- .../Python/src/multiport/NestedInterleavedBanks.lf | 4 ++-- test/Python/src/multiport/ReactionsToNested.lf | 4 ++-- test/Python/src/target/AfterNoTypes.lf | 4 ++-- test/Rust/src/MovingAverage.lf | 2 +- 112 files changed, 247 insertions(+), 247 deletions(-) diff --git a/test/Python/src/ActionDelay.lf b/test/Python/src/ActionDelay.lf index 7c325bb2cb..60efa42f57 100644 --- a/test/Python/src/ActionDelay.lf +++ b/test/Python/src/ActionDelay.lf @@ -4,7 +4,7 @@ target Python reactor GeneratedDelay { input y_in output y_out - state y_state(0) + state y_state = 0 logical action act(100 msec) reaction(y_in) -> act {= diff --git a/test/Python/src/ActionIsPresent.lf b/test/Python/src/ActionIsPresent.lf index 259417110e..ceb52d10b8 100644 --- a/test/Python/src/ActionIsPresent.lf +++ b/test/Python/src/ActionIsPresent.lf @@ -1,10 +1,10 @@ # Tests the is_present variable for actions. target Python -main reactor ActionIsPresent(offset(1 nsec), period(500 msec)) { +main reactor ActionIsPresent(offset = 1 nsec, period = 500 msec) { logical action a - state first_time(True) - state success(False) + state first_time = True + state success = False reaction(startup, a) -> a {= # The is_present field should be initially False diff --git a/test/Python/src/After.lf b/test/Python/src/After.lf index 13b1970d5a..0c8b931543 100644 --- a/test/Python/src/After.lf +++ b/test/Python/src/After.lf @@ -13,8 +13,8 @@ reactor foo { } reactor print { - state expected_time(10 msec) - state received(0) + state expected_time = 10 msec + state received = 0 input x reaction(x) {= diff --git a/test/Python/src/AfterCycles.lf b/test/Python/src/AfterCycles.lf index ef1500af27..cd0f0dd98e 100644 --- a/test/Python/src/AfterCycles.lf +++ b/test/Python/src/AfterCycles.lf @@ -16,7 +16,7 @@ reactor Work { } main reactor AfterCycles { - state count(0) + state count = 0 s = new Source() w0 = new Work() w1 = new Work() diff --git a/test/Python/src/ArrayAsType.lf b/test/Python/src/ArrayAsType.lf index 2025cecbd1..dc3b2f6e26 100644 --- a/test/Python/src/ArrayAsType.lf +++ b/test/Python/src/ArrayAsType.lf @@ -11,7 +11,7 @@ reactor Source { =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input _in reaction(_in) {= diff --git a/test/Python/src/ArrayFree.lf b/test/Python/src/ArrayFree.lf index 893fbc4358..2ea2777c12 100644 --- a/test/Python/src/ArrayFree.lf +++ b/test/Python/src/ArrayFree.lf @@ -7,7 +7,7 @@ target Python import Source, Print from "ArrayPrint.lf" import Scale from "ArrayScale.lf" -reactor Free(scale(2)) { +reactor Free(scale = 2) { mutable input _in reaction(_in) {= diff --git a/test/Python/src/ArrayPrint.lf b/test/Python/src/ArrayPrint.lf index 039debac0c..4420311b93 100644 --- a/test/Python/src/ArrayPrint.lf +++ b/test/Python/src/ArrayPrint.lf @@ -11,7 +11,7 @@ reactor Source { =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input _in reaction(_in) {= diff --git a/test/Python/src/Composition.lf b/test/Python/src/Composition.lf index 3a737295bf..d1bef93ed2 100644 --- a/test/Python/src/Composition.lf +++ b/test/Python/src/Composition.lf @@ -5,10 +5,10 @@ target Python { timeout: 10 sec } -reactor Source(period(2 sec)) { +reactor Source(period = 2 sec) { output y timer t(1 sec, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -20,7 +20,7 @@ reactor Source(period(2 sec)) { reactor Test { input x - state count(0) + state count = 0 reaction(x) {= self.count += 1 diff --git a/test/Python/src/CompositionAfter.lf b/test/Python/src/CompositionAfter.lf index f21b7ae75e..00b95e3ab9 100644 --- a/test/Python/src/CompositionAfter.lf +++ b/test/Python/src/CompositionAfter.lf @@ -5,10 +5,10 @@ target Python { timeout: 10 sec } -reactor Source(period(2 sec)) { +reactor Source(period = 2 sec) { output y timer t(1 sec, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -18,7 +18,7 @@ reactor Source(period(2 sec)) { reactor Test { input x - state count(0) + state count = 0 reaction(x) {= self.count += 1 @@ -29,7 +29,7 @@ reactor Test { =} } -main reactor(delay(5 sec)) { +main reactor(delay = 5 sec) { s = new Source() d = new Test() s.y -> d.x after delay diff --git a/test/Python/src/CompositionInheritance.lf b/test/Python/src/CompositionInheritance.lf index deac45b05a..4b0e4a38c9 100644 --- a/test/Python/src/CompositionInheritance.lf +++ b/test/Python/src/CompositionInheritance.lf @@ -5,11 +5,11 @@ target Python { timeout: 10 sec } -reactor Source(period(2 sec)) { +reactor Source(period = 2 sec) { input foo output y timer t(1 sec, period) - state count(0) + state count = 0 reaction(t) -> y {= print("Hello World. My count is: ", self.count) @@ -30,7 +30,7 @@ reactor SourceExtended extends Source { reactor Test { input x - state count(0) + state count = 0 reaction(x) {= self.count += 1 diff --git a/test/Python/src/CountSelf.lf b/test/Python/src/CountSelf.lf index 40f4778c71..74219e6fe0 100644 --- a/test/Python/src/CountSelf.lf +++ b/test/Python/src/CountSelf.lf @@ -4,7 +4,7 @@ target Python { fast: true } -reactor CountSelf2(delay(100 msec)) { +reactor CountSelf2(delay = 100 msec) { output out logical action a @@ -21,7 +21,7 @@ reactor CountSelf2(delay(100 msec)) { reactor Test { input _in - state count(0) + state count = 0 reaction(_in) {= print("Received: {:d}".format(_in.value)) diff --git a/test/Python/src/CountTest.lf b/test/Python/src/CountTest.lf index 2761d22a5b..06c4a6fdb6 100644 --- a/test/Python/src/CountTest.lf +++ b/test/Python/src/CountTest.lf @@ -7,7 +7,7 @@ import Count from "lib/Count.lf" reactor Test { input c - state i(0) + state i = 0 reaction(c) {= print("Received ", c.value) diff --git a/test/Python/src/Deadline.lf b/test/Python/src/Deadline.lf index aeed5f0d5e..ceab2b28e2 100644 --- a/test/Python/src/Deadline.lf +++ b/test/Python/src/Deadline.lf @@ -7,10 +7,10 @@ target Python { preamble {= import time =} -reactor Source(period(3 sec)) { +reactor Source(period = 3 sec) { output y timer t(0, period) - state count(0) + state count = 0 reaction(t) -> y {= if self.count % 2 != 0: @@ -24,9 +24,9 @@ reactor Source(period(3 sec)) { =} } -reactor Destination(timeout(1 sec)) { +reactor Destination(timeout = 1 sec) { input x - state count(0) + state count = 0 reaction(x) {= print("Destination receives: ", x.value) diff --git a/test/Python/src/DelayInt.lf b/test/Python/src/DelayInt.lf index d12c8b968b..8348306c41 100644 --- a/test/Python/src/DelayInt.lf +++ b/test/Python/src/DelayInt.lf @@ -1,7 +1,7 @@ # This tests actions with payloads by delaying an input by a fixed amount. target Python -reactor Delay(delay(100 msec)) { +reactor Delay(delay = 100 msec) { input _in output out logical action a @@ -16,8 +16,8 @@ reactor Delay(delay(100 msec)) { reactor Test { input _in - state start_time(0) - state received_value(false) + state start_time = 0 + state received_value = false reaction(startup) {= # Record the logical time at the start. diff --git a/test/Python/src/DelayString.lf b/test/Python/src/DelayString.lf index f315b0bec2..d1201dec02 100644 --- a/test/Python/src/DelayString.lf +++ b/test/Python/src/DelayString.lf @@ -2,7 +2,7 @@ # freed. target Python -reactor DelayString2(delay(100 msec)) { +reactor DelayString2(delay = 100 msec) { input _in output out logical action a @@ -14,7 +14,7 @@ reactor DelayString2(delay(100 msec)) { reactor Test { input _in - state start_time(0) + state start_time = 0 reaction(_in) {= print("Received: ", _in.value) diff --git a/test/Python/src/DelayStructWithAfter.lf b/test/Python/src/DelayStructWithAfter.lf index 21dafab29e..5bb945cb3c 100644 --- a/test/Python/src/DelayStructWithAfter.lf +++ b/test/Python/src/DelayStructWithAfter.lf @@ -11,7 +11,7 @@ reactor Source { reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} } -reactor Print(expected(42)) { # expected parameter is for testing. +reactor Print(expected = 42) { # expected parameter is for testing. input _in reaction(_in) {= diff --git a/test/Python/src/DelayStructWithAfterOverlapped.lf b/test/Python/src/DelayStructWithAfterOverlapped.lf index f19c5cd1bd..072012a106 100644 --- a/test/Python/src/DelayStructWithAfterOverlapped.lf +++ b/test/Python/src/DelayStructWithAfterOverlapped.lf @@ -10,7 +10,7 @@ preamble {= import hello =} reactor Source { output out timer t(0, 1 sec) - state s(0) + state s = 0 reaction(t) -> out {= self.s += 1 @@ -20,7 +20,7 @@ reactor Source { reactor Print { # expected parameter is for testing. input _in - state s(0) + state s = 0 reaction(_in) {= self.s += 1 diff --git a/test/Python/src/DelayedAction.lf b/test/Python/src/DelayedAction.lf index 3f6fb70608..06c488b9c5 100644 --- a/test/Python/src/DelayedAction.lf +++ b/test/Python/src/DelayedAction.lf @@ -6,7 +6,7 @@ target Python { main reactor DelayedAction { timer t(0, 1 sec) logical action a - state count(0) + state count = 0 reaction(t) -> a {= a.schedule(MSEC(100)) =} diff --git a/test/Python/src/DoubleInvocation.lf b/test/Python/src/DoubleInvocation.lf index d14edd6332..aaecfa31cb 100644 --- a/test/Python/src/DoubleInvocation.lf +++ b/test/Python/src/DoubleInvocation.lf @@ -13,7 +13,7 @@ target Python { reactor Ball { output position output velocity - state p(200) + state p = 200 timer trigger(0, 1 sec) reaction(trigger) -> position, velocity {= @@ -26,7 +26,7 @@ reactor Ball { reactor Print { input velocity input position - state previous(-1) + state previous = -1 reaction(startup) {= print("####### Print startup\n") diff --git a/test/Python/src/DoubleReaction.lf b/test/Python/src/DoubleReaction.lf index 2061ab5a1c..c20a032a9a 100644 --- a/test/Python/src/DoubleReaction.lf +++ b/test/Python/src/DoubleReaction.lf @@ -5,10 +5,10 @@ target Python { fast: true } -reactor Clock(offset(0), period(1 sec)) { +reactor Clock(offset = 0, period = 1 sec) { output y timer t(offset, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -19,7 +19,7 @@ reactor Clock(offset(0), period(1 sec)) { reactor Destination { input x input w - state s(2) + state s = 2 reaction(x, w) {= sm = 0 diff --git a/test/Python/src/FloatLiteral.lf b/test/Python/src/FloatLiteral.lf index 5ed6202429..b55953d135 100644 --- a/test/Python/src/FloatLiteral.lf +++ b/test/Python/src/FloatLiteral.lf @@ -2,10 +2,10 @@ target Python # This test verifies that floating-point literals are handled correctly. main reactor { - state N(6.0221409e+23) - state charge(-1.6021766E-19) - state minus_epsilon(-.01e0) - state expected(.964853323188E5) + state N = 6.0221409e+23 + state charge = -1.6021766E-19 + state minus_epsilon = -.01e0 + state expected = .964853323188E5 reaction(startup) {= F = - self.N * self.charge diff --git a/test/Python/src/Gain.lf b/test/Python/src/Gain.lf index 38459a9380..d69d4d2a65 100644 --- a/test/Python/src/Gain.lf +++ b/test/Python/src/Gain.lf @@ -1,7 +1,7 @@ # Example in the Wiki. target Python -reactor Scale(scale(2)) { +reactor Scale(scale = 2) { input x output y @@ -10,7 +10,7 @@ reactor Scale(scale(2)) { reactor Test { input x - state received_value(0) + state received_value = 0 reaction(x) {= print("Received " + str(x.value)) diff --git a/test/Python/src/GetMicroStep.lf b/test/Python/src/GetMicroStep.lf index 7b1da9bb40..124c692ef8 100644 --- a/test/Python/src/GetMicroStep.lf +++ b/test/Python/src/GetMicroStep.lf @@ -5,7 +5,7 @@ target Python { main reactor GetMicroStep { preamble {= import sys =} - state s(1) + state s = 1 logical action l # timer t(0, 1 msec); diff --git a/test/Python/src/Hierarchy2.lf b/test/Python/src/Hierarchy2.lf index 07e67a765b..a1792712fa 100644 --- a/test/Python/src/Hierarchy2.lf +++ b/test/Python/src/Hierarchy2.lf @@ -14,7 +14,7 @@ reactor Source { reactor Count { output out timer t(0, 1 sec) - state i(0) + state i = 0 reaction(t) -> out {= self.i += 1 @@ -39,7 +39,7 @@ reactor Add { reactor Print { input _in - state expected(2) + state expected = 2 reaction(_in) {= print("Received: ", _in.value) diff --git a/test/Python/src/IdentifierLength.lf b/test/Python/src/IdentifierLength.lf index 66edf11abf..62b31141a0 100644 --- a/test/Python/src/IdentifierLength.lf +++ b/test/Python/src/IdentifierLength.lf @@ -6,11 +6,11 @@ target Python { } reactor A_Really_Long_Name_For_A_Source_But_Not_Quite_255_Characters_Which_Is_The_Maximum_For_The_Python_Target( - period(2 sec) + period = 2 sec ) { output y timer t(1 sec, period) - state count(0) + state count = 0 reaction(t) -> y {= self.count += 1 @@ -20,7 +20,7 @@ reactor A_Really_Long_Name_For_A_Source_But_Not_Quite_255_Characters_Which_Is_Th reactor Another_Really_Long_Name_For_A_Test_Class { input x - state count(0) + state count = 0 reaction(x) {= self.count += 1 diff --git a/test/Python/src/ManualDelayedReaction.lf b/test/Python/src/ManualDelayedReaction.lf index 0d142405cd..a9e39829eb 100644 --- a/test/Python/src/ManualDelayedReaction.lf +++ b/test/Python/src/ManualDelayedReaction.lf @@ -9,7 +9,7 @@ target Python { reactor GeneratedDelay { input y_in output y_out - state y_state(0) + state y_state = 0 physical action act(0 msec) # TODO: delay in act or the schedule call? diff --git a/test/Python/src/MethodsRecursive.lf b/test/Python/src/MethodsRecursive.lf index ca3ea237e7..81afc86bea 100644 --- a/test/Python/src/MethodsRecursive.lf +++ b/test/Python/src/MethodsRecursive.lf @@ -2,7 +2,7 @@ target Python main reactor { - state foo(2) + state foo = 2 method fib(n) {= # Return the n-th Fibonacci number. if n <= 1: diff --git a/test/Python/src/MethodsSameName.lf b/test/Python/src/MethodsSameName.lf index c4d6cdbc4c..a80f521356 100644 --- a/test/Python/src/MethodsSameName.lf +++ b/test/Python/src/MethodsSameName.lf @@ -2,7 +2,7 @@ target Python reactor Foo { - state foo(2) + state foo = 2 method add(x) {= self.foo += x =} @@ -16,7 +16,7 @@ reactor Foo { } main reactor { - state foo(2) + state foo = 2 a = new Foo() diff --git a/test/Python/src/MultipleContained.lf b/test/Python/src/MultipleContained.lf index 0b055951c5..27950ccd88 100644 --- a/test/Python/src/MultipleContained.lf +++ b/test/Python/src/MultipleContained.lf @@ -4,7 +4,7 @@ target Python reactor Contained { output trigger - state count(0) + state count = 0 input in1 input in2 diff --git a/test/Python/src/NativeListsAndTimes.lf b/test/Python/src/NativeListsAndTimes.lf index f8b60ed87d..b7b52b3d0a 100644 --- a/test/Python/src/NativeListsAndTimes.lf +++ b/test/Python/src/NativeListsAndTimes.lf @@ -2,22 +2,22 @@ target Python # This test passes if it is successfully compiled into valid target code. main reactor( - x(0), - y(0), # Units are missing but not required - z(1 msec), # Type is missing but not required + x = 0, + y = 0, # Units are missing but not required + z = 1 msec, # Type is missing but not required p(1, 2, 3, 4), # List of integers q(1 msec, 2 msec, 3 msec), # list of time values g(1 msec, 2 msec) # List of time values ) { - state s(y) # Reference to explicitly typed time parameter - state t(z) # Reference to implicitly typed time parameter + state s = y # Reference to explicitly typed time parameter + state t = z # Reference to implicitly typed time parameter state v # Uninitialized boolean state variable state w # Uninitialized time state variable timer tick(0) # Units missing but not required timer tock(1 sec) # Implicit type time timer toe(z) # Implicit type time - state baz(p) # Implicit type int[] - state period(z) # Implicit type time + state baz = p # Implicit type int[] + state period = z # Implicit type time state bar(1 msec, 2 msec, 3 msec) # list of time values state notype(1, 2, 3, 4) diff --git a/test/Python/src/PeriodicDesugared.lf b/test/Python/src/PeriodicDesugared.lf index 5dc7f7bb8f..b003ffc9f8 100644 --- a/test/Python/src/PeriodicDesugared.lf +++ b/test/Python/src/PeriodicDesugared.lf @@ -3,7 +3,7 @@ target Python { timeout: 1 sec } -main reactor(offset(0), period(500 msec)) { +main reactor(offset = 0, period = 500 msec) { logical action init(offset) logical action recur(period) diff --git a/test/Python/src/PingPong.lf b/test/Python/src/PingPong.lf index 25ffdea3a8..f5f80511ae 100644 --- a/test/Python/src/PingPong.lf +++ b/test/Python/src/PingPong.lf @@ -24,10 +24,10 @@ target Python { fast: true } -reactor Ping(count(10)) { +reactor Ping(count = 10) { input receive output send - state pingsLeft(count) + state pingsLeft = count logical action serve reaction(startup, serve) -> send {= @@ -43,10 +43,10 @@ reactor Ping(count(10)) { =} } -reactor Pong(expected(10)) { +reactor Pong(expected = 10) { input receive output send - state count(0) + state count = 0 reaction(receive) -> send {= self.count += 1 diff --git a/test/Python/src/Pipeline.lf b/test/Python/src/Pipeline.lf index 014680e3ca..18436561b8 100644 --- a/test/Python/src/Pipeline.lf +++ b/test/Python/src/Pipeline.lf @@ -17,8 +17,8 @@ reactor TakeTime { reactor Print { input _in - state count(0) - state received(0) + state count = 0 + state received = 0 reaction(_in) {= self.received += 1 @@ -38,7 +38,7 @@ reactor Print { main reactor Pipeline { timer t(0, 200 msec) - state count(0) + state count = 0 c1 = new TakeTime() c2 = new TakeTime() diff --git a/test/Python/src/ReadOutputOfContainedReactor.lf b/test/Python/src/ReadOutputOfContainedReactor.lf index 25c8a1a368..1cb73667ce 100644 --- a/test/Python/src/ReadOutputOfContainedReactor.lf +++ b/test/Python/src/ReadOutputOfContainedReactor.lf @@ -10,7 +10,7 @@ reactor Contained { main reactor ReadOutputOfContainedReactor { c = new Contained() - state count(0) + state count = 0 reaction(startup) c.out {= print("Startup reaction reading output of contained reactor: ", c.out.value) diff --git a/test/Python/src/ScheduleLogicalAction.lf b/test/Python/src/ScheduleLogicalAction.lf index 10f8d4e3cd..3f99c65777 100644 --- a/test/Python/src/ScheduleLogicalAction.lf +++ b/test/Python/src/ScheduleLogicalAction.lf @@ -20,7 +20,7 @@ reactor foo { } reactor print { - state expected_time(0) + state expected_time = 0 input x reaction(x) {= diff --git a/test/Python/src/SelfLoop.lf b/test/Python/src/SelfLoop.lf index 1653b893e3..2b607b09c8 100644 --- a/test/Python/src/SelfLoop.lf +++ b/test/Python/src/SelfLoop.lf @@ -7,7 +7,7 @@ reactor Self { input x output y logical action a - state expected(43) + state expected = 43 reaction(a) -> y {= print("a = ", a.value) diff --git a/test/Python/src/SendingInside.lf b/test/Python/src/SendingInside.lf index 08d05b8ed9..8bcc66c005 100644 --- a/test/Python/src/SendingInside.lf +++ b/test/Python/src/SendingInside.lf @@ -7,7 +7,7 @@ target Python { reactor Printer { input x - state count(1) + state count = 1 reaction(x) {= print("Inside reactor received: ", x.value) @@ -19,7 +19,7 @@ reactor Printer { } main reactor SendingInside { - state count(0) + state count = 0 timer t(0, 1 sec) p = new Printer() diff --git a/test/Python/src/SetArray.lf b/test/Python/src/SetArray.lf index 356899ae8f..4766d529f7 100644 --- a/test/Python/src/SetArray.lf +++ b/test/Python/src/SetArray.lf @@ -9,7 +9,7 @@ reactor Source { reaction(startup) -> out {= out.set([0,1,2]) =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input _in reaction(_in) {= diff --git a/test/Python/src/SimpleDeadline.lf b/test/Python/src/SimpleDeadline.lf index 0385f95f74..a714124129 100644 --- a/test/Python/src/SimpleDeadline.lf +++ b/test/Python/src/SimpleDeadline.lf @@ -3,7 +3,7 @@ # violation. target Python -reactor Deadline(threshold(100 msec)) { +reactor Deadline(threshold = 100 msec) { input x output deadlineViolation diff --git a/test/Python/src/SlowingClock.lf b/test/Python/src/SlowingClock.lf index b566781677..972421437a 100644 --- a/test/Python/src/SlowingClock.lf +++ b/test/Python/src/SlowingClock.lf @@ -10,8 +10,8 @@ target Python { main reactor SlowingClock { logical action a(100 msec) - state interval(100 msec) - state expected_time(100 msec) + state interval = 100 msec + state expected_time = 100 msec reaction(startup) -> a {= a.schedule(0) =} diff --git a/test/Python/src/Stride.lf b/test/Python/src/Stride.lf index 95fe379ead..86c68bab5a 100644 --- a/test/Python/src/Stride.lf +++ b/test/Python/src/Stride.lf @@ -5,8 +5,8 @@ target Python { fast: true } -reactor Count(stride(1)) { - state count(1) +reactor Count(stride = 1) { + state count = 1 output y timer t(0, 100 msec) @@ -18,7 +18,7 @@ reactor Count(stride(1)) { reactor Display { input x - state expected(1) # for testing. + state expected = 1 # for testing. reaction(x) {= print("Received: ", x.value) diff --git a/test/Python/src/StructAsState.lf b/test/Python/src/StructAsState.lf index 4fec8dfc0e..b6f38f8589 100644 --- a/test/Python/src/StructAsState.lf +++ b/test/Python/src/StructAsState.lf @@ -9,7 +9,7 @@ main reactor StructAsState { self.name = name self.value = value =} - state s({= self.hello("Earth", 42) =}) + state s = {= self.hello("Earth", 42) =} reaction(startup) {= print("State s.name=\"{:s}\", value={:d}.".format(self.s.name, self.s.value)) diff --git a/test/Python/src/StructAsTypeDirect.lf b/test/Python/src/StructAsTypeDirect.lf index 50f4805a1f..921b7e4390 100644 --- a/test/Python/src/StructAsTypeDirect.lf +++ b/test/Python/src/StructAsTypeDirect.lf @@ -16,7 +16,7 @@ reactor Source { =} } -reactor Print(expected(42)) { # expected parameter is for testing. +reactor Print(expected = 42) { # expected parameter is for testing. input _in reaction(_in) {= diff --git a/test/Python/src/StructPrint.lf b/test/Python/src/StructPrint.lf index f232c07a14..3c0138f937 100644 --- a/test/Python/src/StructPrint.lf +++ b/test/Python/src/StructPrint.lf @@ -12,7 +12,7 @@ reactor Print { reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} } -reactor Check(expected(42)) { # expected parameter is for testing. +reactor Check(expected = 42) { # expected parameter is for testing. input _in reaction(_in) {= diff --git a/test/Python/src/StructScale.lf b/test/Python/src/StructScale.lf index e9ed86ff5b..120c6fde65 100644 --- a/test/Python/src/StructScale.lf +++ b/test/Python/src/StructScale.lf @@ -12,7 +12,7 @@ reactor Source { reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} } -reactor TestInput(expected(42)) { # expected parameter is for testing. +reactor TestInput(expected = 42) { # expected parameter is for testing. input _in reaction(_in) {= @@ -23,7 +23,7 @@ reactor TestInput(expected(42)) { # expected parameter is for testing. =} } -reactor Print(scale(2)) { +reactor Print(scale = 2) { # Mutable keyword indicates that this reactor wants a writable copy of the # input. mutable input _in diff --git a/test/Python/src/SubclassesAndStartup.lf b/test/Python/src/SubclassesAndStartup.lf index 9dae1495be..a98e580851 100644 --- a/test/Python/src/SubclassesAndStartup.lf +++ b/test/Python/src/SubclassesAndStartup.lf @@ -1,7 +1,7 @@ target Python reactor Super { - state count(0) + state count = 0 reaction(startup) {= print("{:s}(Super) started".format(self.name)) @@ -15,7 +15,7 @@ reactor Super { =} } -reactor SubA(name("SubA")) extends Super { +reactor SubA(name = "SubA") extends Super { reaction(startup) {= print("{:s} started".format(self.name)) if self.count == 0: @@ -24,7 +24,7 @@ reactor SubA(name("SubA")) extends Super { =} } -reactor SubB(name("SubB")) extends Super { +reactor SubB(name = "SubB") extends Super { reaction(startup) {= print("{:s} started".format(self.name)) if self.count == 0: diff --git a/test/Python/src/TimeState.lf b/test/Python/src/TimeState.lf index c12318400b..72ad9f0ebd 100644 --- a/test/Python/src/TimeState.lf +++ b/test/Python/src/TimeState.lf @@ -1,7 +1,7 @@ target Python -reactor Foo(bar(42)) { - state baz(500 msec) +reactor Foo(bar = 42) { + state baz = 500 msec reaction(startup) {= print("Baz: ", self.baz) =} } diff --git a/test/Python/src/Timers.lf b/test/Python/src/Timers.lf index ad59feca99..f6cbba747a 100644 --- a/test/Python/src/Timers.lf +++ b/test/Python/src/Timers.lf @@ -6,7 +6,7 @@ target Python { main reactor { timer t(0, 1 sec) timer t2(0, 2 sec) - state counter(0) + state counter = 0 reaction(t2) {= self.counter += 2 =} diff --git a/test/Python/src/TriggerDownstreamOnlyIfPresent.lf b/test/Python/src/TriggerDownstreamOnlyIfPresent.lf index c436a41cd9..b65f732652 100644 --- a/test/Python/src/TriggerDownstreamOnlyIfPresent.lf +++ b/test/Python/src/TriggerDownstreamOnlyIfPresent.lf @@ -10,7 +10,7 @@ target Python { reactor Source { output a output b - state count(0) + state count = 0 timer t(0, 200 msec) reaction(t) -> a, b {= diff --git a/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf b/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf index 310c1d1d02..b9a9184296 100644 --- a/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf @@ -9,7 +9,7 @@ target Python { reactor Source { output[2] out - state count(0) + state count = 0 timer t(0, 200 msec) reaction(t) -> out {= diff --git a/test/Python/src/UnconnectedInput.lf b/test/Python/src/UnconnectedInput.lf index ee40844a99..66f459138b 100644 --- a/test/Python/src/UnconnectedInput.lf +++ b/test/Python/src/UnconnectedInput.lf @@ -7,7 +7,7 @@ target Python { reactor Source { output out timer t(0, 1 sec) - state s(1) + state s = 1 reaction(t) -> out {= out.set(self.s) @@ -32,7 +32,7 @@ reactor Add { reactor Print { input _in - state expected(1) + state expected = 1 reaction(_in) {= print("Received: ", _in.value) diff --git a/test/Python/src/concurrent/AsyncCallback.lf b/test/Python/src/concurrent/AsyncCallback.lf index 3769f09dc0..ef25cffdad 100644 --- a/test/Python/src/concurrent/AsyncCallback.lf +++ b/test/Python/src/concurrent/AsyncCallback.lf @@ -30,12 +30,12 @@ main reactor AsyncCallback { return None =} timer t(0, 200 msec) - state threads({= list() =}) - state expected_time(100 msec) - state toggle(false) + state threads = {= list() =} + state expected_time = 100 msec + state toggle = false physical action a(100 msec) - state i(0) + state i = 0 reaction(t) -> a {= # start new thread, provide callback diff --git a/test/Python/src/concurrent/AsyncCallbackNoTimer.lf b/test/Python/src/concurrent/AsyncCallbackNoTimer.lf index ff9a8613d6..2d585ea5b4 100644 --- a/test/Python/src/concurrent/AsyncCallbackNoTimer.lf +++ b/test/Python/src/concurrent/AsyncCallbackNoTimer.lf @@ -34,12 +34,12 @@ main reactor { return None =} - state threads({= list() =}) - state expected_time(100 msec) - state toggle(false) + state threads = {= list() =} + state expected_time = 100 msec + state toggle = false physical action a(100 msec) - state i(0) + state i = 0 reaction(startup) -> a {= # start new thread, provide callback diff --git a/test/Python/src/docker/FilesPropertyContainerized.lf b/test/Python/src/docker/FilesPropertyContainerized.lf index 2b592921e8..0e5c0091d2 100644 --- a/test/Python/src/docker/FilesPropertyContainerized.lf +++ b/test/Python/src/docker/FilesPropertyContainerized.lf @@ -17,7 +17,7 @@ main reactor { except: lf_request_stop() =} - state passed(false) + state passed = false timer t(1 msec) reaction(t) {= self.passed = True =} diff --git a/test/Python/src/docker/federated/DistributedCountContainerized.lf b/test/Python/src/docker/federated/DistributedCountContainerized.lf index 50f1f5cb12..5f8a348d24 100644 --- a/test/Python/src/docker/federated/DistributedCountContainerized.lf +++ b/test/Python/src/docker/federated/DistributedCountContainerized.lf @@ -15,7 +15,7 @@ target Python { import Count from "../../lib/Count.lf" import Print from "../../federated/DistributedCount.lf" -federated reactor DistributedCountContainerized(offset(200 msec)) at rti { +federated reactor DistributedCountContainerized(offset = 200 msec) at rti { c = new Count() p = new Print() c.out -> p.in_ after offset diff --git a/test/Python/src/federated/BroadcastFeedback.lf b/test/Python/src/federated/BroadcastFeedback.lf index e7c8dcb527..75d313e61d 100644 --- a/test/Python/src/federated/BroadcastFeedback.lf +++ b/test/Python/src/federated/BroadcastFeedback.lf @@ -8,7 +8,7 @@ target Python { reactor SenderAndReceiver { output out input[2] inp - state received(False) + state received = False reaction(startup) -> out {= out.set(42) =} diff --git a/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf b/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf index 63cd79ad1f..ad2a11c10c 100644 --- a/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf +++ b/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf @@ -8,7 +8,7 @@ target Python { reactor SenderAndReceiver { output out input[2] in_ - state received(False) + state received = False r = new Receiver() in_ -> r.in_ @@ -19,7 +19,7 @@ reactor SenderAndReceiver { reactor Receiver { preamble {= import sys =} input[2] in_ - state received(False) + state received = False reaction(in_) {= if in_[0].is_present and in_[1].is_present and in_[0].value == 42 and in_[1].value == 42: diff --git a/test/Python/src/federated/CycleDetection.lf b/test/Python/src/federated/CycleDetection.lf index faba30f7e1..cf9b6d6b54 100644 --- a/test/Python/src/federated/CycleDetection.lf +++ b/test/Python/src/federated/CycleDetection.lf @@ -10,7 +10,7 @@ reactor CAReplica { input remote_update input query - state balance(0) + state balance = 0 output response diff --git a/test/Python/src/federated/DecentralizedP2PComm.lf b/test/Python/src/federated/DecentralizedP2PComm.lf index 29aee88ad5..2725386915 100644 --- a/test/Python/src/federated/DecentralizedP2PComm.lf +++ b/test/Python/src/federated/DecentralizedP2PComm.lf @@ -5,13 +5,13 @@ target Python { coordination: decentralized } -reactor Platform(start(0), expected_start(0), stp_offset_param(0)) { +reactor Platform(start = 0, expected_start = 0, stp_offset_param = 0) { preamble {= import sys =} input in_ output out timer t(0, 100 msec) - state count(start) - state expected(expected_start) + state count = start + state expected = expected_start reaction(t) -> out {= out.set(self.count) diff --git a/test/Python/src/federated/DistributedBankToMultiport.lf b/test/Python/src/federated/DistributedBankToMultiport.lf index f40a85fc65..493e73a3b1 100644 --- a/test/Python/src/federated/DistributedBankToMultiport.lf +++ b/test/Python/src/federated/DistributedBankToMultiport.lf @@ -8,7 +8,7 @@ import Count from "../lib/Count.lf" reactor Destination { preamble {= import sys =} input[2] in_ - state count(1) + state count = 1 reaction(in_) {= for i in range(len(in_)): diff --git a/test/Python/src/federated/DistributedCountDecentralized.lf b/test/Python/src/federated/DistributedCountDecentralized.lf index 232c3ef830..e86adf9946 100644 --- a/test/Python/src/federated/DistributedCountDecentralized.lf +++ b/test/Python/src/federated/DistributedCountDecentralized.lf @@ -16,7 +16,7 @@ import Count from "../lib/Count.lf" reactor Print { preamble {= import sys =} input in_ - state c(1) + state c = 1 reaction(in_) {= print(f"At tag ({lf.time.logical_elapsed()}, {lf.tag().microstep}), received {in_.value}. " diff --git a/test/Python/src/federated/DistributedCountDecentralizedLate.lf b/test/Python/src/federated/DistributedCountDecentralizedLate.lf index 617673aa0e..e3a6899e78 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLate.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLate.lf @@ -18,12 +18,12 @@ reactor Print { # STP () input in_ # STP(in, 30 msec); - state success(0) - state success_stp_violation(0) + state success = 0 + state success_stp_violation = 0 # Force a timer to be invoke periodically timer t(0, 10 usec) # to ensure logical time will advance in the absence of incoming messages. - state c(0) + state c = 0 reaction(in_) {= current_tag = lf.tag() diff --git a/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf b/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf index 18a55f7e6b..c1c641827f 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf @@ -28,12 +28,12 @@ import Count from "../lib/Count.lf" reactor ImportantActuator { input inp # Count messages that arrive without STP violation. - state success(0) - state success_stp_violation(0) + state success = 0 + state success_stp_violation = 0 # Force a timer to be invoked periodically timer t(0, 10 usec) # to ensure logical time will advance in the absence of incoming messages. - state c(0) + state c = 0 reaction(inp) {= current_tag = lf.tag() @@ -81,7 +81,7 @@ reactor Receiver { # Force a timer to be invoke periodically timer t(0, 10 msec) # to ensure logical time will advance in the absence of incoming messages. - state c(0) + state c = 0 p = new Print() a = new ImportantActuator() diff --git a/test/Python/src/federated/DistributedCountPhysical.lf b/test/Python/src/federated/DistributedCountPhysical.lf index b957e06172..69bc2faee9 100644 --- a/test/Python/src/federated/DistributedCountPhysical.lf +++ b/test/Python/src/federated/DistributedCountPhysical.lf @@ -13,7 +13,7 @@ target Python { reactor Count { timer t(200 msec, 1 sec) - state s(0) + state s = 0 output out reaction(t) -> out {= @@ -25,7 +25,7 @@ reactor Count { reactor Print { preamble {= import sys =} input in_ - state c(0) + state c = 0 reaction(in_) {= elapsed_time = lf.time.logical_elapsed() diff --git a/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf b/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf index 80c931184b..105413d0a0 100644 --- a/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf +++ b/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -13,7 +13,7 @@ target Python { reactor Count { timer t(200 msec, 1 sec) - state s(0) + state s = 0 output out reaction(t) -> out {= @@ -25,7 +25,7 @@ reactor Count { reactor Print { preamble {= import sys =} input in_ - state c(0) + state c = 0 reaction(in_) {= elapsed_time = lf.time.logical_elapsed() diff --git a/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf b/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf index 120bb6255c..0008479138 100644 --- a/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf +++ b/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf @@ -14,7 +14,7 @@ target Python { reactor Count { timer t(200 msec, 1 sec) - state s(0) + state s = 0 output out reaction(t) -> out {= @@ -26,7 +26,7 @@ reactor Count { reactor Print { preamble {= import sys =} input in_ - state c(0) + state c = 0 reaction(in_) {= elapsed_time = lf.time.logical_elapsed() diff --git a/test/Python/src/federated/DistributedLoopedAction.lf b/test/Python/src/federated/DistributedLoopedAction.lf index 83aa1de0a6..8f71d15363 100644 --- a/test/Python/src/federated/DistributedLoopedAction.lf +++ b/test/Python/src/federated/DistributedLoopedAction.lf @@ -10,12 +10,12 @@ target Python { import Sender from "../lib/LoopedActionSender.lf" -reactor Receiver(take_a_break_after(10), break_interval(400 msec)) { +reactor Receiver(take_a_break_after = 10, break_interval = 400 msec) { preamble {= import sys =} input in_ - state received_messages(0) - state total_received_messages(0) - state breaks(0) + state received_messages = 0 + state total_received_messages = 0 + state breaks = 0 timer t(0, 1 msec) # This will impact the performance # but forces the logical time to advance Comment this line for a more diff --git a/test/Python/src/federated/DistributedLoopedPhysicalAction.lf b/test/Python/src/federated/DistributedLoopedPhysicalAction.lf index a2cce3742a..d992e3d841 100644 --- a/test/Python/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/Python/src/federated/DistributedLoopedPhysicalAction.lf @@ -14,10 +14,10 @@ target Python { keepalive: true } -reactor Sender(take_a_break_after(10), break_interval(550 msec)) { +reactor Sender(take_a_break_after = 10, break_interval = 550 msec) { output out physical action act - state sent_messages(0) + state sent_messages = 0 reaction(startup, act) -> act, out {= # Send a message on out @@ -32,12 +32,12 @@ reactor Sender(take_a_break_after(10), break_interval(550 msec)) { =} } -reactor Receiver(take_a_break_after(10), break_interval(550 msec)) { +reactor Receiver(take_a_break_after = 10, break_interval = 550 msec) { preamble {= import sys =} input in_ - state received_messages(0) - state total_received_messages(0) - state breaks(0) + state received_messages = 0 + state total_received_messages = 0 + state breaks = 0 timer t(0, 1 msec) # This will impact the performance # but forces the logical time to advance Comment this line for a more # sensible log output. diff --git a/test/Python/src/federated/DistributedMultiport.lf b/test/Python/src/federated/DistributedMultiport.lf index 729f8697d8..7250f838ef 100644 --- a/test/Python/src/federated/DistributedMultiport.lf +++ b/test/Python/src/federated/DistributedMultiport.lf @@ -7,7 +7,7 @@ target Python { reactor Source { output[4] out timer t(0, 100 msec) - state count(0) + state count = 0 reaction(t) -> out {= for i in range(len(out)): @@ -19,7 +19,7 @@ reactor Source { reactor Destination { preamble {= import sys =} input[4] in_ - state count(0) + state count = 0 reaction(in_) {= for i in range(len(in_)): diff --git a/test/Python/src/federated/DistributedMultiportToken.lf b/test/Python/src/federated/DistributedMultiportToken.lf index fdecd67c32..284e1c21a3 100644 --- a/test/Python/src/federated/DistributedMultiportToken.lf +++ b/test/Python/src/federated/DistributedMultiportToken.lf @@ -8,7 +8,7 @@ target Python { reactor Source { output[4] out timer t(0, 200 msec) - state count(0) + state count = 0 reaction(t) -> out {= for i in range(len(out)): diff --git a/test/Python/src/federated/DistributedStop.lf b/test/Python/src/federated/DistributedStop.lf index b4a84b8bef..06dfe96c36 100644 --- a/test/Python/src/federated/DistributedStop.lf +++ b/test/Python/src/federated/DistributedStop.lf @@ -12,7 +12,7 @@ reactor Sender { output out timer t(0, 1 usec) logical action act - state reaction_invoked_correctly(False) + state reaction_invoked_correctly = False reaction(t, act) -> out, act {= tag = lf.tag() @@ -62,10 +62,10 @@ reactor Sender { } reactor Receiver( - stp_offset(10 msec) # Used in the decentralized variant of the test + stp_offset = 10 msec # Used in the decentralized variant of the test ) { input in_ - state reaction_invoked_correctly(False) + state reaction_invoked_correctly = False reaction(in_) {= tag = lf.tag() diff --git a/test/Python/src/federated/HelloDistributed.lf b/test/Python/src/federated/HelloDistributed.lf index 5b8a2a55e4..f9cd039d37 100644 --- a/test/Python/src/federated/HelloDistributed.lf +++ b/test/Python/src/federated/HelloDistributed.lf @@ -19,7 +19,7 @@ reactor Source { reactor Destination { input _in - state received(false) + state received = false reaction(startup) {= print("Destination started.") =} diff --git a/test/Python/src/federated/PingPongDistributed.lf b/test/Python/src/federated/PingPongDistributed.lf index a157baa22a..0f58cbf7db 100644 --- a/test/Python/src/federated/PingPongDistributed.lf +++ b/test/Python/src/federated/PingPongDistributed.lf @@ -21,10 +21,10 @@ */ target Python -reactor Ping(count(10)) { +reactor Ping(count = 10) { input receive output send - state pingsLeft(count) + state pingsLeft = count logical action serve reaction(startup, serve) -> send {= @@ -41,12 +41,12 @@ reactor Ping(count(10)) { =} } -reactor Pong(expected(10)) { +reactor Pong(expected = 10) { preamble {= import sys =} input receive output send - state count(0) + state count = 0 reaction(receive) -> send {= self.count += 1 @@ -64,7 +64,7 @@ reactor Pong(expected(10)) { =} } -federated reactor(count(10)) { +federated reactor(count = 10) { ping = new Ping(count = count) pong = new Pong(expected = count) ping.send ~> pong.receive diff --git a/test/Python/src/lib/Count.lf b/test/Python/src/lib/Count.lf index bcfae967b6..26b53ce13b 100644 --- a/test/Python/src/lib/Count.lf +++ b/test/Python/src/lib/Count.lf @@ -1,7 +1,7 @@ target Python -reactor Count(offset(0), period(1 sec)) { - state count(1) +reactor Count(offset = 0, period = 1 sec) { + state count = 1 output out timer t(offset, period) diff --git a/test/Python/src/lib/InternalDelay.lf b/test/Python/src/lib/InternalDelay.lf index f2ac5449c0..a9796aa8d9 100644 --- a/test/Python/src/lib/InternalDelay.lf +++ b/test/Python/src/lib/InternalDelay.lf @@ -1,6 +1,6 @@ target Python -reactor InternalDelay(delay(10 msec)) { +reactor InternalDelay(delay = 10 msec) { input in_ output out logical action d diff --git a/test/Python/src/lib/LoopedActionSender.lf b/test/Python/src/lib/LoopedActionSender.lf index 3a01219ec8..9d4048d0ea 100644 --- a/test/Python/src/lib/LoopedActionSender.lf +++ b/test/Python/src/lib/LoopedActionSender.lf @@ -11,10 +11,10 @@ target Python * @param break_interval: Determines how long the reactor should take a break * after sending take_a_break_after messages. */ -reactor Sender(take_a_break_after(10), break_interval(400 msec)) { +reactor Sender(take_a_break_after = 10, break_interval = 400 msec) { output out logical action act - state sent_messages(0) + state sent_messages = 0 reaction(startup, act) -> act, out {= # Send a message on out diff --git a/test/Python/src/lib/Test.lf b/test/Python/src/lib/Test.lf index f6bbf867ee..301ed9c8e6 100644 --- a/test/Python/src/lib/Test.lf +++ b/test/Python/src/lib/Test.lf @@ -2,7 +2,7 @@ target Python reactor TestDouble(expected(1.0, 1.0, 1.0, 1.0)) { input t_in - state count(0) + state count = 0 reaction(t_in) {= print("Received: ", t_in.value) diff --git a/test/Python/src/lib/TestCount.lf b/test/Python/src/lib/TestCount.lf index dfe11cd5b9..de611cbc69 100644 --- a/test/Python/src/lib/TestCount.lf +++ b/test/Python/src/lib/TestCount.lf @@ -9,10 +9,10 @@ */ target Python -reactor TestCount(start(1), stride(1), num_inputs(1)) { +reactor TestCount(start = 1, stride = 1, num_inputs = 1) { preamble {= import sys =} - state count(start) - state inputs_received(0) + state count = start + state inputs_received = 0 input in_ reaction(in_) {= diff --git a/test/Python/src/lib/TestCountMultiport.lf b/test/Python/src/lib/TestCountMultiport.lf index d9b711ce89..c30572e4d5 100644 --- a/test/Python/src/lib/TestCountMultiport.lf +++ b/test/Python/src/lib/TestCountMultiport.lf @@ -11,10 +11,10 @@ */ target Python -reactor TestCountMultiport(start(1), stride(1), num_inputs(1), width(2)) { +reactor TestCountMultiport(start = 1, stride = 1, num_inputs = 1, width = 2) { preamble {= import sys =} - state count(start) - state inputs_received(0) + state count = start + state inputs_received = 0 input[width] inp reaction(inp) {= diff --git a/test/Python/src/multiport/BankIndexInitializer.lf b/test/Python/src/multiport/BankIndexInitializer.lf index 6754f31d97..9ed1d1cc19 100644 --- a/test/Python/src/multiport/BankIndexInitializer.lf +++ b/test/Python/src/multiport/BankIndexInitializer.lf @@ -3,15 +3,15 @@ target Python preamble {= table = [4, 3, 2, 1] =} -reactor Source(bank_index(0), value(0)) { +reactor Source(bank_index = 0, value = 0) { output out reaction(startup) -> out {= out.set(self.value) =} } -reactor Sink(width(4)) { +reactor Sink(width = 4) { input[width] _in - state received(false) + state received = false reaction(_in) {= for (idx, port) in enumerate(_in): @@ -30,7 +30,7 @@ reactor Sink(width(4)) { =} } -main reactor(width(4)) { +main reactor(width = 4) { source = new[width] Source(value = {= table[bank_index] =}) sink = new Sink(width = width) source.out -> sink._in diff --git a/test/Python/src/multiport/BankReactionsInContainer.lf b/test/Python/src/multiport/BankReactionsInContainer.lf index 3a72418405..9a2837c08d 100644 --- a/test/Python/src/multiport/BankReactionsInContainer.lf +++ b/test/Python/src/multiport/BankReactionsInContainer.lf @@ -5,10 +5,10 @@ target Python { timeout: 1 sec } -reactor R(bank_index(0)) { +reactor R(bank_index = 0) { output[2] out input[2] inp - state received(false) + state received = false reaction(startup) -> out {= for (i, p) in enumerate(out): @@ -37,7 +37,7 @@ reactor R(bank_index(0)) { main reactor { s = new[2] R() - state received(false) + state received = false reaction(startup) -> s.inp {= count = 0 diff --git a/test/Python/src/multiport/BankToBank.lf b/test/Python/src/multiport/BankToBank.lf index e94b7dd717..6e3ddc734d 100644 --- a/test/Python/src/multiport/BankToBank.lf +++ b/test/Python/src/multiport/BankToBank.lf @@ -4,10 +4,10 @@ target Python { fast: true } -reactor Source(bank_index(0)) { +reactor Source(bank_index = 0) { timer t(0, 200 msec) output out - state s(0) + state s = 0 reaction(t) -> out {= out.set(self.s) @@ -15,8 +15,8 @@ reactor Source(bank_index(0)) { =} } -reactor Destination(bank_index(0)) { - state s(0) +reactor Destination(bank_index = 0) { + state s = 0 input _in reaction(_in) {= @@ -35,7 +35,7 @@ reactor Destination(bank_index(0)) { =} } -main reactor BankToBank(width(4)) { +main reactor BankToBank(width = 4) { a = new[width] Source() b = new[width] Destination() a.out -> b._in diff --git a/test/Python/src/multiport/BankToBankMultiport.lf b/test/Python/src/multiport/BankToBankMultiport.lf index de2f05a55d..f335e53858 100644 --- a/test/Python/src/multiport/BankToBankMultiport.lf +++ b/test/Python/src/multiport/BankToBankMultiport.lf @@ -4,10 +4,10 @@ target Python { fast: true } -reactor Source(width(1)) { +reactor Source(width = 1) { timer t(0, 200 msec) output[width] out - state s(0) + state s = 0 reaction(t) -> out {= for port in out: @@ -16,8 +16,8 @@ reactor Source(width(1)) { =} } -reactor Destination(width(1)) { - state s(6) +reactor Destination(width = 1) { + state s = 6 input[width] _in reaction(_in) {= @@ -43,7 +43,7 @@ reactor Destination(width(1)) { =} } -main reactor BankToBankMultiport(bank_width(4)) { +main reactor BankToBankMultiport(bank_width = 4) { a = new[bank_width] Source(width = 4) b = new[bank_width] Destination(width = 4) a.out -> b._in diff --git a/test/Python/src/multiport/BankToBankMultiportAfter.lf b/test/Python/src/multiport/BankToBankMultiportAfter.lf index eb7f025772..9d6e946122 100644 --- a/test/Python/src/multiport/BankToBankMultiportAfter.lf +++ b/test/Python/src/multiport/BankToBankMultiportAfter.lf @@ -6,7 +6,7 @@ target Python { import Source, Destination from "BankToBankMultiport.lf" -main reactor BankToBankMultiportAfter(bank_width(4)) { +main reactor BankToBankMultiportAfter(bank_width = 4) { a = new[bank_width] Source(width = 4) b = new[bank_width] Destination(width = 4) a.out -> b._in after 200 msec diff --git a/test/Python/src/multiport/BankToMultiport.lf b/test/Python/src/multiport/BankToMultiport.lf index 110295400d..bddd217eec 100644 --- a/test/Python/src/multiport/BankToMultiport.lf +++ b/test/Python/src/multiport/BankToMultiport.lf @@ -1,15 +1,15 @@ # Test bank of reactors to multiport input with id parameter in the bank. target Python -reactor Source(bank_index(0)) { +reactor Source(bank_index = 0) { output out reaction(startup) -> out {= out.set(self.bank_index) =} } -reactor Sink(width(4)) { +reactor Sink(width = 4) { input[width] _in - state received(false) + state received = false reaction(_in) {= for (idx, port) in enumerate(_in): @@ -28,7 +28,7 @@ reactor Sink(width(4)) { =} } -main reactor BankToMultiport(width(5)) { +main reactor BankToMultiport(width = 5) { source = new[width] Source() sink = new Sink(width = width) source.out -> sink._in diff --git a/test/Python/src/multiport/Broadcast.lf b/test/Python/src/multiport/Broadcast.lf index ebc4de3067..eb39885483 100644 --- a/test/Python/src/multiport/Broadcast.lf +++ b/test/Python/src/multiport/Broadcast.lf @@ -3,15 +3,15 @@ target Python { fast: true } -reactor Source(value(42)) { +reactor Source(value = 42) { output out reaction(startup) -> out {= out.set(self.value) =} } -reactor Destination(bank_index(0), delay(0)) { +reactor Destination(bank_index = 0, delay = 0) { input _in - state received(false) + state received = false reaction(_in) {= print(f"Destination {self.bank_index} received {_in.value}.") diff --git a/test/Python/src/multiport/BroadcastMultipleAfter.lf b/test/Python/src/multiport/BroadcastMultipleAfter.lf index 7777406c38..003ebf276f 100644 --- a/test/Python/src/multiport/BroadcastMultipleAfter.lf +++ b/test/Python/src/multiport/BroadcastMultipleAfter.lf @@ -5,9 +5,9 @@ target Python { import Source from "Broadcast.lf" -reactor Destination(bank_index(0), delay(0)) { +reactor Destination(bank_index = 0, delay = 0) { input _in - state received(false) + state received = false reaction(_in) {= print(f"Destination {self.bank_index} received {_in.value}.") diff --git a/test/Python/src/multiport/MultiportFromBank.lf b/test/Python/src/multiport/MultiportFromBank.lf index 05dc165fa1..92d9363df5 100644 --- a/test/Python/src/multiport/MultiportFromBank.lf +++ b/test/Python/src/multiport/MultiportFromBank.lf @@ -5,7 +5,7 @@ target Python { fast: true } -reactor Source(check_override(0), bank_index(0)) { +reactor Source(check_override = 0, bank_index = 0) { output out reaction(startup) -> out {= @@ -15,7 +15,7 @@ reactor Source(check_override(0), bank_index(0)) { reactor Destination { input[3] _in - state received(0) + state received = 0 reaction(_in) {= for (idx, port) in enumerate(_in): diff --git a/test/Python/src/multiport/MultiportFromBankHierarchy.lf b/test/Python/src/multiport/MultiportFromBankHierarchy.lf index ac62f5829f..27ecb3c80b 100644 --- a/test/Python/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/Python/src/multiport/MultiportFromBankHierarchy.lf @@ -7,7 +7,7 @@ target Python { import Destination from "MultiportFromBank.lf" -reactor Source(bank_index(0)) { +reactor Source(bank_index = 0) { output out reaction(startup) -> out {= out.set(self.bank_index) =} diff --git a/test/Python/src/multiport/MultiportFromHierarchy.lf b/test/Python/src/multiport/MultiportFromHierarchy.lf index dc7a9a2f68..4116587f01 100644 --- a/test/Python/src/multiport/MultiportFromHierarchy.lf +++ b/test/Python/src/multiport/MultiportFromHierarchy.lf @@ -8,7 +8,7 @@ target Python { reactor Source { timer t(0, 200 msec) output[4] out - state s(0) + state s = 0 reaction(t) -> out {= for port in out: @@ -18,7 +18,7 @@ reactor Source { } reactor Destination { - state s(6) + state s = 6 input[4] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportFromReaction.lf b/test/Python/src/multiport/MultiportFromReaction.lf index f005711683..05b280b126 100644 --- a/test/Python/src/multiport/MultiportFromReaction.lf +++ b/test/Python/src/multiport/MultiportFromReaction.lf @@ -4,8 +4,8 @@ target Python { fast: true } -reactor Destination(width(1)) { - state s(6) +reactor Destination(width = 1) { + state s = 6 input[width] _in reaction(_in) {= @@ -31,7 +31,7 @@ reactor Destination(width(1)) { main reactor MultiportFromReaction { timer t(0, 200 msec) - state s(0) + state s = 0 b = new Destination(width = 4) reaction(t) -> b._in {= diff --git a/test/Python/src/multiport/MultiportIn.lf b/test/Python/src/multiport/MultiportIn.lf index 146dfa6727..35bdee7341 100644 --- a/test/Python/src/multiport/MultiportIn.lf +++ b/test/Python/src/multiport/MultiportIn.lf @@ -8,7 +8,7 @@ target Python { reactor Source { timer t(0, 200 msec) output out - state s(0) + state s = 0 reaction(t) -> out {= out.set(self.s) @@ -24,7 +24,7 @@ reactor Computation { } reactor Destination { - state s(0) + state s = 0 input[4] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportInParameterized.lf b/test/Python/src/multiport/MultiportInParameterized.lf index c4906d7a9c..28b15808e3 100644 --- a/test/Python/src/multiport/MultiportInParameterized.lf +++ b/test/Python/src/multiport/MultiportInParameterized.lf @@ -8,7 +8,7 @@ target Python { reactor Source { timer t(0, 200 msec) output out - state s(0) + state s = 0 reaction(t) -> out {= out.set(self.s) @@ -23,8 +23,8 @@ reactor Computation { reaction(_in) -> out {= out.set(_in.value) =} } -reactor Destination(width(1)) { - state s(0) +reactor Destination(width = 1) { + state s = 0 input[width] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportMutableInput.lf b/test/Python/src/multiport/MultiportMutableInput.lf index d17e1cd8bf..f931900ef7 100644 --- a/test/Python/src/multiport/MultiportMutableInput.lf +++ b/test/Python/src/multiport/MultiportMutableInput.lf @@ -12,7 +12,7 @@ reactor Source { =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input[2] _in reaction(_in) {= @@ -26,7 +26,7 @@ reactor Print(scale(1)) { # The scale parameter is just for testing. =} } -reactor Scale(scale(2)) { +reactor Scale(scale = 2) { mutable input[2] _in output[2] out diff --git a/test/Python/src/multiport/MultiportMutableInputArray.lf b/test/Python/src/multiport/MultiportMutableInputArray.lf index 76fa5203a6..9efa3eeebf 100644 --- a/test/Python/src/multiport/MultiportMutableInputArray.lf +++ b/test/Python/src/multiport/MultiportMutableInputArray.lf @@ -13,7 +13,7 @@ reactor Source { =} } -reactor Print(scale(1)) { # The scale parameter is just for testing. +reactor Print(scale = 1) { # The scale parameter is just for testing. input[2] _in reaction(_in) {= @@ -25,7 +25,7 @@ reactor Print(scale(1)) { # The scale parameter is just for testing. =} } -reactor Scale(scale(2)) { +reactor Scale(scale = 2) { mutable input[2] _in output[2] out diff --git a/test/Python/src/multiport/MultiportOut.lf b/test/Python/src/multiport/MultiportOut.lf index 0a48f355e6..3d29c5188a 100644 --- a/test/Python/src/multiport/MultiportOut.lf +++ b/test/Python/src/multiport/MultiportOut.lf @@ -7,7 +7,7 @@ target Python { reactor Source { timer t(0, 200 msec) output[4] out - state s(0) + state s = 0 reaction(t) -> out {= for port in out: @@ -25,7 +25,7 @@ reactor Computation { } reactor Destination { - state s(0) + state s = 0 input[4] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportToBank.lf b/test/Python/src/multiport/MultiportToBank.lf index 61b1cabc8b..12d68d6662 100644 --- a/test/Python/src/multiport/MultiportToBank.lf +++ b/test/Python/src/multiport/MultiportToBank.lf @@ -13,9 +13,9 @@ reactor Source { =} } -reactor Destination(bank_index(0)) { +reactor Destination(bank_index = 0) { input _in - state received(0) + state received = 0 reaction(_in) {= print("Destination " + str(self.bank_index) + " received " + str(_in.value)) diff --git a/test/Python/src/multiport/MultiportToBankAfter.lf b/test/Python/src/multiport/MultiportToBankAfter.lf index aeb8a9d0d7..13259e8811 100644 --- a/test/Python/src/multiport/MultiportToBankAfter.lf +++ b/test/Python/src/multiport/MultiportToBankAfter.lf @@ -7,9 +7,9 @@ target Python { import Source from "MultiportToBank.lf" -reactor Destination(bank_index(0)) { +reactor Destination(bank_index = 0) { input _in - state received(false) + state received = false reaction(_in) {= print("Destination {:d} received {:d}.".format(self.bank_index, _in.value)) diff --git a/test/Python/src/multiport/MultiportToBankHierarchy.lf b/test/Python/src/multiport/MultiportToBankHierarchy.lf index b36ae9b40b..2ec2313288 100644 --- a/test/Python/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Python/src/multiport/MultiportToBankHierarchy.lf @@ -7,9 +7,9 @@ target Python { import Source from "MultiportToBank.lf" -reactor Destination(bank_index(0)) { +reactor Destination(bank_index = 0) { input _in - state received(false) + state received = false reaction(_in) {= print("Destination {:d} received {:d}.\n".format(self.bank_index, _in.value)) diff --git a/test/Python/src/multiport/MultiportToHierarchy.lf b/test/Python/src/multiport/MultiportToHierarchy.lf index 6dbf76775f..2a9e25a5e6 100644 --- a/test/Python/src/multiport/MultiportToHierarchy.lf +++ b/test/Python/src/multiport/MultiportToHierarchy.lf @@ -9,7 +9,7 @@ target Python { reactor Source { timer t(0, 200 msec) output[4] out - state s(0) + state s = 0 reaction(t) -> out {= for port in out: @@ -18,8 +18,8 @@ reactor Source { =} } -reactor Destination(width(4)) { - state s(6) +reactor Destination(width = 4) { + state s = 6 input[width] _in reaction(_in) {= @@ -42,7 +42,7 @@ reactor Destination(width(4)) { =} } -reactor Container(width(4)) { +reactor Container(width = 4) { input[width] _in dst = new Destination() _in -> dst._in diff --git a/test/Python/src/multiport/MultiportToMultiport.lf b/test/Python/src/multiport/MultiportToMultiport.lf index 6fd4bbb231..b16e832e7e 100644 --- a/test/Python/src/multiport/MultiportToMultiport.lf +++ b/test/Python/src/multiport/MultiportToMultiport.lf @@ -6,10 +6,10 @@ target Python { import Destination from "MultiportToHierarchy.lf" -reactor Source(width(1)) { +reactor Source(width = 1) { timer t(0, 200 msec) output[width] out - state s(0) + state s = 0 reaction(t) -> out {= for i in range(len(out)): diff --git a/test/Python/src/multiport/MultiportToMultiport2.lf b/test/Python/src/multiport/MultiportToMultiport2.lf index 5b06d8d7d8..cb6da65f35 100644 --- a/test/Python/src/multiport/MultiportToMultiport2.lf +++ b/test/Python/src/multiport/MultiportToMultiport2.lf @@ -1,7 +1,7 @@ # Test multiport to multiport connections. See also MultiportToMultiport. target Python -reactor Source(width(2)) { +reactor Source(width = 2) { output[width] out reaction(startup) -> out {= @@ -10,7 +10,7 @@ reactor Source(width(2)) { =} } -reactor Destination(width(2)) { +reactor Destination(width = 2) { input[width] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportToMultiport2After.lf b/test/Python/src/multiport/MultiportToMultiport2After.lf index d8d85805ce..0e7ee9aef2 100644 --- a/test/Python/src/multiport/MultiportToMultiport2After.lf +++ b/test/Python/src/multiport/MultiportToMultiport2After.lf @@ -3,7 +3,7 @@ target Python import Source from "MultiportToMultiport2.lf" -reactor Destination(width(2)) { +reactor Destination(width = 2) { input[width] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportToMultiportArray.lf b/test/Python/src/multiport/MultiportToMultiportArray.lf index e22f3541b0..5eb043570d 100644 --- a/test/Python/src/multiport/MultiportToMultiportArray.lf +++ b/test/Python/src/multiport/MultiportToMultiportArray.lf @@ -8,7 +8,7 @@ target Python { reactor Source { timer t(0, 200 msec) output[2] out - state s(0) + state s = 0 reaction(t) -> out {= for port in out: @@ -18,7 +18,7 @@ reactor Source { } reactor Destination { - state s(15) + state s = 15 input[2] _in reaction(_in) {= diff --git a/test/Python/src/multiport/MultiportToMultiportParameter.lf b/test/Python/src/multiport/MultiportToMultiportParameter.lf index 933abfd846..b47905bb6e 100644 --- a/test/Python/src/multiport/MultiportToMultiportParameter.lf +++ b/test/Python/src/multiport/MultiportToMultiportParameter.lf @@ -7,7 +7,7 @@ target Python { import Source from "MultiportToMultiport.lf" import Destination from "MultiportToHierarchy.lf" -main reactor MultiportToMultiportParameter(width(4)) { +main reactor MultiportToMultiportParameter(width = 4) { a = new Source(width = width) b = new Destination(width = width) a.out -> b._in diff --git a/test/Python/src/multiport/MultiportToPort.lf b/test/Python/src/multiport/MultiportToPort.lf index 52bb7b7c67..6ec88187e1 100644 --- a/test/Python/src/multiport/MultiportToPort.lf +++ b/test/Python/src/multiport/MultiportToPort.lf @@ -15,9 +15,9 @@ reactor Source { =} } -reactor Destination(expected(0)) { +reactor Destination(expected = 0) { input _in - state received(false) + state received = false reaction(_in) {= print("Received: ", _in.value) diff --git a/test/Python/src/multiport/MultiportToReaction.lf b/test/Python/src/multiport/MultiportToReaction.lf index 6d03ba28ee..b45ee9ac9e 100644 --- a/test/Python/src/multiport/MultiportToReaction.lf +++ b/test/Python/src/multiport/MultiportToReaction.lf @@ -4,9 +4,9 @@ target Python { fast: true } -reactor Source(width(1)) { +reactor Source(width = 1) { timer t(0, 200 msec) - state s(0) + state s = 0 output[width] out reaction(t) -> out {= @@ -17,7 +17,7 @@ reactor Source(width(1)) { } main reactor { - state s(6) + state s = 6 b = new Source(width = 4) reaction(b.out) {= diff --git a/test/Python/src/multiport/NestedBanks.lf b/test/Python/src/multiport/NestedBanks.lf index 8e49b76aef..1e863043e6 100644 --- a/test/Python/src/multiport/NestedBanks.lf +++ b/test/Python/src/multiport/NestedBanks.lf @@ -13,13 +13,13 @@ main reactor { (a.x)+ -> c.z, d.u, e.t } -reactor A(bank_index(0)) { +reactor A(bank_index = 0) { output[4] x b = new[2] B(a_bank_index = bank_index) b.y -> x } -reactor B(a_bank_index(0), bank_index(0)) { +reactor B(a_bank_index = 0, bank_index = 0) { output[2] y reaction(startup) -> y {= @@ -29,7 +29,7 @@ reactor B(a_bank_index(0), bank_index(0)) { =} } -reactor C(bank_index(0)) { +reactor C(bank_index = 0) { input[2] z f = new F(c_bank_index = bank_index) g = new G(c_bank_index = bank_index) @@ -57,7 +57,7 @@ reactor E { =} } -reactor F(c_bank_index(0)) { +reactor F(c_bank_index = 0) { input w reaction(w) {= @@ -68,7 +68,7 @@ reactor F(c_bank_index(0)) { =} } -reactor G(c_bank_index(0)) { +reactor G(c_bank_index = 0) { input s reaction(s) {= diff --git a/test/Python/src/multiport/NestedInterleavedBanks.lf b/test/Python/src/multiport/NestedInterleavedBanks.lf index 5d615a3397..9be37badcd 100644 --- a/test/Python/src/multiport/NestedInterleavedBanks.lf +++ b/test/Python/src/multiport/NestedInterleavedBanks.lf @@ -4,7 +4,7 @@ */ target Python -reactor A(bank_index(0), outer_bank_index(0)) { +reactor A(bank_index = 0, outer_bank_index = 0) { output[2] p reaction(startup) -> p {= @@ -14,7 +14,7 @@ reactor A(bank_index(0), outer_bank_index(0)) { =} } -reactor B(bank_index(0)) { +reactor B(bank_index = 0) { output[4] q a = new[2] A(outer_bank_index = bank_index) interleaved (a.p) -> q diff --git a/test/Python/src/multiport/ReactionsToNested.lf b/test/Python/src/multiport/ReactionsToNested.lf index 9870cb1b68..2077483b4e 100644 --- a/test/Python/src/multiport/ReactionsToNested.lf +++ b/test/Python/src/multiport/ReactionsToNested.lf @@ -4,9 +4,9 @@ target Python { timeout: 1 sec } -reactor T(expected(0)) { +reactor T(expected = 0) { input z - state received(false) + state received = false reaction(z) {= print(f"T received {z.value}.") diff --git a/test/Python/src/target/AfterNoTypes.lf b/test/Python/src/target/AfterNoTypes.lf index 3ff3983da5..44aaa89c73 100644 --- a/test/Python/src/target/AfterNoTypes.lf +++ b/test/Python/src/target/AfterNoTypes.lf @@ -13,8 +13,8 @@ reactor Foo { } reactor Print { - state expected_time(10 msec) - state received(0) + state expected_time = 10 msec + state received = 0 input x reaction(x) {= diff --git a/test/Rust/src/MovingAverage.lf b/test/Rust/src/MovingAverage.lf index 65132ce1d0..3dcbb69c98 100644 --- a/test/Rust/src/MovingAverage.lf +++ b/test/Rust/src/MovingAverage.lf @@ -17,7 +17,7 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {=[f64 ; 4]=} = {= [ 0.0 ; 4 ] =} + state delay_line: {= [f64 ; 4] =} = {= [ 0.0 ; 4 ] =} state index: usize = 0 input in_: f64 output out: f64 From 2eb74126dd24dea3238c791ab2dcb1c40c1fb88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Mar 2023 17:42:26 +0100 Subject: [PATCH 16/49] Add braced list expression this is to replace the old C syntax --- org.lflang/src/org/lflang/LinguaFranca.xtext | 10 +++- org.lflang/src/org/lflang/Target.java | 14 ++++-- org.lflang/src/org/lflang/ast/ToLf.java | 24 ++++++++- org.lflang/src/org/lflang/ast/ToText.java | 6 +++ .../src/org/lflang/generator/TargetTypes.java | 7 +++ .../org/lflang/validation/LFValidator.java | 19 +++++-- test/C/src/ArrayAsParameter.lf | 4 +- test/C/src/MovingAverage.lf | 4 +- test/C/src/NativeListsAndTimes.lf | 10 ++-- test/C/src/StructAsState.lf | 2 +- test/C/src/concurrent/ScheduleAt.lf | 49 +++++++++---------- test/C/src/lib/Test.lf | 2 +- test/Cpp/src/ArrayAsParameter.lf | 4 +- .../src/target/BraceAndParenInitialization.lf | 2 +- 14 files changed, 110 insertions(+), 47 deletions(-) diff --git a/org.lflang/src/org/lflang/LinguaFranca.xtext b/org.lflang/src/org/lflang/LinguaFranca.xtext index b83ff9e932..23794a19e6 100644 --- a/org.lflang/src/org/lflang/LinguaFranca.xtext +++ b/org.lflang/src/org/lflang/LinguaFranca.xtext @@ -293,7 +293,8 @@ AssignmentInitializer returns Initializer: // these syntaxes are legacy and now deprecated // todo remove in future version. | '='? parens?='(' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? ')' - | '='? braces?='{' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? '}' + // note: the previous syntax `= { expr* }` is now parsed as a BracedListExpression + | braces?='{' (exprs+=Expression (',' exprs+=Expression)* (trailingComma?=',')?)? '}' ; @@ -311,6 +312,13 @@ Expression: | Time | ParameterReference | {CodeExpr} code=Code + | BracedListExpression +; + +// A list of expressions within braces. +// In C/C++, this is an array initializer, struct initializer, or std::initializer_list. +BracedListExpression: + '{' ( items+=Expression (',' items+=Expression)* )? ','? '}' ; ParameterReference: diff --git a/org.lflang/src/org/lflang/Target.java b/org.lflang/src/org/lflang/Target.java index 24d942a5be..c3bfda067a 100644 --- a/org.lflang/src/org/lflang/Target.java +++ b/org.lflang/src/org/lflang/Target.java @@ -486,9 +486,7 @@ public boolean supportsMultiports() { * on constants). */ public boolean supportsParameterizedWidths() { - return switch (this) { - case C, CCPP, CPP, Python, Rust, TS -> true; - }; + return true; } /** @@ -502,10 +500,20 @@ public boolean buildsUsingDocker() { }; } + /** + * Whether the target requires using an equal sign to assign a defaul value to a parameter, + * or initialize a state variable. All targets mandate an equal sign when passing + * arguments to a reactor constructor call, regardless of this method. + */ public boolean mandatesEqualsInitializers() { return this != CPP; } + /** Allow expressions of the form {@code {a, b, c}}. */ + public boolean allowsBracedListExpressions() { + return this == C || this == CCPP || this == CPP; + } + /** * Return a string that demarcates the beginning of a single-line comment. */ diff --git a/org.lflang/src/org/lflang/ast/ToLf.java b/org.lflang/src/org/lflang/ast/ToLf.java index 8fd73ff48e..571fbc4227 100644 --- a/org.lflang/src/org/lflang/ast/ToLf.java +++ b/org.lflang/src/org/lflang/ast/ToLf.java @@ -21,6 +21,7 @@ import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.lflang.ASTUtils; +import org.lflang.Target; import org.lflang.ast.MalleableString.Builder; import org.lflang.ast.MalleableString.Joiner; import org.lflang.lf.Action; @@ -29,6 +30,7 @@ import org.lflang.lf.Assignment; import org.lflang.lf.AttrParm; import org.lflang.lf.Attribute; +import org.lflang.lf.BracedListExpression; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; @@ -46,6 +48,7 @@ import org.lflang.lf.Instantiation; import org.lflang.lf.KeyValuePair; import org.lflang.lf.KeyValuePairs; +import org.lflang.lf.LfFactory; import org.lflang.lf.Literal; import org.lflang.lf.Method; import org.lflang.lf.MethodArgument; @@ -757,7 +760,9 @@ public MalleableString caseSerializer(Serializer object) { @Override public MalleableString caseKeyValuePairs(KeyValuePairs object) { // {KeyValuePairs} '{' (pairs+=KeyValuePair (',' (pairs+=KeyValuePair))* ','?)? '}' - if (object.getPairs().isEmpty()) return MalleableString.anyOf(""); + if (object.getPairs().isEmpty()) { + return MalleableString.anyOf(""); + } return new Builder() .append("{\n") .append(list(",\n", "", "\n", true, true, object.getPairs()).indent()) @@ -765,6 +770,16 @@ public MalleableString caseKeyValuePairs(KeyValuePairs object) { .get(); } + @Override + public MalleableString caseBracedListExpression(BracedListExpression object) { + if (object.getItems().isEmpty()) { + return MalleableString.anyOf("{}"); + } + // Note that this strips the trailing comma. There is no way + // to implement trailing commas with the current set of list() methods AFAIU. + return list(", ", "{ ", " }", false, false, object.getItems()); + } + @Override public MalleableString caseKeyValuePair(KeyValuePair object) { // name=Kebab ':' value=Element @@ -842,6 +857,13 @@ private MalleableString initializer(Initializer init, boolean nothingIfEmpty) { Objects.requireNonNull(expr); return new Builder().append(" = ").append(doSwitch(expr)).get(); } + if (ASTUtils.getTarget(init) == Target.C) { + // This turns C array initializers into a braced expression. + // C++ variants are not converted. + BracedListExpression list = LfFactory.eINSTANCE.createBracedListExpression(); + list.getItems().addAll(init.getExprs()); + return new Builder().append(" = ").append(doSwitch(list)).get(); + } String prefix; String suffix; if (init.isBraces()) { diff --git a/org.lflang/src/org/lflang/ast/ToText.java b/org.lflang/src/org/lflang/ast/ToText.java index c97be28c8f..38c32fd67c 100644 --- a/org.lflang/src/org/lflang/ast/ToText.java +++ b/org.lflang/src/org/lflang/ast/ToText.java @@ -10,6 +10,7 @@ import org.lflang.ASTUtils; import org.lflang.lf.ArraySpec; +import org.lflang.lf.BracedListExpression; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; import org.lflang.lf.Host; @@ -78,6 +79,11 @@ public String caseCode(Code code) { return ""; } + @Override + public String caseBracedListExpression(BracedListExpression object) { + return ToLf.instance.caseBracedListExpression(object).toString(); + } + @Override public String caseHost(Host host) { return ToLf.instance.caseHost(host).toString(); diff --git a/org.lflang/src/org/lflang/generator/TargetTypes.java b/org.lflang/src/org/lflang/generator/TargetTypes.java index cb7f87d91e..c791c36330 100644 --- a/org.lflang/src/org/lflang/generator/TargetTypes.java +++ b/org.lflang/src/org/lflang/generator/TargetTypes.java @@ -8,6 +8,7 @@ import org.lflang.InferredType; import org.lflang.TimeValue; import org.lflang.lf.Action; +import org.lflang.lf.BracedListExpression; import org.lflang.lf.CodeExpr; import org.lflang.lf.Expression; import org.lflang.lf.Initializer; @@ -68,6 +69,12 @@ default String getTargetParamRef(ParameterReference expr, InferredType typeOrNul return escapeIdentifier(expr.getParameter().getName()); } + /** Translate the braced list expression into target language syntax. */ + default String getTargetBracedListExpr(BracedListExpression expr, InferredType typeOrNull) { + return expr.getItems().stream().map(e -> getTargetExpr(e, typeOrNull.getComponentType())) + .collect(Collectors.joining(",", "{", "}")); + } + /** * Return an "undefined" type which is used as a default * when a type cannot be inferred. diff --git a/org.lflang/src/org/lflang/validation/LFValidator.java b/org.lflang/src/org/lflang/validation/LFValidator.java index bfdb92fc3e..48480528dd 100644 --- a/org.lflang/src/org/lflang/validation/LFValidator.java +++ b/org.lflang/src/org/lflang/validation/LFValidator.java @@ -69,6 +69,7 @@ import org.lflang.lf.ActionOrigin; import org.lflang.lf.Assignment; import org.lflang.lf.Attribute; +import org.lflang.lf.BracedListExpression; import org.lflang.lf.BuiltinTrigger; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.CodeExpr; @@ -189,6 +190,15 @@ public void checkInitializer(Initializer init) { } } + @Check(CheckType.FAST) + public void checkBracedExpression(BracedListExpression expr) { + if (!target.allowsBracedListExpressions()) { + var message = "Braced expression lists are not a valid expression for the " + target + + " target."; + error(message, Literals.BRACED_LIST_EXPRESSION.eContainmentFeature()); + } + } + @Check(CheckType.FAST) public void checkAssignment(Assignment assignment) { @@ -1601,9 +1611,12 @@ public void typeCheck(Initializer init, InferredType type, EStructuralFeature fe // list of times var exprs = init.getExprs(); if (exprs.isEmpty()) { - error("Expected exactly one time value.", feature); + error("Expected at least one time value.", feature); return; } + if (exprs.size() == 1 && exprs.get(0) instanceof BracedListExpression) { + exprs = ((BracedListExpression) exprs.get(0)).getItems(); + } for (var component : exprs) { checkExpressionIsTime(component, feature); } @@ -1613,7 +1626,7 @@ public void typeCheck(Initializer init, InferredType type, EStructuralFeature fe } } - public void checkExpressionIsTime(Initializer init, EStructuralFeature feature) { + private void checkExpressionIsTime(Initializer init, EStructuralFeature feature) { if (init == null) { return; } @@ -1625,7 +1638,7 @@ public void checkExpressionIsTime(Initializer init, EStructuralFeature feature) } } - public void checkExpressionIsTime(Expression value, EStructuralFeature feature) { + private void checkExpressionIsTime(Expression value, EStructuralFeature feature) { if (value == null || value instanceof Time) { return; } diff --git a/test/C/src/ArrayAsParameter.lf b/test/C/src/ArrayAsParameter.lf index f235ef5f96..42a9093eae 100644 --- a/test/C/src/ArrayAsParameter.lf +++ b/test/C/src/ArrayAsParameter.lf @@ -3,7 +3,7 @@ // encode their own length. target C -reactor Source(sequence: int[](0, 1, 2), n_sequence: int = 3) { +reactor Source(sequence: int[] = { 0, 1, 2 }, n_sequence: int = 3) { output out: int state count: int = 0 logical action next @@ -41,7 +41,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence(1, 2, 3, 4), n_sequence = 4) + s = new Source(sequence = { 1, 2, 3, 4 }, n_sequence = 4) p = new Print() s.out -> p.in } diff --git a/test/C/src/MovingAverage.lf b/test/C/src/MovingAverage.lf index bdc47be451..d72c5b132d 100644 --- a/test/C/src/MovingAverage.lf +++ b/test/C/src/MovingAverage.lf @@ -20,7 +20,7 @@ reactor MASource { } reactor MovingAverageImpl { - state delay_line: double[](0.0, 0.0, 0.0) + state delay_line: double[] = { 0.0, 0.0, 0.0 } state index: int = 0 input in: double output out: double @@ -47,7 +47,7 @@ reactor MovingAverageImpl { main reactor MovingAverage { s = new MASource() m = new MovingAverageImpl() - p = new TestDouble(expected(0.0, 0.25, 0.75, 1.5, 2.5, 3.5)) + p = new TestDouble(expected = { 0.0, 0.25, 0.75, 1.5, 2.5, 3.5 }) s.out -> m.in m.out -> p.in } diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index f7ce6f5ce9..9a448d79ef 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -3,11 +3,11 @@ target C // This test passes if it is successfully compiled into valid target code. main reactor( x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[](1, 2, 3, 4), // List of integers - q: interval_t[](1 msec, 2 msec, 3 msec), // list of time values - g: time[](1 msec, 2 msec) // List of time values + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[] = { 1, 2, 3, 4, }, // List of integers + q: interval_t[] = { 1 msec, 2 msec, 3 msec, }, // list of time values + g: time[] = { 1 msec, 2 msec, } // List of time values ) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter diff --git a/test/C/src/StructAsState.lf b/test/C/src/StructAsState.lf index b57b15d07b..62e04110b0 100644 --- a/test/C/src/StructAsState.lf +++ b/test/C/src/StructAsState.lf @@ -10,7 +10,7 @@ main reactor StructAsState { } hello_t; =} // Notice that target code delimiters are no longer necessary. - state s: hello_t("Earth", 42) + state s: hello_t = { "Earth", 42 } reaction(startup) {= printf("State s.name=\"%s\", value=%d.\n", self->s.name, self->s.value); diff --git a/test/C/src/concurrent/ScheduleAt.lf b/test/C/src/concurrent/ScheduleAt.lf index 9ff100ebd0..cfb80dbe41 100644 --- a/test/C/src/concurrent/ScheduleAt.lf +++ b/test/C/src/concurrent/ScheduleAt.lf @@ -12,27 +12,26 @@ target C { reactor Scheduler { logical action act // List of microsteps. Size = 16 - state microstep_delay_list: uint32_t[] = {= - { - 0, - 1, - 1, - 2, - 2, - 0, - 0, - 1, - 1, - 0, - 2, - 3, - 3, - 4, - 4, - 5 - } - =} - state times: int[]( + state microstep_delay_list: uint32_t[] = { + 0, + 1, + 1, + 2, + 2, + 0, + 0, + 1, + 1, + 0, + 2, + 3, + 3, + 4, + 4, + 5 + } + + state times: int[] = { 0, 0, 0, @@ -49,10 +48,10 @@ reactor Scheduler { 900 msec, 900 msec, 900 msec - ) + } // Size = 9 - state action_hit_list_microstep: int[] = {= {1, 2, 0, 1, 0, 2, 3, 4, 5} =} - state action_hit_list_times: int[]( + state action_hit_list_microstep: int[] = { 1, 2, 0, 1, 0, 2, 3, 4, 5 } + state action_hit_list_times: int[] = { 0, 0, 400 msec, @@ -62,7 +61,7 @@ reactor Scheduler { 800 msec, 900 msec, 900 msec - ) + } // Size = 9 state action_hit_list_index: int = 0 diff --git a/test/C/src/lib/Test.lf b/test/C/src/lib/Test.lf index 067c61ee1d..8bcbab2ad8 100644 --- a/test/C/src/lib/Test.lf +++ b/test/C/src/lib/Test.lf @@ -1,6 +1,6 @@ target C -reactor TestDouble(expected: double[](1.0, 1.0, 1.0, 1.0)) { +reactor TestDouble(expected: double[] = { 1.0, 1.0, 1.0, 1.0 }) { input in: double state count: int = 0 diff --git a/test/Cpp/src/ArrayAsParameter.lf b/test/Cpp/src/ArrayAsParameter.lf index db9f564890..a96cdd4855 100644 --- a/test/Cpp/src/ArrayAsParameter.lf +++ b/test/Cpp/src/ArrayAsParameter.lf @@ -2,7 +2,7 @@ // passes to Print. target Cpp -reactor Source(sequence: int[]{0, 1, 2}) { +reactor Source(sequence: std::vector = {0, 1, 2}) { output out: size_t state count: size_t = 0 logical action next: void @@ -38,7 +38,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence = {= {1, 2, 3, 4} =}) + s = new Source(sequence = {1, 2, 3, 4} ) p = new Print() s.out -> p.in } diff --git a/test/Cpp/src/target/BraceAndParenInitialization.lf b/test/Cpp/src/target/BraceAndParenInitialization.lf index 8838187bc2..8c68f88a7d 100644 --- a/test/Cpp/src/target/BraceAndParenInitialization.lf +++ b/test/Cpp/src/target/BraceAndParenInitialization.lf @@ -28,6 +28,6 @@ reactor Foo( main reactor { foo = new Foo( param_list_3 = {= std::vector(3, 5) =}, - param_list_4 = {= {3, 5} =} + param_list_4 = {3, 5} ) } From 93063cbc5045ba2249237c2ccb9a759f824eff75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 1 Mar 2023 18:03:26 +0100 Subject: [PATCH 17/49] Improve CTypes and cleanup GeneratorBase --- .../federated/extensions/CExtension.java | 13 ++-- .../federated/extensions/CExtensionUtils.java | 18 ++--- .../org/lflang/generator/GeneratorBase.java | 77 ------------------- .../src/org/lflang/generator/TargetTypes.java | 6 +- .../lflang/generator/c/CActionGenerator.java | 7 +- .../org/lflang/generator/c/CGenerator.java | 6 +- .../generator/c/CParameterGenerator.java | 30 ++++---- .../lflang/generator/c/CStateGenerator.java | 15 +--- .../lflang/generator/c/CTimerGenerator.java | 6 +- .../src/org/lflang/generator/c/CTypes.java | 72 +++++++++++++---- .../org/lflang/generator/python/PyUtil.java | 22 +----- .../generator/python/PythonGenerator.java | 2 +- .../python/PythonParameterGenerator.java | 3 +- .../lflang/generator/python/PythonTypes.java | 47 ++++++----- 14 files changed, 133 insertions(+), 191 deletions(-) diff --git a/org.lflang/src/org/lflang/federated/extensions/CExtension.java b/org.lflang/src/org/lflang/federated/extensions/CExtension.java index d9ed222920..39dad36e4a 100644 --- a/org.lflang/src/org/lflang/federated/extensions/CExtension.java +++ b/org.lflang/src/org/lflang/federated/extensions/CExtension.java @@ -47,19 +47,16 @@ import org.lflang.federated.generator.FederateInstance; import org.lflang.federated.serialization.FedROS2CPPSerialization; import org.lflang.generator.CodeBuilder; -import org.lflang.generator.GeneratorBase; import org.lflang.generator.GeneratorUtils; import org.lflang.generator.LFGeneratorContext; import org.lflang.generator.ReactionInstance; import org.lflang.generator.ReactorInstance; -import org.lflang.generator.c.CGenerator; import org.lflang.generator.c.CTypes; import org.lflang.generator.c.CUtil; import org.lflang.lf.Action; import org.lflang.lf.Output; import org.lflang.lf.Port; import org.lflang.lf.VarRef; -import org.lflang.util.FileUtil; /** * An extension class to the CGenerator that enables certain federated @@ -177,7 +174,7 @@ protected void deserialize( CodeBuilder result, ErrorReporter errorReporter ) { - CTypes types = new CTypes(errorReporter); + CTypes types = new CTypes(); // Adjust the type of the action and the receivingPort. // If it is "string", then change it to "char*". // This string is dynamically allocated, and type 'string' is to be @@ -345,7 +342,7 @@ protected void serializeAndSend( String commonArgs, ErrorReporter errorReporter ) { - CTypes types = new CTypes(errorReporter); + CTypes types = new CTypes(); var lengthExpression = ""; var pointerExpression = ""; switch (connection.getSerializer()) { @@ -431,7 +428,7 @@ public String generateNetworkInputControlReactionBody( // Find the maximum STP for decentralized coordination if(coordination == CoordinationType.DECENTRALIZED) { - result.pr("max_STP = "+ GeneratorBase.timeInTargetLanguage(maxSTP)+";"); + result.pr("max_STP = "+ CTypes.getInstance().getTargetTimeExpr(maxSTP) +";"); } result.pr("// Wait until the port status is known"); result.pr("wait_until_port_status_known("+receivingPortID+", max_STP);"); @@ -624,7 +621,7 @@ private String generateCodeToInitializeFederate(FederateInstance federate, Linke if (stpParam.isPresent()) { var globalSTP = ASTUtils.initialValue(stpParam.get(), List.of(federate.instantiation)).get(0); var globalSTPTV = ASTUtils.getLiteralTimeValue(globalSTP); - code.pr("lf_set_stp_offset("+ CGenerator.timeInTargetLanguage(globalSTPTV)+");"); + code.pr("lf_set_stp_offset("+ CTypes.getInstance().getTargetTimeExpr(globalSTPTV) +");"); } } @@ -749,7 +746,7 @@ private String generateCodeForPhysicalActions(FederateInstance federate, ErrorRe } code.pr( "_fed.min_delay_from_physical_action_to_federate_output = " - + GeneratorBase.timeInTargetLanguage(minDelay) + ";"); + + CTypes.getInstance().getTargetTimeExpr(minDelay) + ";"); } } return code.getCode(); diff --git a/org.lflang/src/org/lflang/federated/extensions/CExtensionUtils.java b/org.lflang/src/org/lflang/federated/extensions/CExtensionUtils.java index a24bcbae58..787b19ef13 100644 --- a/org.lflang/src/org/lflang/federated/extensions/CExtensionUtils.java +++ b/org.lflang/src/org/lflang/federated/extensions/CExtensionUtils.java @@ -430,16 +430,16 @@ public static String generateFederateNeighborStructure(FederateInstance federate // Use NEVER to encode no delay at all. code.pr("candidate_tmp = NEVER;"); } else { - var delayTime = GeneratorBase.getTargetTime(delay); - if (delay instanceof ParameterReference) { - // The delay is given as a parameter reference. Find its value. - final var param = ((ParameterReference)delay).getParameter(); - delayTime = GeneratorBase.timeInTargetLanguage(ASTUtils.getDefaultAsTimeValue(param)); - } + var delayTime = + delay instanceof ParameterReference + // In that case use the default value. + ? CTypes.getInstance().getTargetTimeExpr(ASTUtils.getDefaultAsTimeValue(((ParameterReference) delay).getParameter())) + : CTypes.getInstance().getTargetExpr(delay, InferredType.time()); + code.pr(String.join("\n", - "if ("+delayTime+" < candidate_tmp) {", - " candidate_tmp = "+delayTime+";", - "}" + "if (" + delayTime + " < candidate_tmp) {", + " candidate_tmp = " + delayTime + ";", + "}" )); } } diff --git a/org.lflang/src/org/lflang/generator/GeneratorBase.java b/org.lflang/src/org/lflang/generator/GeneratorBase.java index c55a9cc29f..427fa73e54 100644 --- a/org.lflang/src/org/lflang/generator/GeneratorBase.java +++ b/org.lflang/src/org/lflang/generator/GeneratorBase.java @@ -47,19 +47,15 @@ import org.lflang.MainConflictChecker; import org.lflang.Target; import org.lflang.TargetConfig; -import org.lflang.TimeUnit; -import org.lflang.TimeValue; import org.lflang.ast.AstTransformation; import org.lflang.graph.InstantiationGraph; import org.lflang.lf.Connection; -import org.lflang.lf.Expression; import org.lflang.lf.Instantiation; import org.lflang.lf.LfFactory; import org.lflang.lf.Mode; import org.lflang.lf.Reaction; import org.lflang.lf.Reactor; -import org.lflang.lf.Time; import org.lflang.validation.AbstractLFValidator; import com.google.common.base.Objects; @@ -421,33 +417,6 @@ public int getReactionBankIndex(Reaction reaction) { return reactionBankIndices.get(reaction); } - /** - * Given a representation of time that may possibly include units, return - * a string that the target language can recognize as a value. In this base - * class, if units are given, e.g. "msec", then we convert the units to upper - * case and return an expression of the form "MSEC(value)". Particular target - * generators will need to either define functions or macros for each possible - * time unit or override this method to return something acceptable to the - * target language. - * @param time A TimeValue that represents a time. - * @return A string, such as "MSEC(100)" for 100 milliseconds. - */ - public static String timeInTargetLanguage(TimeValue time) { - if (time != null) { - if (time.unit != null) { - return cMacroName(time.unit) + "(" + time.getMagnitude() + ")"; - } else { - return Long.valueOf(time.getMagnitude()).toString(); - } - } - return "0"; // FIXME: do this or throw exception? - } - - // note that this is moved out by #544 - public static String cMacroName(TimeUnit unit) { - return unit.getCanonicalName().toUpperCase(); - } - // ////////////////////////////////////////// // // Protected methods. @@ -677,50 +646,4 @@ public void printInfo(LFGeneratorContext.Mode mode) { */ public abstract Target getTarget(); - /** - * Get textual representation of a time in the target language. - * - * @param t A time AST node - * @return A time string in the target language - */ - // FIXME: this should be placed in ExpressionGenerator - public static String getTargetTime(Time t) { - TimeValue value = new TimeValue(t.getInterval(), TimeUnit.fromName(t.getUnit())); - return timeInTargetLanguage(value); - } - - /** - * Get textual representation of a value in the target language. - * - * If the value evaluates to 0, it is interpreted as a normal value. - * - * @param expr An AST node - * @return A string in the target language - */ - // FIXME: this should be placed in ExpressionGenerator - public static String getTargetValue(Expression expr) { - if (expr instanceof Time) { - return getTargetTime((Time)expr); - } - return ASTUtils.toText(expr); - } - - /** - * Get textual representation of a value in the target language. - * - * If the value evaluates to 0, it is interpreted as a time. - * - * @param expr A time AST node - * @return A time string in the target language - */ - // FIXME: this should be placed in ExpressionGenerator - public static String getTargetTime(Expression expr) { - if (expr instanceof Time) { - return getTargetTime((Time)expr); - } else if (ASTUtils.isZero(expr)) { - TimeValue value = TimeValue.ZERO; - return timeInTargetLanguage(value); - } - return ASTUtils.toText(expr); - } } diff --git a/org.lflang/src/org/lflang/generator/TargetTypes.java b/org.lflang/src/org/lflang/generator/TargetTypes.java index c791c36330..0750d28766 100644 --- a/org.lflang/src/org/lflang/generator/TargetTypes.java +++ b/org.lflang/src/org/lflang/generator/TargetTypes.java @@ -229,10 +229,8 @@ default String getTargetInitializer(Initializer init, Type type) { var targetValues = init.getExprs().stream().map(it -> getTargetExpr(it, inferredType)).collect(Collectors.toList()); if (inferredType.isFixedSizeList) { return getFixedSizeListInitExpression(targetValues, inferredType.listSize, init.isBraces()); - } else if (inferredType.isVariableSizeList) { + } else { return getVariableSizeListInitExpression(targetValues, init.isBraces()); - } else { - return getMissingExpr(inferredType); } } @@ -252,6 +250,8 @@ default String getTargetExpr(Expression expr, InferredType type) { return ASTUtils.addZeroToLeadingDot(((Literal) expr).getLiteral()); // here we don't escape } else if (expr instanceof CodeExpr) { return ASTUtils.toText(((CodeExpr) expr).getCode()); + } else if (expr instanceof BracedListExpression) { + return getTargetBracedListExpr((BracedListExpression) expr, type); } else { throw new IllegalStateException("Invalid value " + expr); } diff --git a/org.lflang/src/org/lflang/generator/c/CActionGenerator.java b/org.lflang/src/org/lflang/generator/c/CActionGenerator.java index e800328e18..1c4a1b45e8 100644 --- a/org.lflang/src/org/lflang/generator/c/CActionGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CActionGenerator.java @@ -4,10 +4,8 @@ import java.util.ArrayList; import org.lflang.ASTUtils; import org.lflang.Target; -import org.lflang.federated.generator.FederateInstance; import org.lflang.generator.ActionInstance; import org.lflang.generator.CodeBuilder; -import org.lflang.generator.GeneratorBase; import org.lflang.generator.ReactorInstance; import org.lflang.lf.Action; import org.lflang.lf.Reactor; @@ -40,9 +38,10 @@ public static String generateInitializers( var triggerStructName = CUtil.reactorRef(action.getParent()) + "->_lf__" + action.getName(); var minDelay = action.getMinDelay(); var minSpacing = action.getMinSpacing(); - var offsetInitializer = triggerStructName+".offset = " + GeneratorBase.timeInTargetLanguage(minDelay) + ";"; + var offsetInitializer = triggerStructName+".offset = " + CTypes.getInstance().getTargetTimeExpr(minDelay) + + ";"; var periodInitializer = triggerStructName+".period = " + (minSpacing != null ? - GeneratorBase.timeInTargetLanguage(minSpacing) : + CTypes.getInstance().getTargetTimeExpr(minSpacing) : CGenerator.UNDEFINED_MIN_SPACING) + ";"; code.addAll(List.of( "// Initializing action "+action.getFullName(), diff --git a/org.lflang/src/org/lflang/generator/c/CGenerator.java b/org.lflang/src/org/lflang/generator/c/CGenerator.java index 64e42062af..baeef61627 100644 --- a/org.lflang/src/org/lflang/generator/c/CGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CGenerator.java @@ -386,9 +386,9 @@ public CGenerator(LFGeneratorContext context, boolean ccppMode) { this( context, ccppMode, - new CTypes(context.getErrorReporter()), + new CTypes(), new CCmakeGenerator(context.getFileConfig(), List.of()), - new CDelayBodyGenerator(new CTypes(context.getErrorReporter())) + new CDelayBodyGenerator(new CTypes()) ); } @@ -1808,7 +1808,7 @@ private void generateSetDeadline(ReactorInstance instance) { var selfRef = CUtil.reactorRef(reaction.getParent())+"->_lf__reaction_"+reaction.index; if (reaction.declaredDeadline != null) { var deadline = reaction.declaredDeadline.maxDelay; - initializeTriggerObjects.pr(selfRef+".deadline = "+GeneratorBase.timeInTargetLanguage(deadline)+";"); + initializeTriggerObjects.pr(selfRef+".deadline = "+types.getTargetTimeExpr(deadline)+";"); } else { // No deadline. initializeTriggerObjects.pr(selfRef+".deadline = NEVER;"); } diff --git a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java index 23906eae73..584b3e7fb5 100644 --- a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java @@ -1,7 +1,10 @@ package org.lflang.generator.c; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; + +import org.lflang.InferredType; import org.lflang.generator.ParameterInstance; import org.lflang.ASTUtils; import org.lflang.generator.CodeBuilder; @@ -11,6 +14,7 @@ import org.lflang.lf.Parameter; import org.lflang.lf.ParameterReference; import org.lflang.lf.Reactor; +import org.lflang.lf.Type; /** * Generates C code to declare and initialize parameters. @@ -36,35 +40,27 @@ public static String getInitializer(ParameterInstance p) { // In case there is more than one assignment to this parameter, we need to // find the last one. Assignment lastAssignment = null; - for (Assignment assignment: p.getParent().getDefinition().getParameters()) { + for (Assignment assignment : p.getParent().getDefinition().getParameters()) { if (assignment.getLhs() == p.getDefinition()) { lastAssignment = assignment; } } - List list = new LinkedList<>(); + Type paramType = p.getDefinition().getType(); + // Assume that parameter refs belongs to the parent's parent. + // This should have been checked by the validator. + CTypes ctypes = CTypes.generateParametersIn(p.getParent().getParent()); + List list = new ArrayList<>(); if (lastAssignment != null) { // The parameter has an assignment. // Right hand side can be a list. Collect the entries. - for (Expression expr: lastAssignment.getRhs().getExprs()) { - if (expr instanceof ParameterReference) { - // The parameter is being assigned a parameter value. - // Assume that parameter belongs to the parent's parent. - // This should have been checked by the validator. - final var param = ((ParameterReference) expr).getParameter(); - list.add(CUtil.reactorRef(p.getParent().getParent()) + "->" + param.getName()); - } else { - list.add(GeneratorBase.getTargetTime(expr)); - } + for (Expression expr : lastAssignment.getRhs().getExprs()) { + list.add(ctypes.getTargetExpr(expr, InferredType.fromAST(paramType))); } } else { // there was no assignment in the instantiation. So just use the // parameter's initial value. for (Expression expr : p.getParent().initialParameterValue(p.getDefinition())) { - if (ASTUtils.isOfTimeType(p.getDefinition())) { - list.add(GeneratorBase.getTargetTime(expr)); - } else { - list.add(GeneratorBase.getTargetTime(expr)); - } + list.add(CTypes.getInstance().getTargetExpr(expr, ASTUtils.getInferredType(p.getDefinition()))); } } if (list.size() == 1) { diff --git a/org.lflang/src/org/lflang/generator/c/CStateGenerator.java b/org.lflang/src/org/lflang/generator/c/CStateGenerator.java index a0bcf28823..46910f4167 100644 --- a/org.lflang/src/org/lflang/generator/c/CStateGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CStateGenerator.java @@ -3,6 +3,7 @@ import java.util.LinkedList; import org.lflang.ASTUtils; +import org.lflang.InferredType; import org.lflang.generator.CodeBuilder; import org.lflang.generator.GeneratorBase; import org.lflang.generator.ModeInstance; @@ -126,17 +127,7 @@ private static String generateModalReset( * references are replaced with accesses to the self struct of the parent. */ private static String getInitializerExpr(StateVar state, ReactorInstance parent) { - var list = new LinkedList(); - for (Expression expr : state.getInit().getExprs()) { - if (expr instanceof ParameterReference) { - final var param = ((ParameterReference)expr).getParameter(); - list.add(CUtil.reactorRef(parent) + "->" + param.getName()); - } else { - list.add(GeneratorBase.getTargetTime(expr)); - } - } - return list.size() == 1 ? - list.get(0) : - "{" + String.join(", ", list) + "}"; + var ctypes = CTypes.generateParametersIn(parent); + return ctypes.getTargetInitializer(state.getInit(), state.getType()); } } diff --git a/org.lflang/src/org/lflang/generator/c/CTimerGenerator.java b/org.lflang/src/org/lflang/generator/c/CTimerGenerator.java index e0c2000e87..75623fdfe7 100644 --- a/org.lflang/src/org/lflang/generator/c/CTimerGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CTimerGenerator.java @@ -1,7 +1,7 @@ package org.lflang.generator.c; import java.util.List; -import org.lflang.generator.GeneratorBase; + import org.lflang.generator.TimerInstance; /** @@ -18,8 +18,8 @@ public class CTimerGenerator { */ public static String generateInitializer(TimerInstance timer) { var triggerStructName = CUtil.reactorRef(timer.getParent()) + "->_lf__" + timer.getName(); - var offset = GeneratorBase.timeInTargetLanguage(timer.getOffset()); - var period = GeneratorBase.timeInTargetLanguage(timer.getPeriod()); + var offset = CTypes.getInstance().getTargetTimeExpr(timer.getOffset()); + var period = CTypes.getInstance().getTargetTimeExpr(timer.getPeriod()); var mode = timer.getMode(false); var modeRef = mode != null ? "&"+CUtil.reactorRef(mode.getParent())+"->_lf__modes["+mode.getParent().modes.indexOf(mode)+"];" : diff --git a/org.lflang/src/org/lflang/generator/c/CTypes.java b/org.lflang/src/org/lflang/generator/c/CTypes.java index 803d9e8432..ba5b3631a9 100644 --- a/org.lflang/src/org/lflang/generator/c/CTypes.java +++ b/org.lflang/src/org/lflang/generator/c/CTypes.java @@ -1,11 +1,18 @@ package org.lflang.generator.c; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; -import org.lflang.ErrorReporter; import org.lflang.InferredType; +import org.lflang.TimeUnit; +import org.lflang.TimeValue; +import org.lflang.generator.ReactorInstance; import org.lflang.generator.TargetTypes; +import org.lflang.lf.Initializer; +import org.lflang.lf.ParameterReference; +import org.lflang.lf.Type; public class CTypes implements TargetTypes { @@ -13,20 +20,9 @@ public class CTypes implements TargetTypes { // For example, for "foo[10]", the first match will be "foo" and the second "[10]". // For "foo[]", the first match will be "foo" and the second "". static final Pattern arrayPattern = Pattern.compile("^\\s*(?:/\\*.*?\\*/)?\\s*(\\w+)\\s*\\[([0-9]*)]\\s*$"); + private static final CTypes INSTANCE = new CTypes(); - // FIXME: Instead of using the ErrorReporter, perhaps we should be raising assertion errors or - // UnsupportedOperationExceptions or some other non-recoverable errors. - private final ErrorReporter errorReporter; - - /** - * Initializes a {@code CTargetTypes} with the given - * error reporter. - * @param errorReporter The error reporter for any - * errors raised in the code - * generation process. - */ - public CTypes(ErrorReporter errorReporter) { - this.errorReporter = errorReporter; + public CTypes() { } @Override @@ -56,7 +52,7 @@ public String getTargetVariableSizeListType(String baseType) { @Override public String getTargetUndefinedType() { - return String.format("/* %s */", errorReporter.reportError("undefined type")); + return "/*undefined*/"; } /** @@ -78,6 +74,33 @@ public String getTargetType(InferredType type) { return result; } + @Override + public String getTargetParamRef(ParameterReference expr, InferredType typeOrNull) { + throw new UnsupportedOperationException("No context defined"); + } + + @Override + public String getTargetTimeExpr(TimeValue time) { + if (time != null) { + if (time.unit != null) { + return cMacroName(time.unit) + "(" + time.getMagnitude() + ")"; + } else { + return Long.valueOf(time.getMagnitude()).toString(); + } + } + return "0"; // FIXME: do this or throw exception? + } + + @Override + public String getFixedSizeListInitExpression(List contents, int listSize, boolean withBraces) { + return contents.stream().collect(Collectors.joining(", ", "{ ", " }")); + } + + @Override + public String getVariableSizeListInitExpression(List contents, boolean withBraces) { + return contents.stream().collect(Collectors.joining(", ", "{ ", " }")); + } + /** * Return a variable declaration of the form "{@code type name}". * The type is as returned by {@link #getTargetType(InferredType)}, except with @@ -119,4 +142,23 @@ public String getVariableDeclaration( } return declaration; } + + // note that this is moved out by #544 + public static String cMacroName(TimeUnit unit) { + return unit.getCanonicalName().toUpperCase(); + } + + public static CTypes getInstance() { + return INSTANCE; + } + + + public static CTypes generateParametersIn(ReactorInstance instance) { + return new CTypes() { + @Override + public String getTargetParamRef(ParameterReference expr, InferredType typeOrNull) { + return CUtil.reactorRef(instance) + "->" + expr.getParameter().getName(); + } + }; + } } diff --git a/org.lflang/src/org/lflang/generator/python/PyUtil.java b/org.lflang/src/org/lflang/generator/python/PyUtil.java index 78375c910a..9ca2f7222f 100644 --- a/org.lflang/src/org/lflang/generator/python/PyUtil.java +++ b/org.lflang/src/org/lflang/generator/python/PyUtil.java @@ -26,6 +26,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY package org.lflang.generator.python; +import org.lflang.InferredType; import org.lflang.generator.ReactorInstance; import org.lflang.generator.GeneratorBase; import org.lflang.generator.c.CUtil; @@ -143,25 +144,6 @@ public static String generateGILReleaseCode() { * @return A value string in the target language */ protected static String getPythonTargetValue(Expression expr) { - String returnValue; - switch (ASTUtils.toOriginalText(expr)) { - case "false": - returnValue = "False"; - break; - case "true": - returnValue = "True"; - break; - default: - returnValue = GeneratorBase.getTargetValue(expr); - } - - // Parameters in Python are always prepended with a 'self.' - // predicate. Therefore, we need to append the returned value - // if it is a parameter. - if (expr instanceof ParameterReference) { - returnValue = "self." + returnValue; - } - - return returnValue; + return PythonTypes.getInstance().getTargetExpr(expr, InferredType.undefined()); } } diff --git a/org.lflang/src/org/lflang/generator/python/PythonGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonGenerator.java index 46bcc4f811..3f82f20016 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonGenerator.java @@ -96,7 +96,7 @@ public class PythonGenerator extends CGenerator { public PythonGenerator(LFGeneratorContext context) { this(context, - new PythonTypes(context.getErrorReporter()), + new PythonTypes(), new CCmakeGenerator( context.getFileConfig(), List.of("lib/python_action.c", diff --git a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java index 5617350062..23cbe292a5 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java @@ -8,6 +8,7 @@ import com.google.common.base.Objects; import org.lflang.ASTUtils; +import org.lflang.InferredType; import org.lflang.generator.GeneratorBase; import org.lflang.generator.ParameterInstance; import org.lflang.lf.Expression; @@ -126,7 +127,7 @@ public static String generatePythonInitializer(ParameterInstance p) { final var param = ((ParameterReference) expr).getParameter(); list.add(PyUtil.reactorRef(p.getParent().getParent()) + "." + param.getName()); } else { - list.add(GeneratorBase.getTargetTime(expr)); + list.add(PythonTypes.getInstance().getTargetExpr(expr, InferredType.time())); } } } else { diff --git a/org.lflang/src/org/lflang/generator/python/PythonTypes.java b/org.lflang/src/org/lflang/generator/python/PythonTypes.java index c066494047..9ef7a0ac2a 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonTypes.java +++ b/org.lflang/src/org/lflang/generator/python/PythonTypes.java @@ -1,27 +1,18 @@ package org.lflang.generator.python; +import java.util.List; import java.util.regex.Pattern; +import java.util.stream.Collectors; -import org.lflang.ErrorReporter; import org.lflang.InferredType; import org.lflang.generator.c.CTypes; +import org.lflang.lf.ParameterReference; public class PythonTypes extends CTypes { // Regular expression pattern for pointer types. The star at the end has to be visible. static final Pattern pointerPatternVariable = Pattern.compile("^\\s*+(\\w+)\\s*\\*\\s*$"); - - /** - * Initializes a {@code CTargetTypes} with the given - * error reporter. - * - * @param errorReporter The error reporter for any - * errors raised in the code - * generation process. - */ - public PythonTypes(ErrorReporter errorReporter) { - super(errorReporter); - } + private static final PythonTypes INSTANCE = new PythonTypes(); @Override public String getTargetUndefinedType() { @@ -39,16 +30,36 @@ public String getTargetUndefinedType() { public String getPythonType(InferredType type) { var result = super.getTargetType(type); - switch(result){ - case "double": result = "float"; - case "string": result = "object"; - } + result = switch (result) { + case "double" -> "float"; + case "string" -> "object"; + default -> result; + }; var matcher = pointerPatternVariable.matcher(result); - if(matcher.find()) { + if (matcher.find()) { return matcher.group(1); } return result; } + + @Override + public String getTargetParamRef(ParameterReference expr, InferredType typeOrNull) { + return "self." + expr.getParameter().getName(); + } + + @Override + public String getFixedSizeListInitExpression(List contents, int listSize, boolean withBraces) { + return contents.stream().collect(Collectors.joining(", ", "[ ", " ]")); + } + + @Override + public String getVariableSizeListInitExpression(List contents, boolean withBraces) { + return contents.stream().collect(Collectors.joining(", ", "[ ", " ]")); + } + + public static PythonTypes getInstance() { + return INSTANCE; + } } From 437d89efe6f7d0a493881fb0fe55b58002b38069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 2 Mar 2023 15:52:01 +0100 Subject: [PATCH 18/49] Add an expression visitor --- .../synthesis/LinguaFrancaSynthesis.java | 5 +- .../federated/generator/FederateInstance.java | 6 +- .../lflang/generator/LfExpressionVisitor.java | 160 ++++++++++++++++++ .../org/lflang/generator/ReactorInstance.java | 64 +++++-- .../generator/c/CParameterGenerator.java | 36 +--- .../python/PythonParameterGenerator.java | 46 +---- .../lflang/generator/python/PythonTypes.java | 11 ++ 7 files changed, 245 insertions(+), 83 deletions(-) create mode 100644 org.lflang/src/org/lflang/generator/LfExpressionVisitor.java diff --git a/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index cd013d6c57..c06956e72b 100644 --- a/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/org.lflang.diagram/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -1187,12 +1187,11 @@ private String createParameterLabel(ParameterInstance param) { b.append(param.getName()); String t = param.type.toOriginalText(); if (!StringExtensions.isNullOrEmpty(t)) { - b.append(":").append(t); + b.append(": ").append(t); } if (!IterableExtensions.isNullOrEmpty(param.getInitialValue())) { - b.append("("); + b.append(" = "); b.append(IterableExtensions.join(param.getInitialValue(), ", ", ASTUtils::toOriginalText)); - b.append(")"); } return b.toString(); } diff --git a/org.lflang/src/org/lflang/federated/generator/FederateInstance.java b/org.lflang/src/org/lflang/federated/generator/FederateInstance.java index fd309dc4a1..52787de048 100644 --- a/org.lflang/src/org/lflang/federated/generator/FederateInstance.java +++ b/org.lflang/src/org/lflang/federated/generator/FederateInstance.java @@ -71,17 +71,17 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY import com.google.common.base.Objects; -/** +/** * Instance of a federate, or marker that no federation has been defined * (if isSingleton() returns true) FIXME: this comment makes no sense. * Every top-level reactor (contained * directly by the main reactor) is a federate, so there will be one * instance of this class for each top-level reactor. - * + * * @author Edward A. Lee * @author Soroush Bateni */ -public class FederateInstance { +public class FederateInstance { // why does this not extend ReactorInstance? /** * Construct a new instance with the specified instantiation of diff --git a/org.lflang/src/org/lflang/generator/LfExpressionVisitor.java b/org.lflang/src/org/lflang/generator/LfExpressionVisitor.java new file mode 100644 index 0000000000..2bb72789ff --- /dev/null +++ b/org.lflang/src/org/lflang/generator/LfExpressionVisitor.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2023, TU Dresden. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.lflang.generator; + +import org.lflang.lf.BracedListExpression; +import org.lflang.lf.Code; +import org.lflang.lf.CodeExpr; +import org.lflang.lf.Expression; +import org.lflang.lf.LfFactory; +import org.lflang.lf.Literal; +import org.lflang.lf.ParameterReference; +import org.lflang.lf.Time; + +/** + * A visitor for expressions in LF. + * + * @author Clément Fournier <clement.fournier@tu-dresden.de> + */ +public interface LfExpressionVisitor { + + + R visitLiteral(Literal expr, P param); + + R visitBracedListExpr(BracedListExpression expr, P param); + + R visitTimeLiteral(Time expr, P param); + + R visitCodeExpr(CodeExpr expr, P param); + + R visitParameterRef(ParameterReference expr, P param); + + /** + * Dispatch the visitor on the given expression type. + * + * @param e An expression that will be visited + * @param arg Argument for the visitor + * @param visitor Visitor + * @param

Type of parameter expected by the visitor + * @param Return type of the visitor + * @return The return value of the visitor + */ + static R dispatch(Expression e, P arg, LfExpressionVisitor visitor) { + if (e instanceof Literal) { + return visitor.visitLiteral((Literal) e, arg); + } else if (e instanceof BracedListExpression) { + return visitor.visitBracedListExpr((BracedListExpression) e, arg); + } else if (e instanceof Time) { + return visitor.visitTimeLiteral((Time) e, arg); + } else if (e instanceof CodeExpr) { + return visitor.visitCodeExpr((CodeExpr) e, arg); + } else if (e instanceof ParameterReference) { + return visitor.visitParameterRef((ParameterReference) e, arg); + } + + throw new IllegalArgumentException("Expression of type " + e.getClass() + " not handled"); + } + + /** Base visitor class where methods are defaulted to a common one. */ + abstract class DefaultLfVisitor implements LfExpressionVisitor { + + abstract R visitExpression(Expression expr, P param); + + @Override + public R visitLiteral(Literal expr, P param) { + return visitExpression(expr, param); + } + + @Override + public R visitBracedListExpr(BracedListExpression expr, P param) { + return visitExpression(expr, param); + } + + @Override + public R visitTimeLiteral(Time expr, P param) { + return visitExpression(expr, param); + } + + @Override + public R visitCodeExpr(CodeExpr expr, P param) { + return visitExpression(expr, param); + } + + @Override + public R visitParameterRef(ParameterReference expr, P param) { + return visitExpression(expr, param); + } + } + + /** + * A visitor that deep copies the expression. Can be extended + * to replace certain expressions during the copy. + * + * @param

Parameter type + */ + class LfExpressionDeepCopyVisitor

implements LfExpressionVisitor { + + @Override + public Expression visitLiteral(Literal expr, P param) { + Literal clone = LfFactory.eINSTANCE.createLiteral(); + clone.setLiteral(expr.getLiteral()); + return clone; + } + + @Override + public Expression visitBracedListExpr(BracedListExpression expr, P param) { + BracedListExpression clone = LfFactory.eINSTANCE.createBracedListExpression(); + for (Expression item : expr.getItems()) { + clone.getItems().add(dispatch(item, param, this)); + } + return clone; + } + + @Override + public Expression visitTimeLiteral(Time expr, P param) { + Time clone = LfFactory.eINSTANCE.createTime(); + clone.setUnit(expr.getUnit()); + clone.setInterval(expr.getInterval()); + return clone; + } + + @Override + public Expression visitParameterRef(ParameterReference expr, P param) { + ParameterReference clone = LfFactory.eINSTANCE.createParameterReference(); + clone.setParameter(expr.getParameter()); + return clone; + } + + @Override + public Expression visitCodeExpr(CodeExpr expr, P param) { + CodeExpr codeExpr = LfFactory.eINSTANCE.createCodeExpr(); + Code code = LfFactory.eINSTANCE.createCode(); + code.setBody(expr.getCode().getBody()); + codeExpr.setCode(code); + return codeExpr; + } + } + +} diff --git a/org.lflang/src/org/lflang/generator/ReactorInstance.java b/org.lflang/src/org/lflang/generator/ReactorInstance.java index 305ef420c4..88971e72c2 100644 --- a/org.lflang/src/org/lflang/generator/ReactorInstance.java +++ b/org.lflang/src/org/lflang/generator/ReactorInstance.java @@ -26,6 +26,9 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY package org.lflang.generator; +import static org.lflang.ASTUtils.belongsTo; +import static org.lflang.ASTUtils.getLiteralTimeValue; + import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -33,6 +36,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -43,10 +47,12 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY import org.lflang.TimeValue; import org.lflang.generator.TriggerInstance.BuiltinTriggerVariable; import org.lflang.lf.Action; +import org.lflang.lf.Assignment; import org.lflang.lf.BuiltinTrigger; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.Connection; import org.lflang.lf.Expression; +import org.lflang.lf.Initializer; import org.lflang.lf.Input; import org.lflang.lf.Instantiation; import org.lflang.lf.LfFactory; @@ -460,17 +466,61 @@ public Integer initialIntParameterValue(Parameter parameter) { * values can be lists of elements, so the returned value is a list. * * @param parameter The parameter definition (a syntactic object in the AST). - * + * * @return A list of Value objects, or null if the parameter is not found. * Return an empty list if no initial value is given. * Each value is an instance of Literal if a literal value is given, * a Time if a time value was given, or a Code, if a code value was * given (text in the target language delimited by {= ... =} */ - public List initialParameterValue(Parameter parameter) { + List initialParameterValue(Parameter parameter) { return ASTUtils.initialValue(parameter, instantiations()); } + public Expression resolveParameters(Expression e) { + return LfExpressionVisitor.dispatch(e, this, ParameterInliner.INSTANCE); + } + + + private static final class ParameterInliner extends LfExpressionVisitor.LfExpressionDeepCopyVisitor { + static final ParameterInliner INSTANCE = new ParameterInliner(); + + @Override + public Expression visitParameterRef(ParameterReference expr, ReactorInstance instance) { + if (!ASTUtils.belongsTo(expr.getParameter(), instance.definition)) { + throw new IllegalArgumentException("Parameter " + + expr.getParameter().getName() + + " is not a parameter of reactor instance " + + instance.getName() + + "." + ); + } + + Optional assignment = + instance.definition.getParameters().stream() + .filter(it -> it.getLhs().equals(expr.getParameter())) + .findAny(); // There is at most one + + if (assignment.isPresent()) { + // replace the parameter with its value. + Expression value = ASTUtils.asSingleExpr(assignment.get().getRhs()); + // recursively resolve parameters + return instance.getParent().resolveParameters(value); + } else { + // In that case use the default value. Default values + // cannot use parameter values, so they don't need to + // be recursively resolved. + Initializer init = expr.getParameter().getInit(); + Expression defaultValue = ASTUtils.asSingleExpr(init); + if (defaultValue == null) { + // this is a problem + return super.visitParameterRef(expr, instance); + } + return defaultValue; + } + } + } + /** * Return a list of Instantiation objects for evaluating parameter * values. The first object in the list is the AST Instantiation @@ -681,14 +731,8 @@ public String toString() { * precise time value assigned to this reactor instance. */ public TimeValue getTimeValue(Expression expr) { - if (expr instanceof ParameterReference) { - final var param = ((ParameterReference)expr).getParameter(); - // Avoid a runtime error in validator for invalid programs. - if (lookupParameterInstance(param).getInitialValue().isEmpty()) return null; - return ASTUtils.getLiteralTimeValue(lookupParameterInstance(param).getInitialValue().get(0)); - } else { - return ASTUtils.getLiteralTimeValue(expr); - } + Expression resolved = resolveParameters(expr); + return getLiteralTimeValue(resolved); } ////////////////////////////////////////////////////// diff --git a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java index 584b3e7fb5..fb60908e5a 100644 --- a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import java.util.stream.Collectors; import org.lflang.InferredType; import org.lflang.generator.ParameterInstance; @@ -36,37 +37,14 @@ public static String getInitializer(ParameterInstance p) { return CUtil.bankIndex(p.getParent()); } - // Handle overrides in the intantiation. - // In case there is more than one assignment to this parameter, we need to - // find the last one. - Assignment lastAssignment = null; - for (Assignment assignment : p.getParent().getDefinition().getParameters()) { - if (assignment.getLhs() == p.getDefinition()) { - lastAssignment = assignment; - } - } - Type paramType = p.getDefinition().getType(); - // Assume that parameter refs belongs to the parent's parent. - // This should have been checked by the validator. CTypes ctypes = CTypes.generateParametersIn(p.getParent().getParent()); - List list = new ArrayList<>(); - if (lastAssignment != null) { - // The parameter has an assignment. - // Right hand side can be a list. Collect the entries. - for (Expression expr : lastAssignment.getRhs().getExprs()) { - list.add(ctypes.getTargetExpr(expr, InferredType.fromAST(paramType))); - } - } else { - // there was no assignment in the instantiation. So just use the - // parameter's initial value. - for (Expression expr : p.getParent().initialParameterValue(p.getDefinition())) { - list.add(CTypes.getInstance().getTargetExpr(expr, ASTUtils.getInferredType(p.getDefinition()))); - } - } - if (list.size() == 1) { - return list.get(0); + List values = p.getInitialValue(); + InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); + if (values.size() == 1) { + return ctypes.getTargetExpr(values.get(0), paramType); } else { - return "{" + String.join(", ", list) + "}"; + return values.stream().map(it -> ctypes.getTargetExpr(it, paramType.getComponentType())) + .collect(Collectors.joining(", ", "{ ", "}")); } } diff --git a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java index 23cbe292a5..c6d837685f 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java @@ -96,8 +96,7 @@ private static List getAllParameters(ReactorDecl decl) { * @return Initialization code */ private static String generatePythonInitializer(Parameter p) { - List values = p.getInit().getExprs().stream().map(PyUtil::getPythonTargetValue).toList(); - return values.size() > 1 ? "(" + String.join(", ", values) + ")" : values.get(0); + return PythonTypes.getInstance().getTargetInitializer(p.getInit(), p.getType()); } /** @@ -114,44 +113,15 @@ public static String generatePythonInitializer(ParameterInstance p) { // Handle overrides in the instantiation. // In case there is more than one assignment to this parameter, we need to // find the last one. - Assignment lastAssignment = getLastAssignment(p); - List list = new LinkedList<>(); - if (lastAssignment != null) { - // The parameter has an assignment. - // Right hand side can be a list. Collect the entries. - for (Expression expr : lastAssignment.getRhs().getExprs()) { - if (expr instanceof ParameterReference) { - // The parameter is being assigned a parameter value. - // Assume that parameter belongs to the parent's parent. - // This should have been checked by the validator. - final var param = ((ParameterReference) expr).getParameter(); - list.add(PyUtil.reactorRef(p.getParent().getParent()) + "." + param.getName()); - } else { - list.add(PythonTypes.getInstance().getTargetExpr(expr, InferredType.time())); - } - } + PythonTypes pyTypes = PythonTypes.generateParametersIn(p.getParent().getParent()); + List values = p.getInitialValue(); + InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); + if (values.size() == 1) { + return pyTypes.getTargetExpr(values.get(0), paramType); } else { - for (Expression expr : p.getParent().initialParameterValue(p.getDefinition())) { - list.add(PyUtil.getPythonTargetValue(expr)); - } + return values.stream().map(it -> pyTypes.getTargetExpr(it, paramType.getComponentType())) + .collect(Collectors.joining(", ", "( ", ")")); } - return list.size() > 1 ? "(" + String.join(", ", list) + ")" : list.get(0); } - /** - * Returns the last assignment to "p" if there is one, - * or null if there is no assignment to "p" - * - * @param p The parameter instance to create initializer for - * @return The last assignment of the parameter instance - */ - private static Assignment getLastAssignment(ParameterInstance p) { - Assignment lastAssignment = null; - for (Assignment assignment : p.getParent().getDefinition().getParameters()) { - if (Objects.equal(assignment.getLhs(), p.getDefinition())) { - lastAssignment = assignment; - } - } - return lastAssignment; - } } diff --git a/org.lflang/src/org/lflang/generator/python/PythonTypes.java b/org.lflang/src/org/lflang/generator/python/PythonTypes.java index 9ef7a0ac2a..706078d6f4 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonTypes.java +++ b/org.lflang/src/org/lflang/generator/python/PythonTypes.java @@ -5,7 +5,9 @@ import java.util.stream.Collectors; import org.lflang.InferredType; +import org.lflang.generator.ReactorInstance; import org.lflang.generator.c.CTypes; +import org.lflang.generator.c.CUtil; import org.lflang.lf.ParameterReference; public class PythonTypes extends CTypes { @@ -62,4 +64,13 @@ public String getVariableSizeListInitExpression(List contents, boolean w public static PythonTypes getInstance() { return INSTANCE; } + + public static PythonTypes generateParametersIn(ReactorInstance instance) { + return new PythonTypes() { + @Override + public String getTargetParamRef(ParameterReference expr, InferredType typeOrNull) { + return CUtil.reactorRef(instance) + "." + expr.getParameter().getName(); + } + }; + } } From 1be165151c0b5af2ef4657a72689dcf0f99588cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 2 Mar 2023 16:27:39 +0100 Subject: [PATCH 19/49] Fix build --- .../src/org/lflang/tests/compiler/LetInferenceTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.lflang.tests/src/org/lflang/tests/compiler/LetInferenceTests.java b/org.lflang.tests/src/org/lflang/tests/compiler/LetInferenceTests.java index 60cfa39725..243e5ea47b 100644 --- a/org.lflang.tests/src/org/lflang/tests/compiler/LetInferenceTests.java +++ b/org.lflang.tests/src/org/lflang/tests/compiler/LetInferenceTests.java @@ -101,7 +101,7 @@ public void testLet() throws Exception { )); Assertions.assertNotNull(model); - final var ctypes = new CTypes(new DefaultErrorReporter()); + final var ctypes = CTypes.getInstance(); final var resource = model.eResource(); final var transformation = new DelayedConnectionTransformation(new CDelayBodyGenerator(ctypes), ctypes, resource, true, true); transformation.applyTransformation(ASTUtils.getAllReactors(resource)); From 5909324be43857b489a9bb5f99e65e258bd2acca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 10 Mar 2023 14:31:33 +0100 Subject: [PATCH 20/49] Better error message for RoundTripTests --- .../src/org/lflang/tests/compiler/RoundTripTests.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.lflang.tests/src/org/lflang/tests/compiler/RoundTripTests.java b/org.lflang.tests/src/org/lflang/tests/compiler/RoundTripTests.java index d1ea81e5be..24cb3554ff 100644 --- a/org.lflang.tests/src/org/lflang/tests/compiler/RoundTripTests.java +++ b/org.lflang.tests/src/org/lflang/tests/compiler/RoundTripTests.java @@ -3,6 +3,7 @@ import static java.util.Collections.emptyList; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.fail; import java.nio.file.Files; import java.nio.file.Path; @@ -28,11 +29,15 @@ public class RoundTripTests { @Test - public void roundTripTest() throws Exception { + public void roundTripTest() { for (Target target : Target.values()) { for (TestCategory category : TestCategory.values()) { for (LFTest test : TestRegistry.getRegisteredTests(target, category, false)) { - run(test.getSrcPath()); + try { + run(test.getSrcPath()); + } catch (Throwable thrown) { + fail("Test case " + test.getSrcPath() + " failed", thrown); + } } } } From e3b9622d9965ca3bedc90a61978e3d0a0fa2bbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Fri, 10 Mar 2023 14:47:17 +0100 Subject: [PATCH 21/49] Make LFF ignore errors --- org.lflang/src/org/lflang/cli/Lff.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/org.lflang/src/org/lflang/cli/Lff.java b/org.lflang/src/org/lflang/cli/Lff.java index 26e48ea0ae..1efc207128 100644 --- a/org.lflang/src/org/lflang/cli/Lff.java +++ b/org.lflang/src/org/lflang/cli/Lff.java @@ -51,7 +51,7 @@ public class Lff extends CliBase { @Option( names = "--no-recurse", description = "Do not format files in subdirectories of the" - + " specified paths.") + + " specified paths.") private boolean noRecurse = false; @Option( @@ -59,6 +59,11 @@ public class Lff extends CliBase { description = "Print more details on files affected.") private boolean verbose = false; + @Option( + names = {"--ignore-errors"}, + description = "Ignore validation errors in files and format them anyway.") + private boolean ignoreErrors = false; + /** * Main function of the formatter. * Caution: this will invoke System.exit. @@ -151,8 +156,9 @@ private void formatSingleFile(Path path, Path inputRoot, Path outputRoot) { } validateResource(resource); - // todo don't abort whole run if one file has errors - exitIfCollectedErrors(); + if (!ignoreErrors) { + exitIfCollectedErrors(); + } final String formattedFileContents = FormattingUtils.render(resource.getContents().get(0), lineLength); @@ -175,7 +181,9 @@ private void formatSingleFile(Path path, Path inputRoot, Path outputRoot) { } } - exitIfCollectedErrors(); + if (!ignoreErrors) { + exitIfCollectedErrors(); + } // Only errors are printed. Warnings are not helpful for LFF // and since they don't prevent the file from being formatted, // the position of the issue may be wrong in the formatted file. From fbed6539e970e4c324a62cb3ce1dcd87d271ee8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 13 Mar 2023 13:25:21 +0100 Subject: [PATCH 22/49] Change formatter --- org.lflang/src/org/lflang/ast/ToLf.java | 2 +- test/C/src/ArrayAsParameter.lf | 4 ++-- test/C/src/MovingAverage.lf | 4 ++-- test/C/src/NativeListsAndTimes.lf | 10 +++++----- test/C/src/StructAsState.lf | 2 +- test/C/src/concurrent/ScheduleAt.lf | 2 +- test/C/src/lib/Test.lf | 2 +- test/Cpp/src/ArrayAsParameter.lf | 2 +- test/Cpp/src/target/BraceAndParenInitialization.lf | 5 +---- 9 files changed, 15 insertions(+), 18 deletions(-) diff --git a/org.lflang/src/org/lflang/ast/ToLf.java b/org.lflang/src/org/lflang/ast/ToLf.java index 571fbc4227..20353141f5 100644 --- a/org.lflang/src/org/lflang/ast/ToLf.java +++ b/org.lflang/src/org/lflang/ast/ToLf.java @@ -777,7 +777,7 @@ public MalleableString caseBracedListExpression(BracedListExpression object) { } // Note that this strips the trailing comma. There is no way // to implement trailing commas with the current set of list() methods AFAIU. - return list(", ", "{ ", " }", false, false, object.getItems()); + return list(", ", "{", "}", false, false, object.getItems()); } @Override diff --git a/test/C/src/ArrayAsParameter.lf b/test/C/src/ArrayAsParameter.lf index 42a9093eae..a9df29cb03 100644 --- a/test/C/src/ArrayAsParameter.lf +++ b/test/C/src/ArrayAsParameter.lf @@ -3,7 +3,7 @@ // encode their own length. target C -reactor Source(sequence: int[] = { 0, 1, 2 }, n_sequence: int = 3) { +reactor Source(sequence: int[] = {0, 1, 2}, n_sequence: int = 3) { output out: int state count: int = 0 logical action next @@ -41,7 +41,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence = { 1, 2, 3, 4 }, n_sequence = 4) + s = new Source(sequence = {1, 2, 3, 4}, n_sequence = 4) p = new Print() s.out -> p.in } diff --git a/test/C/src/MovingAverage.lf b/test/C/src/MovingAverage.lf index d72c5b132d..a8309aa9d3 100644 --- a/test/C/src/MovingAverage.lf +++ b/test/C/src/MovingAverage.lf @@ -20,7 +20,7 @@ reactor MASource { } reactor MovingAverageImpl { - state delay_line: double[] = { 0.0, 0.0, 0.0 } + state delay_line: double[] = {0.0, 0.0, 0.0} state index: int = 0 input in: double output out: double @@ -47,7 +47,7 @@ reactor MovingAverageImpl { main reactor MovingAverage { s = new MASource() m = new MovingAverageImpl() - p = new TestDouble(expected = { 0.0, 0.25, 0.75, 1.5, 2.5, 3.5 }) + p = new TestDouble(expected = {0.0, 0.25, 0.75, 1.5, 2.5, 3.5}) s.out -> m.in m.out -> p.in } diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index 9a448d79ef..f33b057b6e 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -3,11 +3,11 @@ target C // This test passes if it is successfully compiled into valid target code. main reactor( x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[] = { 1, 2, 3, 4, }, // List of integers - q: interval_t[] = { 1 msec, 2 msec, 3 msec, }, // list of time values - g: time[] = { 1 msec, 2 msec, } // List of time values + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[] = {1, 2, 3, 4}, // List of integers + q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values + g: time[] = {1 msec, 2 msec} // List of time values ) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter diff --git a/test/C/src/StructAsState.lf b/test/C/src/StructAsState.lf index 62e04110b0..59ae495853 100644 --- a/test/C/src/StructAsState.lf +++ b/test/C/src/StructAsState.lf @@ -10,7 +10,7 @@ main reactor StructAsState { } hello_t; =} // Notice that target code delimiters are no longer necessary. - state s: hello_t = { "Earth", 42 } + state s: hello_t = {"Earth", 42} reaction(startup) {= printf("State s.name=\"%s\", value=%d.\n", self->s.name, self->s.value); diff --git a/test/C/src/concurrent/ScheduleAt.lf b/test/C/src/concurrent/ScheduleAt.lf index cfb80dbe41..e68b3956e8 100644 --- a/test/C/src/concurrent/ScheduleAt.lf +++ b/test/C/src/concurrent/ScheduleAt.lf @@ -50,7 +50,7 @@ reactor Scheduler { 900 msec } // Size = 9 - state action_hit_list_microstep: int[] = { 1, 2, 0, 1, 0, 2, 3, 4, 5 } + state action_hit_list_microstep: int[] = {1, 2, 0, 1, 0, 2, 3, 4, 5} state action_hit_list_times: int[] = { 0, 0, diff --git a/test/C/src/lib/Test.lf b/test/C/src/lib/Test.lf index 8bcbab2ad8..3ad7518d4e 100644 --- a/test/C/src/lib/Test.lf +++ b/test/C/src/lib/Test.lf @@ -1,6 +1,6 @@ target C -reactor TestDouble(expected: double[] = { 1.0, 1.0, 1.0, 1.0 }) { +reactor TestDouble(expected: double[] = {1.0, 1.0, 1.0, 1.0}) { input in: double state count: int = 0 diff --git a/test/Cpp/src/ArrayAsParameter.lf b/test/Cpp/src/ArrayAsParameter.lf index a96cdd4855..85cd0630bf 100644 --- a/test/Cpp/src/ArrayAsParameter.lf +++ b/test/Cpp/src/ArrayAsParameter.lf @@ -38,7 +38,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence = {1, 2, 3, 4} ) + s = new Source(sequence = {1, 2, 3, 4}) p = new Print() s.out -> p.in } diff --git a/test/Cpp/src/target/BraceAndParenInitialization.lf b/test/Cpp/src/target/BraceAndParenInitialization.lf index 8c68f88a7d..003b6d509d 100644 --- a/test/Cpp/src/target/BraceAndParenInitialization.lf +++ b/test/Cpp/src/target/BraceAndParenInitialization.lf @@ -26,8 +26,5 @@ reactor Foo( } main reactor { - foo = new Foo( - param_list_3 = {= std::vector(3, 5) =}, - param_list_4 = {3, 5} - ) + foo = new Foo(param_list_3 = {= std::vector(3, 5) =}, param_list_4 = {3, 5}) } From 294c3d0cfdc86eeee3fd44afb50b6cfc6bf41535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 13 Mar 2023 13:27:56 +0100 Subject: [PATCH 23/49] Doc --- org.lflang/src/org/lflang/ast/ToLf.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.lflang/src/org/lflang/ast/ToLf.java b/org.lflang/src/org/lflang/ast/ToLf.java index 20353141f5..82c15b5d53 100644 --- a/org.lflang/src/org/lflang/ast/ToLf.java +++ b/org.lflang/src/org/lflang/ast/ToLf.java @@ -843,6 +843,11 @@ public MalleableString caseInitializer(Initializer object) { return initializer(object, false); } + /** + * Return true if the initializer should be output with an equals initializer. + * Old-style assignments with parentheses are also output that + * way to help with the transition. + */ private boolean shouldOutputAsAssignment(Initializer init) { return init.isAssign() || init.getExprs().size() == 1 && ASTUtils.getTarget(init).mandatesEqualsInitializers(); From 0e4ccf4126cb64cfccd0d2892f903ff960b9dab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 13 Mar 2023 14:18:09 +0100 Subject: [PATCH 24/49] Fix NPE --- org.lflang/src/org/lflang/generator/TargetTypes.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/TargetTypes.java b/org.lflang/src/org/lflang/generator/TargetTypes.java index 0750d28766..f92da32280 100644 --- a/org.lflang/src/org/lflang/generator/TargetTypes.java +++ b/org.lflang/src/org/lflang/generator/TargetTypes.java @@ -71,7 +71,8 @@ default String getTargetParamRef(ParameterReference expr, InferredType typeOrNul /** Translate the braced list expression into target language syntax. */ default String getTargetBracedListExpr(BracedListExpression expr, InferredType typeOrNull) { - return expr.getItems().stream().map(e -> getTargetExpr(e, typeOrNull.getComponentType())) + InferredType t = typeOrNull == null ? InferredType.undefined() : typeOrNull; + return expr.getItems().stream().map(e -> getTargetExpr(e, t)) .collect(Collectors.joining(",", "{", "}")); } From d20706aa0f58ccb642349a193c63f190f605094b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 13 Mar 2023 16:04:52 +0100 Subject: [PATCH 25/49] Fix python using C boolean literals --- test/Python/src/DeadlineHandledAbove.lf | 2 +- test/Python/src/DelayInt.lf | 2 +- test/Python/src/ImportComposition.lf | 2 +- test/Python/src/concurrent/AsyncCallback.lf | 2 +- test/Python/src/concurrent/AsyncCallbackNoTimer.lf | 2 +- test/Python/src/docker/FilesPropertyContainerized.lf | 2 +- test/Python/src/federated/HelloDistributed.lf | 2 +- test/Python/src/multiport/BankIndexInitializer.lf | 2 +- test/Python/src/multiport/BankReactionsInContainer.lf | 4 ++-- test/Python/src/multiport/BankToMultiport.lf | 2 +- test/Python/src/multiport/Broadcast.lf | 2 +- test/Python/src/multiport/BroadcastMultipleAfter.lf | 2 +- test/Python/src/multiport/MultiportToBankAfter.lf | 2 +- test/Python/src/multiport/MultiportToBankHierarchy.lf | 2 +- test/Python/src/multiport/MultiportToPort.lf | 2 +- test/Python/src/multiport/ReactionsToNested.lf | 2 +- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/Python/src/DeadlineHandledAbove.lf b/test/Python/src/DeadlineHandledAbove.lf index ef8510ee67..1259253cea 100644 --- a/test/Python/src/DeadlineHandledAbove.lf +++ b/test/Python/src/DeadlineHandledAbove.lf @@ -18,7 +18,7 @@ reactor Deadline(threshold = 100 msec) { } main reactor DeadlineHandledAbove { - state violation_detected = false + state violation_detected = False d = new Deadline(threshold = 10 msec) reaction(startup) -> d.x {= diff --git a/test/Python/src/DelayInt.lf b/test/Python/src/DelayInt.lf index 8348306c41..fae554bd30 100644 --- a/test/Python/src/DelayInt.lf +++ b/test/Python/src/DelayInt.lf @@ -17,7 +17,7 @@ reactor Delay(delay = 100 msec) { reactor Test { input _in state start_time = 0 - state received_value = false + state received_value = False reaction(startup) {= # Record the logical time at the start. diff --git a/test/Python/src/ImportComposition.lf b/test/Python/src/ImportComposition.lf index bf3a92eb06..369fbcab44 100644 --- a/test/Python/src/ImportComposition.lf +++ b/test/Python/src/ImportComposition.lf @@ -6,7 +6,7 @@ import ImportedComposition from "lib/ImportedComposition.lf" main reactor ImportComposition { a = new ImportedComposition() - state received = false + state received = False reaction(startup) -> a.x {= a.x.set(42) =} diff --git a/test/Python/src/concurrent/AsyncCallback.lf b/test/Python/src/concurrent/AsyncCallback.lf index ef25cffdad..5ef4167bed 100644 --- a/test/Python/src/concurrent/AsyncCallback.lf +++ b/test/Python/src/concurrent/AsyncCallback.lf @@ -32,7 +32,7 @@ main reactor AsyncCallback { timer t(0, 200 msec) state threads = {= list() =} state expected_time = 100 msec - state toggle = false + state toggle = False physical action a(100 msec) state i = 0 diff --git a/test/Python/src/concurrent/AsyncCallbackNoTimer.lf b/test/Python/src/concurrent/AsyncCallbackNoTimer.lf index 2d585ea5b4..4e481d1d34 100644 --- a/test/Python/src/concurrent/AsyncCallbackNoTimer.lf +++ b/test/Python/src/concurrent/AsyncCallbackNoTimer.lf @@ -36,7 +36,7 @@ main reactor { state threads = {= list() =} state expected_time = 100 msec - state toggle = false + state toggle = False physical action a(100 msec) state i = 0 diff --git a/test/Python/src/docker/FilesPropertyContainerized.lf b/test/Python/src/docker/FilesPropertyContainerized.lf index 0e5c0091d2..c34736af48 100644 --- a/test/Python/src/docker/FilesPropertyContainerized.lf +++ b/test/Python/src/docker/FilesPropertyContainerized.lf @@ -17,7 +17,7 @@ main reactor { except: lf_request_stop() =} - state passed = false + state passed = False timer t(1 msec) reaction(t) {= self.passed = True =} diff --git a/test/Python/src/federated/HelloDistributed.lf b/test/Python/src/federated/HelloDistributed.lf index f9cd039d37..ef99c3f793 100644 --- a/test/Python/src/federated/HelloDistributed.lf +++ b/test/Python/src/federated/HelloDistributed.lf @@ -19,7 +19,7 @@ reactor Source { reactor Destination { input _in - state received = false + state received = False reaction(startup) {= print("Destination started.") =} diff --git a/test/Python/src/multiport/BankIndexInitializer.lf b/test/Python/src/multiport/BankIndexInitializer.lf index 9ed1d1cc19..52ef58bb1d 100644 --- a/test/Python/src/multiport/BankIndexInitializer.lf +++ b/test/Python/src/multiport/BankIndexInitializer.lf @@ -11,7 +11,7 @@ reactor Source(bank_index = 0, value = 0) { reactor Sink(width = 4) { input[width] _in - state received = false + state received = False reaction(_in) {= for (idx, port) in enumerate(_in): diff --git a/test/Python/src/multiport/BankReactionsInContainer.lf b/test/Python/src/multiport/BankReactionsInContainer.lf index 9a2837c08d..7316463c3d 100644 --- a/test/Python/src/multiport/BankReactionsInContainer.lf +++ b/test/Python/src/multiport/BankReactionsInContainer.lf @@ -8,7 +8,7 @@ target Python { reactor R(bank_index = 0) { output[2] out input[2] inp - state received = false + state received = False reaction(startup) -> out {= for (i, p) in enumerate(out): @@ -37,7 +37,7 @@ reactor R(bank_index = 0) { main reactor { s = new[2] R() - state received = false + state received = False reaction(startup) -> s.inp {= count = 0 diff --git a/test/Python/src/multiport/BankToMultiport.lf b/test/Python/src/multiport/BankToMultiport.lf index bddd217eec..769e0ea2fc 100644 --- a/test/Python/src/multiport/BankToMultiport.lf +++ b/test/Python/src/multiport/BankToMultiport.lf @@ -9,7 +9,7 @@ reactor Source(bank_index = 0) { reactor Sink(width = 4) { input[width] _in - state received = false + state received = False reaction(_in) {= for (idx, port) in enumerate(_in): diff --git a/test/Python/src/multiport/Broadcast.lf b/test/Python/src/multiport/Broadcast.lf index eb39885483..2e507d607f 100644 --- a/test/Python/src/multiport/Broadcast.lf +++ b/test/Python/src/multiport/Broadcast.lf @@ -11,7 +11,7 @@ reactor Source(value = 42) { reactor Destination(bank_index = 0, delay = 0) { input _in - state received = false + state received = False reaction(_in) {= print(f"Destination {self.bank_index} received {_in.value}.") diff --git a/test/Python/src/multiport/BroadcastMultipleAfter.lf b/test/Python/src/multiport/BroadcastMultipleAfter.lf index 003ebf276f..9fc327e6fd 100644 --- a/test/Python/src/multiport/BroadcastMultipleAfter.lf +++ b/test/Python/src/multiport/BroadcastMultipleAfter.lf @@ -7,7 +7,7 @@ import Source from "Broadcast.lf" reactor Destination(bank_index = 0, delay = 0) { input _in - state received = false + state received = False reaction(_in) {= print(f"Destination {self.bank_index} received {_in.value}.") diff --git a/test/Python/src/multiport/MultiportToBankAfter.lf b/test/Python/src/multiport/MultiportToBankAfter.lf index 13259e8811..85fc91e513 100644 --- a/test/Python/src/multiport/MultiportToBankAfter.lf +++ b/test/Python/src/multiport/MultiportToBankAfter.lf @@ -9,7 +9,7 @@ import Source from "MultiportToBank.lf" reactor Destination(bank_index = 0) { input _in - state received = false + state received = False reaction(_in) {= print("Destination {:d} received {:d}.".format(self.bank_index, _in.value)) diff --git a/test/Python/src/multiport/MultiportToBankHierarchy.lf b/test/Python/src/multiport/MultiportToBankHierarchy.lf index 2ec2313288..f70fa8ad92 100644 --- a/test/Python/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Python/src/multiport/MultiportToBankHierarchy.lf @@ -9,7 +9,7 @@ import Source from "MultiportToBank.lf" reactor Destination(bank_index = 0) { input _in - state received = false + state received = False reaction(_in) {= print("Destination {:d} received {:d}.\n".format(self.bank_index, _in.value)) diff --git a/test/Python/src/multiport/MultiportToPort.lf b/test/Python/src/multiport/MultiportToPort.lf index 6ec88187e1..ebfbf81991 100644 --- a/test/Python/src/multiport/MultiportToPort.lf +++ b/test/Python/src/multiport/MultiportToPort.lf @@ -17,7 +17,7 @@ reactor Source { reactor Destination(expected = 0) { input _in - state received = false + state received = False reaction(_in) {= print("Received: ", _in.value) diff --git a/test/Python/src/multiport/ReactionsToNested.lf b/test/Python/src/multiport/ReactionsToNested.lf index 2077483b4e..2c207dffb0 100644 --- a/test/Python/src/multiport/ReactionsToNested.lf +++ b/test/Python/src/multiport/ReactionsToNested.lf @@ -6,7 +6,7 @@ target Python { reactor T(expected = 0) { input z - state received = false + state received = False reaction(z) {= print(f"T received {z.value}.") From 6a56de75c4033cad3a297ab8557be3368d0cee33 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 13:11:38 +0100 Subject: [PATCH 26/49] enable move construction of the parameter struct --- .../org/lflang/generator/cpp/CppParameterGenerator.kt | 9 +++++---- .../src/org/lflang/generator/cpp/CppReactorGenerator.kt | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt b/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt index b5664538d7..3c2224e031 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppParameterGenerator.kt @@ -46,7 +46,7 @@ class CppParameterGenerator(private val reactor: Reactor) { with(it) { """ using $typeAlias = $targetType; - const $typeAlias $name${ + $typeAlias $name${ if (init == null) "" else CppTypes.getCppInitializer( init, inferredType, @@ -57,10 +57,11 @@ class CppParameterGenerator(private val reactor: Reactor) { } } - /** Generate using declarations for each parameter for use in the inner reactor class. - * This is required for C++ to bring templated parameters into scope. + /** Generate alias declarations for each parameter for use in the inner reactor class. + * This is required to bring parameters into scope. */ - fun generateUsingDeclarations() = reactor.parameters.joinToString(separator = "") { "using Parameters::${it.name};\n" } + fun generateInnerAliasDeclarations() = + reactor.parameters.joinToString(separator = "") { "const typename Parameters::${it.typeAlias}& ${it.name} = __lf_parameters.${it.name};\n" } /** Generate alias declarations for each parameter for use in the outer reactor class. * This is required for some code bodies (e.g. target code in parameter initializers) to have access to the local parameters. diff --git a/org.lflang/src/org/lflang/generator/cpp/CppReactorGenerator.kt b/org.lflang/src/org/lflang/generator/cpp/CppReactorGenerator.kt index de8deb7a4f..50fff0bdb5 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppReactorGenerator.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppReactorGenerator.kt @@ -94,8 +94,9 @@ class CppReactorGenerator(private val reactor: Reactor, fileConfig: CppFileConfi | private: ${" | "..reactions.generateReactionViewForwardDeclarations()} | - | class Inner: public lfutil::LFScope, public Parameters { - ${" | "..parameters.generateUsingDeclarations()} + | class Inner: public lfutil::LFScope { + | const Parameters __lf_parameters; + ${" | "..parameters.generateInnerAliasDeclarations()} ${" | "..state.generateDeclarations()} ${" | "..methods.generateDeclarations()} ${" | "..reactions.generateBodyDeclarations()} @@ -161,9 +162,9 @@ class CppReactorGenerator(private val reactor: Reactor, fileConfig: CppFileConfi return with(PrependOperator) { """ |${reactor.templateLine} - |${reactor.templateName}::Inner::Inner(::reactor::Reactor* reactor, Parameters&& __lf_parameters) + |${reactor.templateName}::Inner::Inner(::reactor::Reactor* reactor, Parameters&& parameters) | : LFScope(reactor) - ${" | , Parameters(std::forward(__lf_parameters))"} + ${" | , __lf_parameters(std::forward(parameters))"} ${" | "..state.generateInitializers()} |{} """.trimMargin() From 36d6926de975a1e4f97ca61862621bbf515ee037 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 13:12:41 +0100 Subject: [PATCH 27/49] add C++ test using the different initializer syntax options --- test/Cpp/src/target/InitializerSyntax.lf | 103 +++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 test/Cpp/src/target/InitializerSyntax.lf diff --git a/test/Cpp/src/target/InitializerSyntax.lf b/test/Cpp/src/target/InitializerSyntax.lf new file mode 100644 index 0000000000..e1883d2cb9 --- /dev/null +++ b/test/Cpp/src/target/InitializerSyntax.lf @@ -0,0 +1,103 @@ +target Cpp + +public preamble {= + #include + struct TestType { + int x; + + // constructor #1 + TestType() : x(42) {} + // constructor #2 + TestType(int x) : x(x) {} + // constructor #3 + TestType(std::initializer_list l) : x(l.size()) {} + // constructor #4 + TestType(const TestType& t) : x(t.x + 10) { } + // constructor #5 + TestType(TestType&& t) : x(t.x + 20) { } + + TestType& operator=(const TestType& t) { + std::cout << "assign\n"; + this->x = t.x + 30; + return *this; + } + TestType& operator=(TestType&& t) { + this->x = t.x + 40; + return *this; + } + + ~TestType() = default; + }; +=} + +reactor TestReactor( + // constructor #1 // FIXME: should work without an explicit initialization + p_default: TestType(), + // constructor #1 + p_empty: TestType(), + // constructor #2 + p_value: TestType(24), + // constructor #1 + p_init_empty: TestType{}, + // constructor #1 // FIXME: should work without {==} + p_init_empty2: TestType({= {} =}), + // constructor #1 + p_init_some: TestType{2, 6, 6, 3, 1}, + // constructor #1 // FIXME: should work without {==} + p_assign_init_empty: TestType = {= {} =}, + // constructor #3 + p_assign_init_some: TestType = {4, 2, 1} +) { + // constructor #1 + state s_default: TestType + // constructor #1 + state s_empty: TestType() + // constructor #2 + state s_value: TestType(24) + // constructor #1 + state s_init_empty: TestType{} + // constructor #3 // FIXME: should work without {==} + state s_init_empty2: TestType({= {} =}) + // constructor #3 + state s_init_some: TestType{3, 12, 40} + // constructor #3 // FIXME: should work without {==} + state s_assign_init_empty: TestType = {= {} =} + // constructor #3 + state s_assign_init_some: TestType = {4, 3, 2, 1} + // constructor #4 + state s_copy1: TestType(p_default) + // constructor #4 + state s_copy2: TestType{p_default} + // constructor #4 + state s_copy3: TestType = p_default + + reaction(startup) {= + reactor::validate(p_default.x == 62, "p_default should be default constructed and then moved"); + reactor::validate(p_empty.x == 62, "p_empty should be default constructed and then moved"); + reactor::validate(p_value.x == 44, "p_value should be constructed from 24 and then moved"); + reactor::validate(p_init_empty.x == 62, "p_init_empty should be default constructed and then moved"); + reactor::validate(p_init_empty2.x == 20, "p_init_empty2 should be constructed with 0 and then moved"); + reactor::validate(p_init_some.x == 25, "p_init_some should be constructed with 3 and then moved"); + reactor::validate(p_assign_init_empty.x == 62, "p_assign_init_empty should be default constructed and then moved"); + reactor::validate(p_assign_init_some.x == 23, "p_assign_init_some should be constructed with 4 and then moved"); + + reactor::validate(s_default.x == 42, "s_default should be default constructed"); + reactor::validate(s_empty.x == 42, "s_empty should be default constructed"); + reactor::validate(s_value.x == 24, "s_value should be constructed with 24"); + reactor::validate(s_init_empty.x == 42, "s_init_empty should be default constructed"); + reactor::validate(s_init_empty2.x == 0, "s_init_empty2 should be constructed with 0"); + reactor::validate(s_init_some.x == 3, "s_init_some should be constructed with 3"); + // NOTE: This is a strange corner case. Since the equal assignment will be translated to a () initializers (e.g. :foo(42)), + // the initialization here in LF behaves differently from what one might expect. When writing `Foo foo = {}`, + // the default constructor would be called instead of the initializer list constructor. + reactor::validate(s_assign_init_empty.x == 0, "s_assign_init_empty should be constructed with 0"); + reactor::validate(s_assign_init_some.x == 4, "s_assign_init_some should be constructed with 4"); + reactor::validate(s_copy1.x == 72, "s_copy1 should be copy constructed from p_default"); + reactor::validate(s_copy2.x == 72, "s_copy1 should be copy constructed from p_default"); + reactor::validate(s_copy3.x == 72, "s_copy1 should be copy constructed from p_default"); + =} +} + +main reactor { + test = new TestReactor() +} From 3a5015a6c4290acee4a043a2660c90d7cb839b34 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 13:15:01 +0100 Subject: [PATCH 28/49] do not omit empty initializes when formatting --- org.lflang/src/org/lflang/ast/ToLf.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/org.lflang/src/org/lflang/ast/ToLf.java b/org.lflang/src/org/lflang/ast/ToLf.java index 82c15b5d53..91dd8014f2 100644 --- a/org.lflang/src/org/lflang/ast/ToLf.java +++ b/org.lflang/src/org/lflang/ast/ToLf.java @@ -479,7 +479,7 @@ public MalleableString caseStateVar(StateVar object) { } msb.append("state ").append(object.getName()); msb.append(typeAnnotationFor(object.getType())); - msb.append(initializer(object.getInit(), true)); + msb.append(initializer(object.getInit())); return msb.get(); } @@ -834,13 +834,13 @@ public MalleableString caseAssignment(Assignment object) { // )); Builder msb = new Builder(); msb.append(object.getLhs().getName()); - msb.append(initializer(object.getRhs(), false)); + msb.append(initializer(object.getRhs())); return msb.get(); } @Override public MalleableString caseInitializer(Initializer object) { - return initializer(object, false); + return initializer(object); } /** @@ -853,7 +853,7 @@ private boolean shouldOutputAsAssignment(Initializer init) { || init.getExprs().size() == 1 && ASTUtils.getTarget(init).mandatesEqualsInitializers(); } - private MalleableString initializer(Initializer init, boolean nothingIfEmpty) { + private MalleableString initializer(Initializer init) { if (init == null) { return MalleableString.anyOf(""); } @@ -879,7 +879,7 @@ private MalleableString initializer(Initializer init, boolean nothingIfEmpty) { prefix = "("; suffix = ")"; } - return list(", ", prefix, suffix, nothingIfEmpty, false, init.getExprs()); + return list(", ", prefix, suffix, false, false, init.getExprs()); } @@ -894,7 +894,7 @@ public MalleableString caseParameter(Parameter object) { return builder .append(object.getName()) .append(typeAnnotationFor(object.getType())) - .append(initializer(object.getInit(), true)) + .append(initializer(object.getInit())) .get(); } From 2c4d21f9a3970770c8a523a6901309bb3ab46285 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 13:16:41 +0100 Subject: [PATCH 29/49] make sure empty braces are inserted in the generated code --- org.lflang/src/org/lflang/generator/cpp/CppTypes.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt index d5ec0498c1..6a908392ab 100644 --- a/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt +++ b/org.lflang/src/org/lflang/generator/cpp/CppTypes.kt @@ -89,7 +89,7 @@ fun CppTypes.getCppInitializer( } } else { val (prefix, postfix) = if (init.isBraces) Pair("{", "}") else Pair("(", ")") - init.exprs.joinToString(", ", prefix, postfix) { + init.exprs.joinWithCommas(prefix, postfix, trailing = false) { getTargetExpr(it, inferredType.componentType) } } From 4b4f4282acbdc508f1565be352dadce6eb01d79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 14 Mar 2023 14:11:57 +0100 Subject: [PATCH 30/49] Add tests for empty lists --- test/C/src/NativeListsAndTimes.lf | 2 ++ test/Cpp/src/NativeListsAndTimes.lf | 1 + 2 files changed, 3 insertions(+) diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index f33b057b6e..ad0ce442fa 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -19,6 +19,8 @@ main reactor( state baz = p // Implicit type int[] state period = z // Implicit type time + state empty_list: int[] = {} + reaction(tick) {= // Target code =} diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index 2881ffb796..33000b8b8f 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -23,6 +23,7 @@ reactor Foo( state times: std::vector< // a list of lists std::vector<{= reactor::Duration =}> >{q, g} + state empty_list: int[] = {} reaction(tick) {= // Target code From 90f2e3fd021aaabb68d392cdc79c383e57729bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 14 Mar 2023 15:28:07 +0100 Subject: [PATCH 31/49] Fix errors with empty lists --- org.lflang/src/org/lflang/LinguaFranca.xtext | 2 +- test/C/src/NativeListsAndTimes.lf | 3 ++- test/Cpp/src/NativeListsAndTimes.lf | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/org.lflang/src/org/lflang/LinguaFranca.xtext b/org.lflang/src/org/lflang/LinguaFranca.xtext index 23794a19e6..d4c0481228 100644 --- a/org.lflang/src/org/lflang/LinguaFranca.xtext +++ b/org.lflang/src/org/lflang/LinguaFranca.xtext @@ -318,7 +318,7 @@ Expression: // A list of expressions within braces. // In C/C++, this is an array initializer, struct initializer, or std::initializer_list. BracedListExpression: - '{' ( items+=Expression (',' items+=Expression)* )? ','? '}' + '{' {BracedListExpression} (items+=Expression (',' items+=Expression)*)? ','? '}' ; ParameterReference: diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index ad0ce442fa..e43cc3d153 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -7,7 +7,8 @@ main reactor( z = 1 msec, // Type is missing but not required p: int[] = {1, 2, 3, 4}, // List of integers q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values - g: time[] = {1 msec, 2 msec} // List of time values + g: time[] = {1 msec, 2 msec}, // List of time values + g2: int[] = {} ) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index 33000b8b8f..d7bfb285c6 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -9,7 +9,8 @@ reactor Foo( q: {= // list of time values std::vector =}{1 msec, 2 msec, 3 msec}, - g: time[]{1 msec, 2 msec} // List of time values + g: time[]{1 msec, 2 msec}, // List of time values + g2: int[] = {} ) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter From e43a51f4ef1f748106ec00e7e85a2019de05e49f Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 15:37:49 +0100 Subject: [PATCH 32/49] update C++ test --- test/Cpp/src/target/InitializerSyntax.lf | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/Cpp/src/target/InitializerSyntax.lf b/test/Cpp/src/target/InitializerSyntax.lf index e1883d2cb9..1702277d12 100644 --- a/test/Cpp/src/target/InitializerSyntax.lf +++ b/test/Cpp/src/target/InitializerSyntax.lf @@ -31,7 +31,9 @@ public preamble {= =} reactor TestReactor( - // constructor #1 // FIXME: should work without an explicit initialization + // constructor #1 + // FIXME: should work without an explicit initialization, see https://github.com/lf-lang/lingua-franca/issues/623 + // p_default: TestType, p_default: TestType(), // constructor #1 p_empty: TestType(), @@ -39,12 +41,12 @@ reactor TestReactor( p_value: TestType(24), // constructor #1 p_init_empty: TestType{}, - // constructor #1 // FIXME: should work without {==} - p_init_empty2: TestType({= {} =}), + // constructor #1 + p_init_empty2: TestType({}), // constructor #1 p_init_some: TestType{2, 6, 6, 3, 1}, - // constructor #1 // FIXME: should work without {==} - p_assign_init_empty: TestType = {= {} =}, + // constructor #1 + p_assign_init_empty: TestType = {}, // constructor #3 p_assign_init_some: TestType = {4, 2, 1} ) { @@ -56,12 +58,12 @@ reactor TestReactor( state s_value: TestType(24) // constructor #1 state s_init_empty: TestType{} - // constructor #3 // FIXME: should work without {==} - state s_init_empty2: TestType({= {} =}) + // constructor #3 + state s_init_empty2: TestType({}) // constructor #3 state s_init_some: TestType{3, 12, 40} - // constructor #3 // FIXME: should work without {==} - state s_assign_init_empty: TestType = {= {} =} + // constructor #3 + state s_assign_init_empty: TestType = {} // constructor #3 state s_assign_init_some: TestType = {4, 3, 2, 1} // constructor #4 From 088dab09c603ae25a240e2374c7727a4dc1d3c4d Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 15:44:03 +0100 Subject: [PATCH 33/49] formatting --- test/Cpp/src/target/InitializerSyntax.lf | 62 +++++++++--------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/test/Cpp/src/target/InitializerSyntax.lf b/test/Cpp/src/target/InitializerSyntax.lf index 1702277d12..54ae268457 100644 --- a/test/Cpp/src/target/InitializerSyntax.lf +++ b/test/Cpp/src/target/InitializerSyntax.lf @@ -31,47 +31,31 @@ public preamble {= =} reactor TestReactor( - // constructor #1 - // FIXME: should work without an explicit initialization, see https://github.com/lf-lang/lingua-franca/issues/623 - // p_default: TestType, + /** + * FIXME: should work without an explicit initialization, see + * https://github.com/lf-lang/lingua-franca/issues/623 + */ + // p_default: TestType, constructor #1 p_default: TestType(), - // constructor #1 - p_empty: TestType(), - // constructor #2 - p_value: TestType(24), - // constructor #1 - p_init_empty: TestType{}, - // constructor #1 - p_init_empty2: TestType({}), - // constructor #1 - p_init_some: TestType{2, 6, 6, 3, 1}, - // constructor #1 - p_assign_init_empty: TestType = {}, - // constructor #3 - p_assign_init_some: TestType = {4, 2, 1} + p_empty: TestType(), // constructor #1 + p_value: TestType(24), // constructor #2 + p_init_empty: TestType{}, // constructor #1 + p_init_empty2: TestType({}), // constructor #1 + p_init_some: TestType{2, 6, 6, 3, 1}, // constructor #1 + p_assign_init_empty: TestType = {}, // constructor #1 + p_assign_init_some: TestType = {4, 2, 1} // constructor #3 ) { - // constructor #1 - state s_default: TestType - // constructor #1 - state s_empty: TestType() - // constructor #2 - state s_value: TestType(24) - // constructor #1 - state s_init_empty: TestType{} - // constructor #3 - state s_init_empty2: TestType({}) - // constructor #3 - state s_init_some: TestType{3, 12, 40} - // constructor #3 - state s_assign_init_empty: TestType = {} - // constructor #3 - state s_assign_init_some: TestType = {4, 3, 2, 1} - // constructor #4 - state s_copy1: TestType(p_default) - // constructor #4 - state s_copy2: TestType{p_default} - // constructor #4 - state s_copy3: TestType = p_default + state s_default: TestType // constructor #1 + state s_empty: TestType() // constructor #1 + state s_value: TestType(24) // constructor #2 + state s_init_empty: TestType{} // constructor #1 + state s_init_empty2: TestType({}) // constructor #3 + state s_init_some: TestType{3, 12, 40} // constructor #3 + state s_assign_init_empty: TestType = {} // constructor #3 + state s_assign_init_some: TestType = {4, 3, 2, 1} // constructor #3 + state s_copy1: TestType(p_default) // constructor #4 + state s_copy2: TestType{p_default} // constructor #4 + state s_copy3: TestType = p_default // constructor #4 reaction(startup) {= reactor::validate(p_default.x == 62, "p_default should be default constructed and then moved"); From 2b7326f80d01b153773b7aee766e83d0ad00f6be Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 17:55:10 +0100 Subject: [PATCH 34/49] implement isEqual for BracedListExpression --- org.lflang/src/org/lflang/ast/IsEqual.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/ast/IsEqual.java b/org.lflang/src/org/lflang/ast/IsEqual.java index 7cae9e471d..27175def13 100644 --- a/org.lflang/src/org/lflang/ast/IsEqual.java +++ b/org.lflang/src/org/lflang/ast/IsEqual.java @@ -16,6 +16,7 @@ import org.lflang.lf.Assignment; import org.lflang.lf.AttrParm; import org.lflang.lf.Attribute; +import org.lflang.lf.BracedListExpression; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; @@ -436,10 +437,18 @@ public Boolean caseExpression(Expression object) { Literal.class, Time.class, ParameterReference.class, - Code.class + Code.class, + BracedListExpression.class ); } + @Override + public Boolean caseBracedListExpression(BracedListExpression object) { + return new ComparisonMachine<>(object, BracedListExpression.class) + .listsEquivalent(BracedListExpression::getItems) + .conclusion; + } + @Override public Boolean caseParameterReference(ParameterReference object) { return new ComparisonMachine<>(object, ParameterReference.class) From c6eeb7056abe1f5252978db69e91854e9a0e4649 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 14 Mar 2023 17:55:49 +0100 Subject: [PATCH 35/49] formatting --- test/C/src/NativeListsAndTimes.lf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index e43cc3d153..335200e98c 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -3,9 +3,9 @@ target C // This test passes if it is successfully compiled into valid target code. main reactor( x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[] = {1, 2, 3, 4}, // List of integers + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[] = {1, 2, 3, 4}, // List of integers q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values g: time[] = {1 msec, 2 msec}, // List of time values g2: int[] = {} From 83634836f5018eaa398a614cff54498c1f0e3585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Tue, 14 Mar 2023 19:02:50 +0100 Subject: [PATCH 36/49] Format --- test/Cpp/src/NativeListsAndTimes.lf | 6 +++--- .../src/federated/DistributedCountPhysical.lf | 6 +++--- .../src/federated/PingPongDistributedPhysical.lf | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index d7bfb285c6..5bf67c8fb4 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -3,9 +3,9 @@ target Cpp // This test passes if it is successfully compiled into valid target code. reactor Foo( x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[]{1, 2, 3, 4}, // List of integers + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[]{1, 2, 3, 4}, // List of integers q: {= // list of time values std::vector =}{1 msec, 2 msec, 3 msec}, diff --git a/test/TypeScript/src/federated/DistributedCountPhysical.lf b/test/TypeScript/src/federated/DistributedCountPhysical.lf index c0edeb4c33..9ab549e0d0 100644 --- a/test/TypeScript/src/federated/DistributedCountPhysical.lf +++ b/test/TypeScript/src/federated/DistributedCountPhysical.lf @@ -14,7 +14,7 @@ target TypeScript { reactor Count { timer t(200 msec, 1 sec) - state s: number(0) + state s: number = 0 output out: number reaction(t) -> out {= @@ -25,8 +25,8 @@ reactor Count { reactor Print { input inp: number - state c: number(0) - state compareTime: time(200 msec) + state c: number = 0 + state compareTime: time = 200 msec reaction(inp) {= let elapsedTime = util.getElapsedLogicalTime(); diff --git a/test/TypeScript/src/federated/PingPongDistributedPhysical.lf b/test/TypeScript/src/federated/PingPongDistributedPhysical.lf index 1f33964abc..58f55a4747 100644 --- a/test/TypeScript/src/federated/PingPongDistributedPhysical.lf +++ b/test/TypeScript/src/federated/PingPongDistributedPhysical.lf @@ -27,10 +27,10 @@ */ target TypeScript -reactor Ping(count: number(10)) { +reactor Ping(count: number = 10) { input receive: number output send: number - state pingsLeft: number(count) + state pingsLeft: number = count logical action serve reaction(startup, serve) -> send {= @@ -47,10 +47,10 @@ reactor Ping(count: number(10)) { =} } -reactor Pong(expected: number(10)) { +reactor Pong(expected: number = 10) { input receive: number output send: number - state count: number(0) + state count: number = 0 reaction(receive) -> send {= count++; @@ -69,7 +69,7 @@ reactor Pong(expected: number(10)) { =} } -federated reactor(count: number(10)) { +federated reactor(count: number = 10) { ping = new Ping(count = count) pong = new Pong(expected = count) ping.send ~> pong.receive From c4f45405a795921298107f08c8e787f1174daafc Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 15 Mar 2023 09:44:16 +0100 Subject: [PATCH 37/49] respect parameter assignments in C --- .../lflang/generator/c/CParameterGenerator.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java index fb60908e5a..1fd69bae66 100644 --- a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java @@ -1,7 +1,5 @@ package org.lflang.generator.c; -import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; @@ -9,13 +7,10 @@ import org.lflang.generator.ParameterInstance; import org.lflang.ASTUtils; import org.lflang.generator.CodeBuilder; -import org.lflang.generator.GeneratorBase; import org.lflang.lf.Assignment; import org.lflang.lf.Expression; import org.lflang.lf.Parameter; -import org.lflang.lf.ParameterReference; import org.lflang.lf.Reactor; -import org.lflang.lf.Type; /** * Generates C code to declare and initialize parameters. @@ -37,8 +32,18 @@ public static String getInitializer(ParameterInstance p) { return CUtil.bankIndex(p.getParent()); } + // Handle overrides in the intantiation. + // In case there is more than one assignment to this parameter, we need to + // find the last one. + Assignment lastAssignment = null; + for (Assignment assignment: p.getParent().getDefinition().getParameters()) { + if (assignment.getLhs() == p.getDefinition()) { + lastAssignment = assignment; + } + } + CTypes ctypes = CTypes.generateParametersIn(p.getParent().getParent()); - List values = p.getInitialValue(); + List values = (lastAssignment != null) ? lastAssignment.getRhs().getExprs() : p.getInitialValue(); InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); if (values.size() == 1) { return ctypes.getTargetExpr(values.get(0), paramType); From 06617d178f792c4170083d83305f4da745ea1ca8 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 15 Mar 2023 15:14:35 +0100 Subject: [PATCH 38/49] also respect parameter assignment in Python --- .../generator/python/PythonParameterGenerator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java index c6d837685f..8e11ff5e01 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java @@ -113,8 +113,16 @@ public static String generatePythonInitializer(ParameterInstance p) { // Handle overrides in the instantiation. // In case there is more than one assignment to this parameter, we need to // find the last one. + Assignment lastAssignment = null; + for (Assignment assignment : p.getParent().getDefinition().getParameters()) { + if (assignment.getLhs() == p.getDefinition()) { + lastAssignment = assignment; + } + } + PythonTypes pyTypes = PythonTypes.generateParametersIn(p.getParent().getParent()); - List values = p.getInitialValue(); + List values = (lastAssignment != null) ? lastAssignment.getRhs().getExprs() + : p.getInitialValue(); InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); if (values.size() == 1) { return pyTypes.getTargetExpr(values.get(0), paramType); From ebdb0b3b75eaf2d64d15dfe7cdc87419c50c61c0 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 15 Mar 2023 16:26:07 +0100 Subject: [PATCH 39/49] fix python names --- org.lflang/src/org/lflang/generator/python/PythonTypes.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/python/PythonTypes.java b/org.lflang/src/org/lflang/generator/python/PythonTypes.java index 706078d6f4..5b62ee5f97 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonTypes.java +++ b/org.lflang/src/org/lflang/generator/python/PythonTypes.java @@ -69,7 +69,7 @@ public static PythonTypes generateParametersIn(ReactorInstance instance) { return new PythonTypes() { @Override public String getTargetParamRef(ParameterReference expr, InferredType typeOrNull) { - return CUtil.reactorRef(instance) + "." + expr.getParameter().getName(); + return PyUtil.reactorRef(instance) + "." + expr.getParameter().getName(); } }; } From fb2b57d1dce629c2fb2cf82f6d99fb3b0281c231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 15 Mar 2023 17:59:19 +0100 Subject: [PATCH 40/49] Cleanup in ParameterInstance --- .../diagram/synthesis/LinguaFrancaSynthesis.java | 4 ++-- .../org/lflang/generator/ParameterInstance.java | 16 +++++++++++++++- .../lflang/generator/c/CParameterGenerator.java | 12 +----------- .../python/PythonParameterGenerator.java | 13 +------------ 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index c06956e72b..9bdbaeb206 100644 --- a/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -1189,9 +1189,9 @@ private String createParameterLabel(ParameterInstance param) { if (!StringExtensions.isNullOrEmpty(t)) { b.append(": ").append(t); } - if (!IterableExtensions.isNullOrEmpty(param.getInitialValue())) { + if (!IterableExtensions.isNullOrEmpty(param.getActualValue())) { b.append(" = "); - b.append(IterableExtensions.join(param.getInitialValue(), ", ", ASTUtils::toOriginalText)); + b.append(IterableExtensions.join(param.getActualValue(), ", ", ASTUtils::toOriginalText)); } return b.toString(); } diff --git a/org.lflang/src/org/lflang/generator/ParameterInstance.java b/org.lflang/src/org/lflang/generator/ParameterInstance.java index 9da4f1f247..6255ffe6f6 100644 --- a/org.lflang/src/org/lflang/generator/ParameterInstance.java +++ b/org.lflang/src/org/lflang/generator/ParameterInstance.java @@ -76,9 +76,23 @@ public ParameterInstance(Parameter definition, ReactorInstance parent) { * of Time, Literal, or Code. That is, references to other * parameters have been replaced with their initial values. */ - public List getInitialValue() { + private List getInitialValue() { return parent.initialParameterValue(this.definition); } + + /** + * Return the (possibly overridden) value of this parameter + * in the containing instance. Parameter references are resolved + * to actual expressions. + */ + // todo this should return an Initializer + public List getActualValue() { + Assignment override = getOverride(); + if (override != null) { + return override.getRhs().getExprs().stream().map(parent::resolveParameters).toList(); + } + return getInitialValue(); + } /** * Return the name of this parameter. diff --git a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java index 1fd69bae66..5218ff6b7e 100644 --- a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java @@ -32,18 +32,8 @@ public static String getInitializer(ParameterInstance p) { return CUtil.bankIndex(p.getParent()); } - // Handle overrides in the intantiation. - // In case there is more than one assignment to this parameter, we need to - // find the last one. - Assignment lastAssignment = null; - for (Assignment assignment: p.getParent().getDefinition().getParameters()) { - if (assignment.getLhs() == p.getDefinition()) { - lastAssignment = assignment; - } - } - CTypes ctypes = CTypes.generateParametersIn(p.getParent().getParent()); - List values = (lastAssignment != null) ? lastAssignment.getRhs().getExprs() : p.getInitialValue(); + List values = p.getActualValue(); InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); if (values.size() == 1) { return ctypes.getTargetExpr(values.get(0), paramType); diff --git a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java index 8e11ff5e01..9cc33c4f17 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java @@ -110,19 +110,8 @@ private static String generatePythonInitializer(Parameter p) { * @return Initialization code */ public static String generatePythonInitializer(ParameterInstance p) { - // Handle overrides in the instantiation. - // In case there is more than one assignment to this parameter, we need to - // find the last one. - Assignment lastAssignment = null; - for (Assignment assignment : p.getParent().getDefinition().getParameters()) { - if (assignment.getLhs() == p.getDefinition()) { - lastAssignment = assignment; - } - } - PythonTypes pyTypes = PythonTypes.generateParametersIn(p.getParent().getParent()); - List values = (lastAssignment != null) ? lastAssignment.getRhs().getExprs() - : p.getInitialValue(); + List values = p.getActualValue(); InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); if (values.size() == 1) { return pyTypes.getTargetExpr(values.get(0), paramType); From 2df3c8fe11bb662f44cd45b086c5aff3b41349e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 15 Mar 2023 18:06:39 +0100 Subject: [PATCH 41/49] Further cleanup Note that python parameters are not tuples anymore, now they're lists Revert this if it causes problems. --- .../synthesis/LinguaFrancaSynthesis.java | 6 ++++-- .../org/lflang/generator/ParameterInstance.java | 17 +++++++++++++---- .../lflang/generator/c/CParameterGenerator.java | 11 +++-------- .../python/PythonParameterGenerator.java | 9 +-------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 9bdbaeb206..1497ee6644 100644 --- a/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/org.lflang/src/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -66,6 +66,7 @@ import org.lflang.AttributeUtils; import org.lflang.InferredType; import org.lflang.ast.FormattingUtils; +import org.lflang.ast.ToText; import org.lflang.diagram.synthesis.action.CollapseAllReactorsAction; import org.lflang.diagram.synthesis.action.ExpandAllReactorsAction; import org.lflang.diagram.synthesis.action.FilterCycleAction; @@ -1189,9 +1190,10 @@ private String createParameterLabel(ParameterInstance param) { if (!StringExtensions.isNullOrEmpty(t)) { b.append(": ").append(t); } - if (!IterableExtensions.isNullOrEmpty(param.getActualValue())) { + if (param.getOverride() != null) { b.append(" = "); - b.append(IterableExtensions.join(param.getActualValue(), ", ", ASTUtils::toOriginalText)); + var init = param.getActualValue(); + b.append(FormattingUtils.render(init)); } return b.toString(); } diff --git a/org.lflang/src/org/lflang/generator/ParameterInstance.java b/org.lflang/src/org/lflang/generator/ParameterInstance.java index 6255ffe6f6..527986f324 100644 --- a/org.lflang/src/org/lflang/generator/ParameterInstance.java +++ b/org.lflang/src/org/lflang/generator/ParameterInstance.java @@ -34,8 +34,12 @@ import org.lflang.ASTUtils; import org.lflang.lf.Assignment; import org.lflang.lf.Expression; +import org.lflang.lf.Initializer; +import org.lflang.lf.LfFactory; import org.lflang.lf.Parameter; +import kotlin.reflect.jvm.internal.impl.resolve.constants.KClassValue.Value; + /** * Representation of a compile-time instance of a parameter. * Upon creation, it is checked whether this parameter is overridden by an @@ -85,13 +89,18 @@ private List getInitialValue() { * in the containing instance. Parameter references are resolved * to actual expressions. */ - // todo this should return an Initializer - public List getActualValue() { + public Initializer getActualValue() { Assignment override = getOverride(); + List values; if (override != null) { - return override.getRhs().getExprs().stream().map(parent::resolveParameters).toList(); + values = override.getRhs().getExprs().stream().map(parent::resolveParameters).toList(); + } else { + values = getInitialValue(); } - return getInitialValue(); + Initializer init = LfFactory.eINSTANCE.createInitializer(); + init.getExprs().addAll(values); + init.setParens(true); // todo + return init; } /** diff --git a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java index 5218ff6b7e..1534f0ea02 100644 --- a/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CParameterGenerator.java @@ -9,6 +9,7 @@ import org.lflang.generator.CodeBuilder; import org.lflang.lf.Assignment; import org.lflang.lf.Expression; +import org.lflang.lf.Initializer; import org.lflang.lf.Parameter; import org.lflang.lf.Reactor; @@ -33,14 +34,8 @@ public static String getInitializer(ParameterInstance p) { } CTypes ctypes = CTypes.generateParametersIn(p.getParent().getParent()); - List values = p.getActualValue(); - InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); - if (values.size() == 1) { - return ctypes.getTargetExpr(values.get(0), paramType); - } else { - return values.stream().map(it -> ctypes.getTargetExpr(it, paramType.getComponentType())) - .collect(Collectors.joining(", ", "{ ", "}")); - } + Initializer values = p.getActualValue(); + return ctypes.getTargetInitializer(values, p.getDefinition().getType()); } /** diff --git a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java index 9cc33c4f17..fe78d8187f 100644 --- a/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java +++ b/org.lflang/src/org/lflang/generator/python/PythonParameterGenerator.java @@ -111,14 +111,7 @@ private static String generatePythonInitializer(Parameter p) { */ public static String generatePythonInitializer(ParameterInstance p) { PythonTypes pyTypes = PythonTypes.generateParametersIn(p.getParent().getParent()); - List values = p.getActualValue(); - InferredType paramType = ASTUtils.getInferredType(p.getDefinition()); - if (values.size() == 1) { - return pyTypes.getTargetExpr(values.get(0), paramType); - } else { - return values.stream().map(it -> pyTypes.getTargetExpr(it, paramType.getComponentType())) - .collect(Collectors.joining(", ", "( ", ")")); - } + return pyTypes.getTargetInitializer(p.getActualValue(), p.getDefinition().getType()); } } From 8cc6fecc2260d74fa7abdd93f1d84c4c04374dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 15 Mar 2023 18:08:37 +0100 Subject: [PATCH 42/49] Cleanup --- org.lflang/src/org/lflang/generator/ParameterInstance.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/ParameterInstance.java b/org.lflang/src/org/lflang/generator/ParameterInstance.java index 527986f324..4355ae4483 100644 --- a/org.lflang/src/org/lflang/generator/ParameterInstance.java +++ b/org.lflang/src/org/lflang/generator/ParameterInstance.java @@ -30,16 +30,14 @@ import java.util.List; import java.util.Optional; -import org.lflang.InferredType; import org.lflang.ASTUtils; +import org.lflang.InferredType; import org.lflang.lf.Assignment; import org.lflang.lf.Expression; import org.lflang.lf.Initializer; import org.lflang.lf.LfFactory; import org.lflang.lf.Parameter; -import kotlin.reflect.jvm.internal.impl.resolve.constants.KClassValue.Value; - /** * Representation of a compile-time instance of a parameter. * Upon creation, it is checked whether this parameter is overridden by an From 80b0d5fca2dc8f1f247b3da5901c3bfdaa3be5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 15 Mar 2023 22:31:39 +0100 Subject: [PATCH 43/49] Fix C test --- .../org/lflang/generator/ParameterInstance.java | 2 +- test/C/src/ParameterHierarchy.lf | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/ParameterInstance.java b/org.lflang/src/org/lflang/generator/ParameterInstance.java index 4355ae4483..d3a957ca71 100644 --- a/org.lflang/src/org/lflang/generator/ParameterInstance.java +++ b/org.lflang/src/org/lflang/generator/ParameterInstance.java @@ -91,7 +91,7 @@ public Initializer getActualValue() { Assignment override = getOverride(); List values; if (override != null) { - values = override.getRhs().getExprs().stream().map(parent::resolveParameters).toList(); + values = override.getRhs().getExprs().stream().map(parent.parent::resolveParameters).toList(); } else { values = getInitialValue(); } diff --git a/test/C/src/ParameterHierarchy.lf b/test/C/src/ParameterHierarchy.lf index 946b24fa0d..825f9f5a60 100644 --- a/test/C/src/ParameterHierarchy.lf +++ b/test/C/src/ParameterHierarchy.lf @@ -1,24 +1,24 @@ // Test that parameter values pass down a deep hierarchy. target C -reactor Deep(p: int = 0) { +reactor Deep(p0: int = 0) { reaction(startup) {= - if (self->p != 42) { - lf_print_error_and_exit("Parameter value is %d. Should have been 42."); + if (self->p0 != 42) { + lf_print_error_and_exit("Parameter value is %d. Should have been 42.", self->p0); } else { lf_print("Success."); } =} } -reactor Intermediate(p: int = 10) { - a = new Deep(p = p) +reactor Intermediate(p1: int = 10) { + a0 = new Deep(p0 = p1) } -reactor Another(p: int = 20) { - a = new Intermediate(p = p) +reactor Another(p2: int = 20) { + a1 = new Intermediate(p1 = p2) } main reactor ParameterHierarchy { - a = new Intermediate(p = 42) + a2 = new Another(p2 = 42) } From ae346b1613ea17579a6cb461601003e35c627c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 16 Mar 2023 14:01:02 +0100 Subject: [PATCH 44/49] Revert a change --- org.lflang/src/org/lflang/generator/ParameterInstance.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/ParameterInstance.java b/org.lflang/src/org/lflang/generator/ParameterInstance.java index d3a957ca71..8f4a205b24 100644 --- a/org.lflang/src/org/lflang/generator/ParameterInstance.java +++ b/org.lflang/src/org/lflang/generator/ParameterInstance.java @@ -91,7 +91,7 @@ public Initializer getActualValue() { Assignment override = getOverride(); List values; if (override != null) { - values = override.getRhs().getExprs().stream().map(parent.parent::resolveParameters).toList(); + values = override.getRhs().getExprs(); } else { values = getInitialValue(); } From 2341c55b7e6ff5bcfde56a90db548eb7b98ffac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 18 Mar 2023 15:11:00 +0100 Subject: [PATCH 45/49] Fix toText for synthetic nodes --- org.lflang/src/org/lflang/generator/CodeMap.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/CodeMap.java b/org.lflang/src/org/lflang/generator/CodeMap.java index 12d5ea8f65..d00fe9bc9a 100644 --- a/org.lflang/src/org/lflang/generator/CodeMap.java +++ b/org.lflang/src/org/lflang/generator/CodeMap.java @@ -17,6 +17,7 @@ import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.util.LineAndColumn; +import org.lflang.lf.ParameterReference; import org.lflang.lf.impl.ParameterReferenceImpl; /** @@ -147,6 +148,10 @@ public static String tag(EObject astNode, String representation, boolean verbati oneBasedLfLineAndColumn.getLine(), oneBasedLfLineAndColumn.getColumn() ); final URI uri = bestEffortGetEResource(astNode).getURI(); + if (uri == null) { + // no EResource, no correspondence can be found + return representation; + } final Path lfPath = Path.of(uri.isFile() ? uri.toFileString() : uri.path()); if (verbatim) lfStart = lfStart.plus(node.getText().substring(0, indexOf(node.getText(), representation))); return new Correspondence( @@ -162,12 +167,10 @@ public static String tag(EObject astNode, String representation, boolean verbati * This is a dangerous operation which can cause an unrecoverable error. */ private static Resource bestEffortGetEResource(EObject astNode) { - if (astNode instanceof ParameterReferenceImpl pri) return pri.getParameter().eResource(); - Resource ret = astNode.eResource(); - if (ret != null) return ret; - throw new RuntimeException( - "Every non-null AST node should have an EResource, but \"" + astNode + "\" does not." - ); + if (astNode instanceof ParameterReference pri) { + return pri.getParameter().eResource(); + } + return astNode.eResource(); } /** From 8a130e44a1e30f7e6327e911bd4e880490a90a8c Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 24 Mar 2023 15:08:34 +0100 Subject: [PATCH 46/49] fix C tests (hopefully) for good --- .../lflang/generator/ParameterInstance.java | 18 +++++---------- .../org/lflang/generator/ReactorInstance.java | 23 ------------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/org.lflang/src/org/lflang/generator/ParameterInstance.java b/org.lflang/src/org/lflang/generator/ParameterInstance.java index 8f4a205b24..9287710e6b 100644 --- a/org.lflang/src/org/lflang/generator/ParameterInstance.java +++ b/org.lflang/src/org/lflang/generator/ParameterInstance.java @@ -73,13 +73,10 @@ public ParameterInstance(Parameter definition, ReactorInstance parent) { //// Public Methods /** - * Get the initial value(s) of this parameter as a list of - * Value objects, where each Value is either an instance - * of Time, Literal, or Code. That is, references to other - * parameters have been replaced with their initial values. + * Get the initial value of this parameter. */ - private List getInitialValue() { - return parent.initialParameterValue(this.definition); + private Initializer getInitialValue() { + return definition.getInit(); } /** @@ -89,15 +86,12 @@ private List getInitialValue() { */ public Initializer getActualValue() { Assignment override = getOverride(); - List values; + Initializer init; if (override != null) { - values = override.getRhs().getExprs(); + init = override.getRhs(); } else { - values = getInitialValue(); + init = getInitialValue(); } - Initializer init = LfFactory.eINSTANCE.createInitializer(); - init.getExprs().addAll(values); - init.setParens(true); // todo return init; } diff --git a/org.lflang/src/org/lflang/generator/ReactorInstance.java b/org.lflang/src/org/lflang/generator/ReactorInstance.java index 3154831136..709c4ac012 100644 --- a/org.lflang/src/org/lflang/generator/ReactorInstance.java +++ b/org.lflang/src/org/lflang/generator/ReactorInstance.java @@ -452,29 +452,6 @@ public boolean hasCycles() { */ public Integer initialIntParameterValue(Parameter parameter) { return ASTUtils.initialValueInt(parameter, instantiations()); - } - - /** - * Given a parameter definition for this reactor, return the initial value - * of the parameter. If the parameter is overridden when instantiating - * this reactor or any of its containing reactors, use that value. - * Otherwise, use the default value in the reactor definition. - * - * The returned list of Value objects is such that each element is an - * instance of Time, String, or Code, never Parameter. - * For most uses, this list has only one element, but parameter - * values can be lists of elements, so the returned value is a list. - * - * @param parameter The parameter definition (a syntactic object in the AST). - * - * @return A list of Value objects, or null if the parameter is not found. - * Return an empty list if no initial value is given. - * Each value is an instance of Literal if a literal value is given, - * a Time if a time value was given, or a Code, if a code value was - * given (text in the target language delimited by {= ... =} - */ - List initialParameterValue(Parameter parameter) { - return ASTUtils.initialValue(parameter, instantiations()); } public Expression resolveParameters(Expression e) { From b594f910c887660bd7959e391cb771644758b307 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Mon, 27 Mar 2023 11:14:05 +0200 Subject: [PATCH 47/49] Don't use C23 syntax in test Co-authored-by: Peter Donovan <33707478+petervdonovan@users.noreply.github.com> --- test/C/src/NativeListsAndTimes.lf | 1 - 1 file changed, 1 deletion(-) diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index 335200e98c..afeb887903 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -8,7 +8,6 @@ main reactor( p: int[] = {1, 2, 3, 4}, // List of integers q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values g: time[] = {1 msec, 2 msec}, // List of time values - g2: int[] = {} ) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter From a9798d91ef55a4a611feb30e002d631ef048a7dd Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Mon, 27 Mar 2023 14:19:13 +0200 Subject: [PATCH 48/49] fix C test once more and apply formatting --- test/C/src/NativeListsAndTimes.lf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index afeb887903..a1d09beb6c 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -3,11 +3,11 @@ target C // This test passes if it is successfully compiled into valid target code. main reactor( x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[] = {1, 2, 3, 4}, // List of integers + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[] = {1, 2, 3, 4}, // List of integers q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values - g: time[] = {1 msec, 2 msec}, // List of time values + g: time[] = {1 msec, 2 msec} // List of time values ) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter @@ -19,7 +19,7 @@ main reactor( state baz = p // Implicit type int[] state period = z // Implicit type time - state empty_list: int[] = {} + state empty_list: int[] reaction(tick) {= // Target code From 63d2fa01a4e5830c7207145cf135428df983bf14 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Mon, 27 Mar 2023 19:54:45 +0200 Subject: [PATCH 49/49] Fix comment Co-authored-by: Peter Donovan <33707478+petervdonovan@users.noreply.github.com> --- org.lflang/src/org/lflang/Target.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/Target.java b/org.lflang/src/org/lflang/Target.java index c3bfda067a..11247b6648 100644 --- a/org.lflang/src/org/lflang/Target.java +++ b/org.lflang/src/org/lflang/Target.java @@ -501,7 +501,7 @@ public boolean buildsUsingDocker() { } /** - * Whether the target requires using an equal sign to assign a defaul value to a parameter, + * Whether the target requires using an equal sign to assign a default value to a parameter, * or initialize a state variable. All targets mandate an equal sign when passing * arguments to a reactor constructor call, regardless of this method. */