This Rust project is a C++ function parser that converts C++ function code from an input file into a JSON representation. The output is saved in output.json
.
To run the project, follow these steps:
-
Make sure you have Rust and Cargo installed on your system.
-
Clone the repository or download the source code.
-
Navigate to the project directory in your terminal.
-
Run the following command to build the project:
cargo build
This will compile the Rust project and its dependencies.
-
Create an
input.cpp
file in the project folder. This file should contain the C++ function code you want to convert. -
Run the following command in your terminal:
cargo run -- input.cpp
This will execute the Rust project and convert the C++ function code from the
input.cpp
file. -
After running the command, the project will generate the output in the
output.json
file, which will contain the JSON representation of the C++ function code.
Suppose you have the following C++ function code in the input.cpp
file:
#include <iostream>
int main() {
std::cout << "Hello, World!";
return 0;
}
Running the command cargo run -- input.cpp
will generate the output.json
file with the following content:
{
"function": "#include <iostream>\n\nint main() {\n std::cout << \"Hello, World!\";\n return 0;\n}"
}
- Rust (and Cargo) installed on your system
This project is licensed under the MIT License.