Build a Lingua Franca based traffic light controller! Go directly to the exercises here
- Linux, macOS or Windows Subsystem for Linux (WSL).
- A Ubuntu VM with everything installed can also be downloaded here
- git
- A C compiler such as
gcc
orclang
- A recent version of
cmake
- GNU make
- Java 17 (or greater)
- Ubuntu:
sudo apt install openjdk-17-jdk
- macOS
brew install openjdk@17
orsudo port install openjdk17
- Or download here: https://www.oracle.com/java/technologies/downloads/#java17
- Ubuntu:
For more information on the prerequisites, see https://www.lf-lang.org/docs/installation
git clone [email protected]:erlingrj/lf-traffic-light.git
or
git clone https://github.com/erlingrj/lf-traffic-light.git
Install Microsoft VSCode (https://code.visualstudio.com/).
Open the cloned repo in VSCode, e.g. in the same terminal as you ran the git clone command, do:
code lf-traffic-light
Navigate to the Extension Marketplace:
Find and install the Lingua Franca extension:
Open HelloWorld.lf
Inspect the auto-generated diagram by pressing this button:
And run the program by pressing the Play button
The program output is printed to the integrated terminal.
If you have installed VSCode and the extension, you can skip this section.
If you wish to use another code editor, or just want to interact directly with the command line tools, they can be installed by our convenience install script:
curl -Ls https://install.lf-lang.org | bash -s cli
This will install lfc
to $HOME/.local/bin
, make sure this is on your system path, e.g. by
adding the following to the end of your ~/.bashrc
export PATH=$PATH:$HOME/.local/bin
Now you can manually compile the HelloWorld.lf from the command line with:
lfc src/HelloWorld.lf
Run the resulting binary with
bin/HelloWorld
Generate the diagram by:
lfd src/HelloWorld.lf
This will produce an SVG called HelloWorld.svg.
Finally, you can verify that everything is correctly installed with:
make all
Download a preconfigured Ubuntu VM here
The username and password are both ubuntu
.
After logging in, fetch the most recent changes to the tutorial and verify the setup.
cd ~/lf-traffic-light
git pull
make all
VScode will be installed with the Lingua Franca extension so you can interact with the auto-synthesized diagrams.
Now that your setup is done and verified you can move on to the actual exercises