A lightweight command-line tool that compiles and runs single-source files in C, C++, or Python. Designed for quick testing and simple workflows, this utility validates input, handles compilation, and executes code with user-friendly prompts and error messages.
.
โโโ bin/ # Final compiled executable goes here (e.g., compiler)
โโโ input/ # Input source files (.c, .cpp, .py)
โโโ output/ # Output directory for compiled executables
โโโ src/
โ โโโ main.cpp # Main logic and user interaction
โ โโโ header.hpp # Function declarations and macros
โ โโโ header.cpp # Implementation for file checks and validation
โโโ README.md # Project documentation (youโre reading it!)
To compile the runner, use the following command:
g++ src/main.cpp src/header.cpp -std=c++17 -o bin/compilerโ Make sure all the
bin/,input/andoutput/directories exists before running the command. If it doesnโt, create it with:
mkdir bin input outputOnce compiled and folders are ready, run the tool using:
./bin/compiler- โ Supports C, C++, and Python
- ๐ง Validates filenames to prevent invalid or reserved names (cross-platform)
- ๐ Automatically detects source files in a predefined
input/directory - ๐จ Uses colored terminal output for better feedback
- ๐ Exception-safe with detailed error handling
โ ๏ธ Single-file compilation only
Through this project, I gained hands-on experience with:
- Managing files and directories using
std::filesystem - Using
std::regexto validate filenames and user input - Parsing strings with
stringstreamandgetline - Implementing platform-independent logic (e.g., path separators)
- Writing modular C++ code with headers and source files
- Handling errors safely with
try-catchblocks - Understanding how different languages are compiled or interpreted
This small project brought together many core C++ concepts and taught me how to design a usable, extensible tool from scratch.
Although currently designed for single-file compilation, the structure makes it easy to extend:
- ๐ง Add more languages: Java, C#, JavaScript, Go, Rust, etc.
- ๐งช Integrate with judge systems: As the execution core for an auto-grader or Online Judge platform
- ๐๏ธ Support multi-file builds: By scanning and compiling all relevant
.cppand.hfiles - ๐ Add UI or Web Interface: Wrap with a GUI (Qt) or browser front-end
- ๐ Improve security: Replace
system()with safer process execution mechanisms
This makes the tool not just a project, but a solid foundation for future software development tooling.
GPT-4o is used for:
- Modular structure and cross-platform design ideas
- Regex-based filename validation (Windows/Linux safe)
- Clean command-line prompts and error handling
- README writing, formatting, and project clarity