The TSLCompiler is a remake of the original TSLgenerator, a tool used to generate test cases for reference when writing test code. The reasons behind making this edition comes from the limitations of the TSLgenerator, specifically:
- There are situations when certain keywords are ignored due to precedence in the TSL grammar implemented by the TSLgenerator, with no error messages stating this occured.
- While the source code is available, there are four different codebases depending on the Operating System implementing very identical behavior, making it non-trivial to contribute changes.
- Even if the code base was consolidated into one, most of the code is hard to test automatically due to the over-reliance of static variables, and functions that do not return their results by default.
The TSLCompiler is designed to be a drop-in replacement for the TSLgenerator, honoring all of the original command-line options. However, this will reject TSL files containing syntax that would generally be accepted, albeit ignored by the TSLgenerator. This is achieved by implementing the grammar explicitly through a Lexer and Parser library.
In addition, the TSLCompiler is developed using the principles behind Test Driven Development/Behavior Driven Development to provide confidence in any proposed changes.
Finally, to remain fairly close to the original C implementation of the TSLgenerator, and to reduce memory leaks, this project utilizes C++.
Consult the manual on how to run the TSLCompiler.
It's highly recommended to download and use the pre-built binaries.
If they do not work, go to the Building section for compilation instructions.
- A C++ Compiler supporting the C++20 standard (Tested and built with Clang++ on GitHub).
- The Lexer library Flex.
- The Parser library Bison version >= 3.7.
- The fmt library, which can be installed via
meson wrap install fmt. - The Meson Build System.
- Clone this repository.
- Install MSYS2
- Open the MSYS2 CLANG64 application and change to the location of the repository.
- Install the following packages:
pacman -S bison flex mingw-w64-clang-x86_64-python mingw-w64-clang-x86_64-meson mingw-w64-clang-x86_64-openssl mingw-w64-clang-x86_64-ca-certificates mingw-w64-clang-x86_64-clang openssl ca-certificates meson git - Copy the
FlexLexer.hinto the include path for clang64 viacp /usr/include/FlexLexer.h /clang64/include/.- NOTE: This is a workaround to detect the Flex library. If someone has a better way of detecting this, help would be greatly appreciated!
- (Recommended) Install the fmt library with
meson wrap install fmt - Run
meson setup build, wherebuildis the name of the build directory.
- Install the latest versions of meson, flex and bison.
- With brew:
brew install meson bison flex
- With brew:
- Install the fmt library with
meson wrap install fmt - Run
meson setup --native-file macos-build.ini build, wherebuildis the name of the build directory.
- Install the latest versions of cmake, flex and bison.
- With apt (Ubuntu, Debian and similar):
sudo apt install libbison-dev bison flex cmake libfl-dev - With dnf (Fedora and similar):
sudo dnf install bison bison-devel flex libfl-devel cmake - With pacman (Arch Linux and similar):
sudo pacman -S flex bison cmake
- With apt (Ubuntu, Debian and similar):
- Install the latest version of clang++
- With apt (Ubuntu, Debian and similar):
sudo apt install clang - With dnf (Fedora and similar):
sudo dnf install clang - With pacman(Arch Linux and similar):
sudo pacman -S clang
- With apt (Ubuntu, Debian and similar):
- Install the latest version of meson
- With apt (Ubuntu, Debian and similar):
sudo apt install meson - With dnf (Fedora and similar):
sudo dnf install meson - With pacman(Arch Linux and similar):
sudo pacman -S meson - NOTE: If the version of meson is too old for the project, install it with
pipx install meson
- With apt (Ubuntu, Debian and similar):
- Install the fmt library with
meson wrap install fmt - Run
meson setup --native-file linux-build.ini build, wherebuildis the name of the build directory.- NOTE:
linux-build.iniexpects clang++-19 for the CI/CD. On your own, so as long as clang supports C++20, you can remove the -19.
- NOTE:
- Open the
builddirectory from theBuildingstep. - Run
meson test. - Confirm that all tests are passing as intended.
- Open the
builddirectory from theBuildingstep. - Run
meson compile. - Verify that there is now an executable in there called
tslcompilerif you're on Linux or macOS,tslcompiler.exeif you're on Windows. - Run
./tslcompiler path/to/input/file.
- For more information on available arguments, consult the Manual.