Interpreter for a flight simulator coding language, made with CPP. GitHub repository link: Here
This program interprets a programming language that was created in order to control "[FlightGear]" (https://www.flightgear.org/) flight simulator. The program connects to the flight simulator both as client and server. The client will send the simulator instructions that were coded in the script. That allows us to control our flight vessel with code. The server will get live data about the flight.
This program was developed by Gadi Didi and Ori Levy, CS students from Bar-Ilan university, Israel.
-
Connect to the simulator as a client, and send instructions to the simulator.
-
Connect the simulator as client, and get real live data from your flight.
-
Interpret code and translate it into flight insructions.
-
Interpret arithmetic expressions (Divide, Multiply, Plus, Minus) using Shunting-Yard algorithm.
-
Function definition and usage of functions are supported.
-
Nested loops and if statements are supported.
-
Insert the file generic_small.xml (can be found inside the repository) into the following path:
[FlightGear installation path]/data/protocol
-
Start with adding the following lines into the additional setting in FlightGear:
--generic=socket,out,10,127.0.0.1,5400,tcp,generic_small --telnet=socket,in,10,127.0.0.1,5402,tcp
You can choose IP and Port as desired, but you should keep LocalHost IP if you're running both the program and the simulator on the same PC.
-
Complie the program code:
g++ -std=c++14 *.cpp -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -o a.out
-
Run a.out with the relative path of the code you want to execute as the first argument (Should be in txt file).
-
The program will wait for you to open the FlightGear simulator and start a flight.
-
Look at the simulator and enjoy your flight.
- Please find the file: "fly_with_func" in the repository as an example to a valid script, you can go ahead and execute it.