Skip to content

Commit 42a41fb

Browse files
authored
Merge pull request #310 from lf-lang/research-focus
Update for more of a research focus
2 parents cf8a0c1 + def3223 commit 42a41fb

File tree

16 files changed

+92
-51
lines changed

16 files changed

+92
-51
lines changed

docs/assets/code/c/src/MainReactor.lf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
target C
2+
reactor ReactorA {
3+
output output_port: int
4+
@label("timer (offset, period)")
5+
timer t(0, 100 ms)
6+
@label("reaction A1")
7+
reaction(t) -> output_port {=
8+
=}
9+
}
10+
reactor ReactorB {
11+
input input_port: int
12+
output output_port: int
13+
@label("reaction B1")
14+
reaction(input_port) -> output_port {=
15+
=}
16+
}
17+
reactor ReactorC {
18+
input input_port1: int
19+
input input_port2: int
20+
@label("reaction C1")
21+
reaction(input_port1) {=
22+
=}
23+
@label("reaction C2")
24+
reaction(input_port2) {=
25+
=}
26+
}
27+
main reactor {
28+
a = new ReactorA()
29+
b = new ReactorB()
30+
c = new ReactorC()
31+
a.output_port -> c.input_port2 after 200 ms
32+
a.output_port -> b.input_port after 100 ms
33+
b.output_port -> c.input_port1 after 100 ms
34+
}

docs/assets/images/diagrams/MainReactor.svg

Lines changed: 1 addition & 0 deletions
Loading
4.58 KB
Loading
452 KB
Loading

docs/developer/downloading-and-building.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ For more details on our testing infrastructure, please refer to the [Regression
4141
If you only want to build without running any tests, you can use `./gradlew assemble` instead.
4242
Both the assemble and the build task will create a distribution package containing our command line tools in `build/distribution`.
4343
There is also an installed version of this package in `build/install/lf-cli/`.
44-
If you run `build/install/lf-cli/bin/lfc` this will run lfc as it was last build.
44+
If you run `build/install/lf-cli/bin/lfc` this will run lfc as it was last built.
4545
Thus, you can choose if you want to use `bin/lfc-dev`, which first builds `lfc` using the latest code and then runs it, or if you prefer to run `./gradlew build` and then separately invoke `build/install/lf-cli/bin/lfc`.
4646

4747
## IDE Integration

docs/installation.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Lingua Franca toolchain requires Java 17 ([download from Oracle](https://www
88

99
You can use Lingua Franca:
1010

11-
- [in Visual Studio Code, using our extension](#visual-studio-code)
11+
- [in Visual Studio Code and compatible tools, using our extension](#visual-studio-code)
1212
- [using the command line](#cli-tools)
1313

1414
You can also spin up one of our pre-configured Cloud-based dev environments:
@@ -17,11 +17,11 @@ You can also spin up one of our pre-configured Cloud-based dev environments:
1717

1818
[![GH Codespace](https://github.com/codespaces/badge.svg)](<https://github.com/codespaces/new?hide_repo_select=true&repo=477928779&ref=main&skip_quickstart=true&devcontainer_path=.devcontainer%2Fnightly%2Fdevcontainer.json>)
1919

20-
Have a look at the [Lingua Franca playground](https://github.com/lf-lang/playground-lingua-franca) for more details.
20+
Have a look at the [Lingua Franca playground](https://github.com/lf-lang/playground-lingua-franca) for example programs and more details on the cloud-based dev environments.
2121

2222
## Visual Studio Code
2323

24-
Our Visual Studio Code extension can be installed via the Marketplace or built from source, as detailed below. See the [handbook](./tools/code-extension.mdx) for usage instructions.
24+
Our Visual Studio Code extension can be installed via the Marketplace or built from source, as detailed below. This extension also works with VS Code-compatible tools such as [Cursor](https://cursor.com). See the [handbook](./tools/code-extension.mdx) for usage instructions.
2525

2626
### Marketplace
2727

@@ -37,6 +37,13 @@ Alternatively, you can run the following command in your terminal:
3737
code --install-extension lf-lang.vscode-lingua-franca
3838
```
3939

40+
or
41+
42+
```
43+
cursor --install-extension lf-lang.vscode-lingua-franca
44+
```
45+
46+
4047
To use the nightly pre-release of the extension instead of the latest release, find the Lingua Franca extension in the Extensions tab and click on the "Switch to Pre-Release Version" button.
4148

4249
### From Source
@@ -56,6 +63,13 @@ Run the following command in your terminal to install the latest release (on Win
5663
curl -Ls https://install.lf-lang.org | bash -s cli
5764
```
5865

66+
If you get `permission denied`, your platform may require `sudo`, as follows:
67+
68+
```
69+
curl -Ls https://install.lf-lang.org | sudo bash -s cli
70+
```
71+
72+
5973
You can also install the nightly pre-release:
6074

6175
```
@@ -80,9 +94,7 @@ yay -S lf-cli-nightly-bin
8094

8195
### Nix and NixOS
8296

83-
The Lingua Franca compiler is packaged in [nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/compilers/lingua-franca/default.nix#L28) and is available via the binary cache.
84-
85-
Run
97+
The Lingua Franca compiler is packaged in [nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/compilers/lingua-franca/default.nix#L28) and is available via the binary cache. Run
8698
```
8799
nix shell nixpkgs#lingua-franca
88100
```

docs/introduction.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,36 @@ slug: /
66

77
Lingua Franca (LF) is a polyglot coordination language built to enrich mainstream target programming languages (currently C, C++, Python, TypeScript, and Rust) with deterministic reactive concurrency and the ability to specify timed behavior. LF is supported by a runtime system that is capable of concurrent and distributed execution of reactive programs that are deployable on the Cloud, the Edge, and even on bare-iron embedded platforms.
88

9-
A Lingua Franca program specifies the interactions between components called reactors. The logic of each reactor is written in plain target code. A code generator synthesizes one or more programs in the target language, which are then compiled using standard tool chains. If the application has exploitable parallelism, then it executes transparently on multiple cores without compromising determinacy. A distributed application translates into multiple programs and scripts to launch those programs on distributed machines. The communication fabric connecting components is synthesized as part of the programs.
9+
As you build your programs, the tools automatically generate interactive diagrams that show the components of your program. For example:
10+
11+
import RegressionTestSVG from "./assets/images/diagrams/MainReactor.svg"
12+
13+
<RegressionTestSVG title="Lingua Franca diagram: RegressionTest" role="img" width="700" />
14+
15+
A Lingua Franca program specifies the interactions between concurrent components called reactors. There are three reactors above. Each reactor contains one or more reactions, which specify code (in C, C++, Python, Rust, or TypeScript) to execute when triggered by events. Events come from timers (periodic and aperiodic), input ports, or from the environment.
16+
17+
If the application has exploitable parallelism, then it executes transparently on multiple cores or multiple machines without compromising determinacy. The above program shows a simple pipeline chain, where reactions A1, B1, and the reactions in C all can execute in parallel. The logical delays of 100 ms on connections between ports enable such parallel execution. In ReactorC, reactions C1 and C2 do not execute in parallel because they (potentially) share state variables. The deterministic semantics of LF ensures that for the above program, reaction C1 will always process the previous result of B1 (not the one being computed in parallel), which is triggered by the 200ms-old result from A1. Only after reaction C1 completes, reaction C2 will process the 200ms-old result from A1. Hence, despite the parallel execution, and even if this program is distributed across networked hosts, the computation is deterministic and repeatable.
18+
19+
The `lfc` code generator synthesizes one or more programs in the target language, which are then compiled using standard tool chains. A distributed (federated) application translates into multiple programs and scripts to launch those programs on distributed machines. The communication fabric connecting components is synthesized as part of the programs.
20+
1021

1122
## Reactor-Oriented Programming
12-
Lingua Franca programs are compositions of reactors, which are stateful
13-
components with event-triggered routines that may read inputs, write outputs, manipulate the reactor's state and schedule future events.
14-
Reactors are similar to actors, software components that send each other messages, but unlike classical actors, messages are timestamped, and concurrent composition of reactors is deterministic by default. When nondeterministic interactions are tolerable or desired, they must be explicitly coded. LF itself is a polyglot composition language, not a complete programming language. LF describes the interfaces and composition of reactors. See our [publications and presentations](/research) on reactors and Lingua Franca.
23+
Reactors are stateful components with event-triggered routines that may read inputs, write outputs, manipulate the reactor's state and schedule future events.
24+
Reactors are similar to actors, software components that send each other messages, but unlike classical actors, messages are timestamped, and concurrent composition of reactors is deterministic by default. When nondeterministic interactions are tolerable or desired, they must be explicitly coded.
25+
26+
LF itself is a polyglot composition language, not a complete programming language. LF describes the interfaces and composition of reactors. See our [publications and presentations](/research) on reactors and Lingua Franca.
1527

1628
The reactor-oriented programming paradigm is informally described via the following principles:
1729

18-
1. _Components_ — Reactors can have input ports, actions, and timers, all of which are triggers. They can also have output ports, local state, parameters, and an ordered list of reactions.
30+
1. _Components_ — Reactors can have input ports, actions, and timers, all of which are triggers. Actions are used to schedule irregular (non-periodic) events, whereas timers specify periodic events. Reactors can also have output ports, local state, parameters, and an ordered list of reactions.
1931
2. _Composition_ — A reactor may contain other reactors and manage their connections. The connections define the flow of messages, and two reactors can be connected if they are contained by the same reactor or one is directly contained in the other (i.e., connections span at most one level of hierarchy). An output port may be connected to multiple input ports, but an input port can only be connected to a single output port.
20-
3. _Events_Messages sent from one reactor to another, and timer and action events each have a tag (i.e., a timestamp), a value on a logical time line. These are tagged events that can trigger reactions. Each port, timer, and action can have at most one such event at any tag. An event may carry a value that will be passed as an argument to triggered reactions.
21-
4. _Reactions_ — A reaction is a procedure in a target language that is invoked in response to a trigger event, and only in response to a trigger event. A reaction can read input ports, even those that do not trigger it, and can produce outputs, but it must declare all inputs that it may read and output ports to which it may write. All inputs that it reads and outputs that it produces bear the same timestamp as its triggering event. I.e., the reaction itself is logically instantaneous, so any output events it produces are logically simultaneous with the triggering event (the two events bear the same timestamp).
22-
5. _Flow of Time_ — Successive invocations of any single reaction occur at strictly increasing tags. Any messages that are not read by a reaction triggered at the timestamp of the message are lost.
23-
6. _Mutual Exclusion_ — The execution of any two reactions of the same reactor are mutually exclusive (atomic with respect to one another). Moreover, any two reactions that are invoked at the same tag are invoked in the order specified by the reactor definition. This avoids race conditions between reactions accessing the reactor state variables.
32+
3. _Events_Every event has a tag (a form of timestamp), and every reactor reacts to events in tag order. When a reactor reacts to more than one event with the same tag, the reaction order is deterministic, so the results are predictable. Each port, timer, and action can have at most one event at any tag. An event may carry a value that will be passed as an argument to triggered reactions.
33+
4. _Reactions_ — A reaction is a procedure in a target language that is invoked in response to a trigger event, and only in response to a trigger event. A reaction can read input ports, even those that do not trigger it, and can produce outputs, but it must declare all inputs that it may read and output ports to which it may write. All inputs that it reads and outputs that it produces bear the same tag as its triggering event. I.e., the reaction itself is logically instantaneous, so any output events it produces are logically simultaneous with the triggering event (the two events bear the same timestamp).
34+
5. _Flow of Time_ — Successive invocations of any single reaction occur at strictly increasing tags. Any messages that are not read by a reaction triggered at the tag of the message are lost.
35+
6. _Mutual Exclusion_ — The execution of any two reactions _of the same reactor_ are mutually exclusive (atomic with respect to one another). Moreover, any two reactions that are invoked at the same tag are invoked in the order specified by the reactor definition. This avoids race conditions between reactions accessing the reactor state variables.
2436
7. _Determinism_ — A Lingua Franca program is deterministic unless the programmer explicit uses nondeterministic constructs. Given the same input data, a composition of reactors has exactly one correct behavior. This makes Lingua Franca programs _testable_.
25-
8. _Concurrency_ — Dependencies between reactions are explicitly declared in a Lingua Franca program, and reactions that are not dependent on one another can be executed in parallel on a multi-core machine. If the target provides a support for federated execution, then execution can also be distributed across networks.
37+
8. _Concurrency_ — Dependencies between reactions are explicitly declared in a Lingua Franca program, and reactions that are not dependent on one another can be executed in parallel on a multi-core machine. For targets supporting federated execution (currently C, Python, and TypeScript), execution can be distributed across networks.
38+
9. _Feedback_ - Messages can flow in feedback cycles. The compiler automatically identifies causality loops that may be introduced by the programmer. A causality loop makes it impossible for the compiler to determine an order of reaction invocation at a tag that preserves determinism.
2639

2740
## Getting Started
2841
To get started with Lingua Franca, [set up a development environment](./installation.md) and learn how to write [a first reactor](./writing-reactors/a-first-reactor.mdx). There are also a number of potentially useful [videos](./videos.mdx) available.

docs/videos.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ This page collects videos presented by the Lingua Franca team:
1414

1515
## Technical Talks
1616

17+
* [Subtlteties with Decentralized Coordination in Lingua Franca](https://youtu.be/eUoqy6BLb0A), April 24, 2025.
1718
* [Decentralized Coordination in Federated Lingua Franca](https://youtu.be/eDBOwr5iD3s?si=rVzd4wXsUGgEHmvD), Nov. 20, 2024.
1819
* [Trading Off Consistency and Availability using Lingua Franca](https://youtu.be/3lHmiWOedHM?si=6E-SU58zx6n2dT6B), Nov. 10, 2024.
20+
* [Demo of LF Package Explorer in VS Code](https://youtu.be/9EgWKMowFiI), Oct. 25, 2024.
21+
* [Lingua Franca Edge AI](https://youtu.be/f2jHLAjER-c), Jul. 11, 2024.
1922
* [Deterministic Concurrency in Cyber-Physical Systems](https://youtu.be/OA_GknXKe4g?si=ulryQ7gpVivAfoX3), June 16, 2023.
2023
* [Deterministic Concurrency and the Lingua Franca Coordination Language](https://youtu.be/GT4NJ5XnEt4?si=wzrtX72PgAtPS_Yk), April 18, 2023.
2124
* [Verifying Parallel and Distributed Systems: The Observer Problem](https://youtu.be/20EKKsdWTQ8?si=aTSiPijMw9lDVajY), Feb. 9, 2023.

src/components/HomepageFeatures/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const FeatureList: FeatureItem[] = [
2020
Svg: Determinism,
2121
description: (
2222
<Translate>
23-
Lingua Franca offers a straightforward way to write multi-threaded applications that ensure determinism by default, eliminating concerns about thread management, synchronization, and race conditions.
23+
Lingua Franca offers a straightforward way to write deterministic multi-threaded and distributed applications, eliminating concerns about thread management, synchronization, and race conditions.
2424
</Translate>
2525
),
2626
},

src/pages/index.module.css

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,7 @@
2929
color: var(--ifm-color-primary-light);
3030
}
3131

32-
@keyframes jack-in-the-box {
33-
0% {
34-
opacity: 0;
35-
transform: scale(0.1) rotate(30deg);
36-
transform-origin: center bottom;
37-
}
38-
39-
50% {
40-
transform: rotate(-10deg);
41-
}
42-
43-
70% {
44-
transform: rotate(3deg);
45-
}
46-
47-
100% {
48-
opacity: 1;
49-
transform: scale(1);
50-
}
51-
}
52-
5332
.heroLogo {
54-
animation-duration: 2s;
55-
animation-name: jack-in-the-box;
5633
float: left;
5734
margin-top: 100px;
5835
margin-right: 35px;

src/pages/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function HeroBanner() {
3232
__html: translate({
3333
id: "homepage.hero.title",
3434
message:
35-
"Build <b>time-sensitive</b>, <b>concurrent</b>, and <b>distributed</b> systems — <b>effortlessly</b>",
35+
"Build predictable <b>concurrent</b>, <b>time-sensitive</b>, and <b>distributed</b> systems.",
3636
description:
3737
"Home page hero title, can contain simple html tags",
3838
}),
@@ -44,9 +44,10 @@ function HeroBanner() {
4444
<div className={styles.subHero}>
4545
<br/>
4646
<Translate>
47-
Lingua Franca allows you to write blazing-fast, deterministic,
48-
multi-threaded and distributed code without any knowledge about threads or synchronization.
49-
Focus on your application, not elusive concurrency bugs.
47+
Lingua Franca is a coordination language for efficient, deterministic,
48+
multi-threaded, time-sensitive, embedded, and distributed programs. The result of decades
49+
of research, it offers more repeatable behavior than other concurrent programming
50+
frameworks, including threads, pub-sub, actors, and service-oriented architectures.
5051
</Translate>
5152
</div>
5253
<div className={styles.indexCtas}>
@@ -88,7 +89,7 @@ const Intro = (): JSX.Element => (
8889
<br/><br/>
8990
<Translate>
9091
Consider a game of "rock paper scissors" where two players need to reveal their choice simultaneously. In Lingua Franca, "at the same time" has a clear and precise meaning.
91-
This makes the implementation simple and intuitive, and guarantees it to be fair. If the Player class were to observe the other's choice before revealing its own, Lingua Franca's causality analysis would find a causality loop and tell you that the program was invalid.
92+
This makes the implementation simple and intuitive, and guarantees it to be fair. If the Player class were to observe the other's choice before revealing its own, Lingua Franca's causality analysis would find a causality loop and tell you that the program is invalid.
9293
</Translate>
9394
<br/><br/>
9495
<Heading as="h2">

versioned_docs/version-0.5.0/developer/downloading-and-building.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ For more details on our testing infrastructure, please refer to the [Regression
4141
If you only want to build without running any tests, you can use `./gradlew assemble` instead.
4242
Both the assemble and the build task will create a distribution package containing our command line tools in `build/distribution`.
4343
There is also an installed version of this package in `build/install/lf-cli/`.
44-
If you run `build/install/lf-cli/bin/lfc` this will run lfc as it was last build.
44+
If you run `build/install/lf-cli/bin/lfc` this will run lfc as it was last built.
4545
Thus, you can choose if you want to use `bin/lfc-dev`, which first builds `lfc` using the latest code and then runs it, or if you prefer to run `./gradlew build` and then separately invoke `build/install/lf-cli/bin/lfc`.
4646

4747
## IDE Integration

0 commit comments

Comments
 (0)