How exactly does someone create an engine in C++?

I'm not talking about only 1 thing like a game engine, I'm talking about how to make 1 in general. Like say I have a user input a string and I want an engine that processes and evaltuates an equation the user enters.

Just engines in general.