This project is a C++ command-line Translator Application that stores and retrieves word translations using a Binary Search Tree (BST). The focus is on data structures, exception-safe design, and modular C++ project organization.
The application supports:
- Loading word translations from a file
- Searching for translations by key
- Displaying all stored translations in sorted order
- Binary Search Tree (BST) implementation
- Modular C++ design (separate headers and source files)
- Custom exception handling
- Makefile-based build system
- Manual memory management and defensive programming
├── Translator.cpp
├── Makefile
├── build/ # Auto-generated object files
├── include/
│ ├── BST.h
│ ├── BSTNode.h
│ ├── Dictionary.h
│ ├── WordPair.h
│ └── exceptions/
│ ├── ElementAlreadyExistsException.h
│ ├── ElementDoesNotExistException.h
│ ├── EmptyDataCollectionException.h
│ ├── UnableToInsertException.h
├── src/
│ ├── BST.cpp
│ ├── BSTNode.cpp
│ ├── Dictionary.cpp
│ ├── WordPair.cpp
│ └── exceptions/
│ ├── ElementAlreadyExistsException.cpp
│ ├── ElementDoesNotExistException.cpp
│ ├── EmptyDataCollectionException.cpp
│ ├── UnableToInsertException.cpp
└── data/
└── myDataFile.txt
- The program reads a data file containing word pairs in the format:
word:translation
- Each word pair is inserted into a BST, preventing duplicates.
- Users can:
- Enter a word to retrieve its translation
- Type
displayto print all translations in sorted order
Compile the project using the Makefile:
makeClean build artifacts:
make cleanRun the program with a data file:
./translate data/myDataFile.txtExample input:
house
tree
display
Example output:
house:casa
***Not Found!***
apple:manzana
dog:perro
house:casa
pizza:pizza
The application uses custom exceptions to handle:
- Duplicate entries
- Missing translations
- Empty dictionary operations
- Memory allocation failures
This ensures predictable and robust behavior.
This project is intentionally backend-focused and emphasizes correctness, structure, and maintainability over UI or external libraries.