You chose the Python target. Work from this directory for all eight labs:
cd PythonEach lab lives in src/labN/ and has its own README with instructions.
Compile and run every program from this directory, for example:
lfc src/lab1/ReadySetReact.lf
bin/ReadySetReactlfc places a launcher script in bin/ (named after the program) and the
generated Python sources in src-gen/. Lab 8 additionally generates
fed-gen/ for its federated build. All three directories are generated and
ignored by Git.
Inside reaction bodies you write plain Python (indented consistently). The most used APIs in these labs:
| Purpose | API |
|---|---|
print(f"count {x}") |
|
| Read an input value | inp.value (guard with inp.is_present if needed) |
| Write an output | out.set(value) |
| Read/write state | self.count |
| Read a parameter | self.period |
| Elapsed logical time (ns) | lf.time.logical_elapsed() |
| Elapsed physical time (ns) | lf.time.physical_elapsed() |
| Current tag | lf.tag().time, lf.tag().microstep |
| Schedule an action | a.schedule(delay) or a.schedule(delay, value) |
| Time literals in Python code | MSEC(250), SEC(1), ... |
| Request a clean stop | lf.request_stop() |
Time values are integer nanosecond counts. Modules imported in a preamble
are accessed through self (for example, self.time.sleep(...) after
import time in the preamble). One naming note: in is a Python keyword,
so these labs name input ports inp.