ScannerCR is a project I work on in my spare time. The goal of the project is to create a translator between C and Rust. You are welcome to use it and report any bugs or issues you find.
- Generated Code: Regardless of the project stage, the resulting code should not be used directly. It is intended merely as a guide for translating C code to Rust.
- Language Paradigms: C and Rust are based on very different paradigms, so a direct translation is not 100% possible. The output may not meet the quality standards of idiomatic Rust code, partly due to my limited experience with Rust and other influencing factors.
- Project Maturity: While some cases are functional, many parts of the project are still in development. There is a lot more work ahead, and there may be many C programming constructs that are not yet fully supported.
- Feedback: Any suggestions or error reports are welcome via GitHub issues or by emailing me at gonzalo.silvalde@gmail.com.
Make sure you have the following installed:
- gcc
- flex
- bison
Clone the repository and navigate to the project folder:
git clone https://github.com/Gonzalosilvalde/ScannerCR
cd ScannerCRCompile the project by running:
makeThere are two modes available: simple and recursive
-
Simple Mode: To translate a single C file to Rust, run:
./ScannerCR <file.c>
-
Recursive Mode: To translate a C file and any personal C files referenced in its header (e.g., files included like
#include "file2.h"or#include "file3.h"), run:./ScannerCR -r <file.c>
In recursive mode, the tool will search for the corresponding .c files for any headers included in the file. If these files are not in the same directory, they will not be translated.
For both modes, the output is currently configured to be placed in an output folder, which is created when you run make.
If you encounter any issues or have suggestions, feel free to open an issue on GitHub or reach out via email.
If you want to fix any of the issues or any bugs you see on your own, feel free to make a fork and ask for a pull request.