You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/target-language-details.mdx
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -199,7 +199,7 @@ To have Lingua Franca generate C code, start your `.lf` file with one of the fol
199
199
200
200
Note that for all LF statements, a final semicolon is optional. If you are writing your code in C, you may want to include the final semicolon for uniformity.
201
201
202
-
For options to the target specification, see [detailed documentation of the target options](../introduction).
202
+
For options to the target specification, see [detailed documentation of the target options](../introduction.md).
203
203
204
204
The second form, `CCpp`, is used when you wish to use a C++ compiler to compile
205
205
the generated code, thereby allowing your C reactors to call C++ code.
@@ -238,7 +238,7 @@ To have Lingua Franca generate C++ code, start your `.lf` file with the followin
238
238
239
239
Note that for all LF statements, a final semicolon is optional. If you are writing your code in C++, you may want to include the final semicolon for uniformity.
240
240
241
-
For options to the target specification, see [detailed documentation of the target options](../introduction).
241
+
For options to the target specification, see [detailed documentation of the target options](../introduction.md).
242
242
243
243
</ShowIf>
244
244
<ShowIfpy>
@@ -251,7 +251,7 @@ To have Lingua Franca generate Python code, start your `.lf` file with the follo
251
251
252
252
Note that for all LF statements, a final semicolon is optional.
253
253
254
-
For options to the target specification, see [detailed documentation of the target options](../introduction).
254
+
For options to the target specification, see [detailed documentation of the target options](../introduction.md).
255
255
256
256
</ShowIf>
257
257
<ShowIfts>
@@ -264,7 +264,7 @@ To have Lingua Franca generate TypeScript code, start your `.lf` file with the f
264
264
265
265
Note that for all LF statements, a final semicolon is optional.
266
266
267
-
The supported target parameters and command-line options are documented in the [Target Declaration](../introduction) documentation.
267
+
The supported target parameters and command-line options are documented in the [Target Declaration](../introduction.md) documentation.
A suite of useful functions is provided in [util.h](https://www.lf-lang.org/reactor-c/d8/d3c/util_8h.html) for producing messages to be made visible when the generated program is run. Of course, you can always use `printf`, but this is not a good choice for logging or debug information, and it is not a good choice when output needs to be redirected to a window or some other user interface (see for example the [sensor simulator](https://github.com/lf-lang/reactor-c/blob/main/util/sensor_simulator.h)). Also, in federated execution, these functions identify which federate is producing the message. The functions are listed below. The arguments for all of these are identical to `printf` with the exception that a trailing newline is automatically added and therefore need not be included in the format string.
2732
2732
2733
-
-`LF_PRINT_DEBUG(format, ...)`: Use this for verbose messages that are only needed during debugging. Nothing is printed unless the [target](<../introduction#logging>) parameter `logging` is set to `debug`. THe overhead is minimized when nothing is to be printed.
2733
+
-`LF_PRINT_DEBUG(format, ...)`: Use this for verbose messages that are only needed during debugging. Nothing is printed unless the [target](<../introduction.md#logging>) parameter `logging` is set to `debug`. THe overhead is minimized when nothing is to be printed.
2734
2734
2735
-
-`LF_PRINT_LOG(format, ...)`: Use this for messages that are useful logs of the execution. Nothing is printed unless the [target parameter `logging`](<../introduction#logging>) is set to `log` or `debug`. This is a macro so that overhead is minimized when nothing is to be printed.
2735
+
-`LF_PRINT_LOG(format, ...)`: Use this for messages that are useful logs of the execution. Nothing is printed unless the [target parameter `logging`](<../introduction.md#logging>) is set to `log` or `debug`. This is a macro so that overhead is minimized when nothing is to be printed.
2736
2736
2737
-
-`lf_print(format, ...)`: Use this for messages that should normally be printed but may need to be redirected to a user interface such as a window or terminal (see `register_print_function` below). These messages can be suppressed by setting the [logging target property](<../introduction#logging>) to `warn` or `error`.
2737
+
-`lf_print(format, ...)`: Use this for messages that should normally be printed but may need to be redirected to a user interface such as a window or terminal (see `register_print_function` below). These messages can be suppressed by setting the [logging target property](<../introduction.md#logging>) to `warn` or `error`.
2738
2738
2739
-
-`lf_print_warning(format, ...)`: Use this for warning messages. These messages can be suppressed by setting the [logging target property](<../introduction#logging>) to `error`.
2739
+
-`lf_print_warning(format, ...)`: Use this for warning messages. These messages can be suppressed by setting the [logging target property](<../introduction.md#logging>) to `error`.
2740
2740
2741
-
-`lf_print_error(format, ...)`: Use this for error messages. These messages are not suppressed by any [logging target property](<../introduction#logging>).
2741
+
-`lf_print_error(format, ...)`: Use this for error messages. These messages are not suppressed by any [logging target property](<../introduction.md#logging>).
2742
2742
2743
2743
-`lf_print_error_and_exit(format, ...)`: Use this for catastrophic errors.
2744
2744
@@ -2771,7 +2771,7 @@ Which type of messages are actually produced by the compiled program can be cont
2771
2771
</ShowIf>
2772
2772
<ShowIfpy>
2773
2773
2774
-
The Python supports the [logging](<../introduction#logging>) target specification. This will cause the runtime to produce more or less information about the execution. However, user-facing functions for different logging levels are not yet implemented (see issue [#619](https://github.com/lf-lang/lingua-franca/issues/619)).
2774
+
The Python supports the [logging](<../introduction.md#logging>) target specification. This will cause the runtime to produce more or less information about the execution. However, user-facing functions for different logging levels are not yet implemented (see issue [#619](https://github.com/lf-lang/lingua-franca/issues/619)).
2775
2775
2776
2776
</ShowIf>
2777
2777
<ShowIfts>
@@ -2788,7 +2788,7 @@ The executable reacts to the environment variable `RUST_LOG`, which sets the log
2788
2788
2789
2789
Error and warning logs are on by default. Enabling a level enables all greater levels (i.e., `RUST_LOG=info` also enables `warn` and `error`, but not `trace` or `debug`).
2790
2790
2791
-
Logging can also be turned on with the `--log-level` CLI option, if the application features a [CLI](<../introduction#command-line-arguments>).
2791
+
Logging can also be turned on with the `--log-level` CLI option, if the application features a [CLI](<../introduction.md#command-line-arguments>).
2792
2792
2793
2793
Note that the `logging` target property is ignored, as its levels do not match the Rust standard levels we use (those of the [`log` crate](https://docs.rs/log/)).
2794
2794
@@ -2962,7 +2962,7 @@ primitives and sleep functions.
2962
2962
2963
2963
### Multithreaded Implementation
2964
2964
2965
-
By default, the C runtime system uses multiple worker threads in order to take advantage of multicore execution. The number of worker threads will match the number of cores on the machine unless the `workers` argument is given in the [target](<../introduction#threading>) statement or the `--workers`[command-line argument](<../introduction#command-line-arguments>) is given.
2965
+
By default, the C runtime system uses multiple worker threads in order to take advantage of multicore execution. The number of worker threads will match the number of cores on the machine unless the `workers` argument is given in the [target](<../introduction.md#threading>) statement or the `--workers`[command-line argument](<../introduction.md#command-line-arguments>) is given.
2966
2966
2967
2967
Upon initialization, the main thread will create the specified number of worker threads.
2968
2968
Execution proceeds in a manner similar to the [single threaded implementation](#single-threaded-implementation)
@@ -2971,17 +2971,17 @@ The execution algorithm ensures that no reaction executes until all reactions th
2971
2971
2972
2972
### Single Threaded Implementation
2973
2973
2974
-
By giving the `single-threaded`[target option](<../introduction#single-threaded>) or the `--single-threaded`[command-line argument](<../introduction#command-line-arguments>), the generated program will execute the program using only a single thread. This option is most useful for creating programs to run on bare-metal microprocessors that have no threading support. On such platforms, mutual exclusion is typically realized by disabling interrupts.
2974
+
By giving the `single-threaded`[target option](<../introduction.md#single-threaded>) or the `--single-threaded`[command-line argument](<../introduction.md#command-line-arguments>), the generated program will execute the program using only a single thread. This option is most useful for creating programs to run on bare-metal microprocessors that have no threading support. On such platforms, mutual exclusion is typically realized by disabling interrupts.
2975
2975
2976
2976
The execution strategy is to have two queues of pending accessor invocations, one that is sorted by
2977
2977
tag (the **event queue**) and one that is sorted by priority (the **reaction queue**).
2978
2978
Execution proceeds as follows:
2979
2979
2980
2980
1. At initialization, an event for each timer is put on the event queue and logical time is initialized to the current time, represented as the number of nanoseconds elapsed since January 1, 1970.
2981
2981
2982
-
2. At each logical time, pull all events from event queue that have the same earliest tag, find the reactions that these events trigger, and put them on the reaction queue. If there are no events on the event queue, then exit the program (unless the `--keepalive true`[command-line argument](<../introduction#command-line-arguments>) is given).
2982
+
2. At each logical time, pull all events from event queue that have the same earliest tag, find the reactions that these events trigger, and put them on the reaction queue. If there are no events on the event queue, then exit the program (unless the `--keepalive true`[command-line argument](<../introduction.md#command-line-arguments>) is given).
2983
2983
2984
-
3. Wait until physical time matches or exceeds that earliest timestamp (unless the `--fast true`[command-line argument](<../introduction#command-line-arguments>) is given). Then advance logical time to match that earliest timestamp.
2984
+
3. Wait until physical time matches or exceeds that earliest timestamp (unless the `--fast true`[command-line argument](<../introduction.md#command-line-arguments>) is given). Then advance logical time to match that earliest timestamp.
2985
2985
2986
2986
4. Execute reactions in order of priority from the reaction queue. These reactions may produce outputs, which results in more events getting put on the reaction queue. Those reactions are assured of having lower priority than the reaction that is executing. If a reaction calls `lf_schedule()`, an event will be put on the event queue, not the reaction queue.
2987
2987
@@ -2995,7 +2995,7 @@ Unlike the C target, the Cpp target implements more of the analysis and setup of
2995
2995
</ShowIf>
2996
2996
<ShowIfpy>
2997
2997
2998
-
The Python target is built on top of the C runtime to enable maximum efficiency where possible. It uses the single-threaded C runtime by default but will switch to the multi-threaded C runtime if a physical action is detected. The [threading](<../introduction#threading>) target property can be used to override this behavior.
2998
+
The Python target is built on top of the C runtime to enable maximum efficiency where possible. It uses the single-threaded C runtime by default but will switch to the multi-threaded C runtime if a physical action is detected. The [threading](<../introduction.md#threading>) target property can be used to override this behavior.
2999
2999
3000
3000
Running [lfc](../tools/command-line-tools.mdx) on a `XXX.lf` program that uses the Python target specification on a
3001
3001
Linux machine will create the following files (other operating systems will have
@@ -3347,11 +3347,11 @@ target Rust {
3347
3347
}
3348
3348
```
3349
3349
3350
-
See [Target Declaration](../introduction) for the full list of supported target properties.
3350
+
See [Target Declaration](../introduction.md) for the full list of supported target properties.
3351
3351
3352
3352
### The Executable
3353
3353
3354
-
The executable name is the name of the main reactor _transformed to snake_case_: `main reactor RustProgram` will generate `rust_program`. See [Command-Line Arguments](<../introduction#command-line-arguments>) for details.
3354
+
The executable name is the name of the main reactor _transformed to snake_case_: `main reactor RustProgram` will generate `rust_program`. See [Command-Line Arguments](<../introduction.md#command-line-arguments>) for details.
Copy file name to clipboardExpand all lines: docs/reference/tracing.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ import {
13
13
14
14
Tracing is a powerful tool when it comes to analysis and debugging of applications. Unfortunately, most tracing tools that are readily available are designed specifically for analyzing processes, threads and system calls. Specialized tools are required to enable analysis that is tailored to an alternative model of computation such as Reactors. The tools should be capable of understanding the fundamental concepts of the model, such as the distinction between logical and physical time, as well as structural units such as reactors and reactions. This page gives an overview of the currently supported trace mechanism, as well as an outline of alternative tools that could be useful in the future.
15
15
16
-
Tracing is different from [logging](<../introduction#logging>). Logging produces human-readable output in textual form and incurs significant overhead. Tracing produces binary data that must be further processed to be useful and is designed to have minimal impact on the execution time of a program.
16
+
Tracing is different from [logging](<../introduction.md#logging>). Logging produces human-readable output in textual form and incurs significant overhead. Tracing produces binary data that must be further processed to be useful and is designed to have minimal impact on the execution time of a program.
17
17
18
18
Tracing is currently supported in the C, Python, and C++ targets. The mechanism used in C and Python is different from that used in C++. Tracing in C++ requires third-party tools that may only be available in Linux. Tracing in C and Python does not require any third-party tools.
Every Lingua Franca program begins with a [target declaration](../introduction) that specifies the language in which reactions are written. This is also the language of the program(s) generated by the Lingua Franca code generator.
26
+
Every Lingua Franca program begins with a [target declaration](../introduction.md) that specifies the language in which reactions are written. This is also the language of the program(s) generated by the Lingua Franca code generator.
27
27
28
28
Every LF program also has a `main` or `federated` (depending on the target support) reactor, which is the top level of a hierarchy of contained and interconnected reactors. The above simple example has no contained reactors.
Copy file name to clipboardExpand all lines: docs/writing-reactors/actions.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -133,7 +133,7 @@ Action triggered at logical time 603669000 nsec after start.
133
133
...
134
134
```
135
135
136
-
Here, logical time is lagging physical time by a few milliseconds. Note that, unless the [fast option](<../introduction#fast>) is given, logical time _t_ chases physical time _T_, so _t_ < _T_. Hence, the event being scheduled in the reaction to input `x` is assured of being in the future in logical time.
136
+
Here, logical time is lagging physical time by a few milliseconds. Note that, unless the [fast option](<../introduction.md#fast>) is given, logical time _t_ chases physical time _T_, so _t_ < _T_. Hence, the event being scheduled in the reaction to input `x` is assured of being in the future in logical time.
137
137
138
138
Whereas logical actions are required to be scheduled within a reaction of the reactor that declares the action, physical actions can be scheduled by code that is outside the Lingua Franca system. For example, some other thread or a callback function may call `schedule()`, passing it a physical action. For example:
Copy file name to clipboardExpand all lines: docs/writing-reactors/termination.mdx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ We address each of these in turn.
29
29
30
30
## Timeout
31
31
32
-
The [target property `timeout`](<../introduction#timeout>) specifies the last logical time at which reactions should be triggered. The last invocation of reactions will be at tag (`timeout`, 0).
32
+
The [target property `timeout`](<../introduction.md#timeout>) specifies the last logical time at which reactions should be triggered. The last invocation of reactions will be at tag (`timeout`, 0).
33
33
34
34
There is a significant subtlety when using [physical connections](<../writing-reactors/composing-reactors.mdx#physical-connections>), which are connections using the syntax `~>`. Such connections specify that the tag at the receiving end will be based on the physical time at which the message is received. If the tag assigned at the receiving end is greater than the final tag, then the message is lost. Hence, **messages sent near the `timeout` time are likely to be lost!**
Copy file name to clipboardExpand all lines: docs/writing-reactors/time-and-timers.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ import {
15
15
16
16
A key property of Lingua Franca is **logical time**. All events occur at an instant in logical time. By default, the runtime system does its best to align logical time with **physical time**, which is some measurement of time on the execution platform. The **lag** is defined to be physical time minus logical time, and the goal of the runtime system is maintain a small non-negative lag.
17
17
18
-
The **lag** is allowed to go negative only if the [`fast` target property](<../introduction#fast>) or the [`--fast`](<../introduction#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
18
+
The **lag** is allowed to go negative only if the [`fast` target property](<../introduction.md#fast>) or the [`--fast`](<../introduction.md#command-line-arguments>) command-line argument is set to `true`. In that case, the program will execute as fast as possible with no regard to physical time.
19
19
20
20
<ShowOnlyccpprs>
21
21
@@ -165,7 +165,7 @@ A reaction is always invoked at a well-defined logical time, and logical time do
165
165
166
166
## Timeout
167
167
168
-
By default, a Lingua Franca program will terminate when there are no more events to process. If there is a timer with a non-zero period, then there will always be more events to process, so the default execution will be unbounded. To specify a finite execution horizon, you can either specify a [`timeout` target property](<../introduction#timeout>) or a [`--timeout` command-line option](<../introduction#command-line-arguments>). For example, the following `timeout` property will cause the above timer with a period of one second to terminate after 11 events:
168
+
By default, a Lingua Franca program will terminate when there are no more events to process. If there is a timer with a non-zero period, then there will always be more events to process, so the default execution will be unbounded. To specify a finite execution horizon, you can either specify a [`timeout` target property](<../introduction.md#timeout>) or a [`--timeout` command-line option](<../introduction.md#command-line-arguments>). For example, the following `timeout` property will cause the above timer with a period of one second to terminate after 11 events:
0 commit comments