-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from lf-lang/clem.par-build
Rewrite of the backend interfaces
- Loading branch information
Showing
18 changed files
with
779 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ result | |
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
.direnv | ||
sandbox/ | ||
|
||
.vscode/ | ||
build/ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[package] | ||
name = "example_project" | ||
version = "0.1.0" | ||
authors = ["tassilo.tannerber@tu-dresden.de"] | ||
homepage = "https://lf-lang.org" | ||
license = "Weird Stallman License" | ||
description = "A little Lingo.toml for people" | ||
|
||
# shared properties of all binaries | ||
[properties] | ||
fast = true | ||
|
||
# first binary in the project | ||
[[app]] | ||
name = "git-hook" | ||
target = "Cpp" | ||
main_reactor = "src/Main.lf" | ||
dependencies = {} | ||
# main_reactor defaults to src/Main.lf | ||
|
||
# dependencies | ||
#[[app.dependencies]] | ||
#git = {version = "0.3.2"} | ||
#tarfetcher = {version = "0.4.2"} | ||
|
||
# replacement for target properties | ||
[app.properties] | ||
logging = "info" | ||
#cmake-include = "./my-cmake.cmake" | ||
|
||
# second binary | ||
[[app]] | ||
name = "embedded" | ||
main_reactor = "src/Main2.lf" | ||
dependencies = {} | ||
target = "Cpp" | ||
|
||
#[[app.dependencies]] | ||
#blink = {version = "0.1.2"} | ||
|
||
[app.properties] | ||
no-compile = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This example illustrates local deadline handling. Even numbers are sent by the Source | ||
// immediately, whereas odd numbers are sent after a big enough delay to violate the deadline. | ||
target Cpp { | ||
timeout: 4 sec | ||
} | ||
|
||
reactor Source(period: time = 2 sec) { | ||
private preamble {= | ||
#include <thread> | ||
=} | ||
output y: int | ||
timer t(0, period) | ||
state count: int = 0 | ||
|
||
reaction(t) -> y {= | ||
if (count % 2 == 1) { | ||
// The count variable is odd. | ||
// Take time to cause a deadline violation. | ||
std::this_thread::sleep_for(400ms); | ||
} | ||
std::cout << "Source sends: " << count << std::endl; | ||
y.set(count); | ||
count++; | ||
=} | ||
} | ||
|
||
reactor Destination(timeout: time = 1 sec) { | ||
input x: int | ||
state count: int = 0 | ||
|
||
reaction(x) {= | ||
std::cout << "Destination receives: " << *x.get() << std::endl; | ||
if (count % 2 == 1) { | ||
// The count variable is odd, so the deadline should have been | ||
// violated | ||
std::cerr << "ERROR: Failed to detect deadline." << std::endl; | ||
exit(1); | ||
} | ||
count++; | ||
=} deadline(timeout) {= | ||
std::cout << "Destination deadline handler receives: " | ||
<< *x.get() << std::endl; | ||
if (count % 2 == 0) { | ||
// The count variable is even, so the deadline should not have | ||
// been violated. | ||
std::cerr << "ERROR: Deadline handler invoked without deadline " | ||
<< "violation." << std::endl; | ||
exit(2); | ||
} | ||
count++; | ||
=} | ||
} | ||
|
||
main reactor Main { | ||
s = new Source() | ||
d = new Destination(timeout = 200 msec) | ||
s.y -> d.x | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This example illustrates local deadline handling. Even numbers are sent by the Source | ||
// immediately, whereas odd numbers are sent after a big enough delay to violate the deadline. | ||
target Cpp { | ||
timeout: 4 sec | ||
} | ||
|
||
reactor Source(period: time = 2 sec) { | ||
private preamble {= | ||
#include <thread> | ||
=} | ||
output y: int | ||
timer t(0, period) | ||
state count: int = 0 | ||
|
||
reaction(t) -> y {= | ||
if (count % 2 == 1) { | ||
// The count variable is odd. | ||
// Take time to cause a deadline violation. | ||
std::this_thread::sleep_for(400ms); | ||
} | ||
std::cout << "Source sends: " << count << std::endl; | ||
y.set(count); | ||
count++; | ||
=} | ||
} | ||
|
||
reactor Destination(timeout: time = 1 sec) { | ||
input x: int | ||
state count: int = 0 | ||
|
||
reaction(x) {= | ||
std::cout << "Destination receives: " << *x.get() << std::endl; | ||
if (count % 2 == 1) { | ||
// The count variable is odd, so the deadline should have been | ||
// violated | ||
std::cerr << "ERROR: Failed to detect deadline." << std::endl; | ||
exit(1); | ||
} | ||
count++; | ||
=} deadline(timeout) {= | ||
std::cout << "Destination deadline handler receives: " | ||
<< *x.get() << std::endl; | ||
if (count % 2 == 0) { | ||
// The count variable is even, so the deadline should not have | ||
// been violated. | ||
std::cerr << "ERROR: Deadline handler invoked without deadline " | ||
<< "violation." << std::endl; | ||
exit(2); | ||
} | ||
count++; | ||
=} | ||
} | ||
|
||
main reactor Main2 { | ||
s = new Source() | ||
d = new Destination(timeout = 200 msec) | ||
s.y -> d.x | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.