Is it possible to create an in game compiler for a preexisting programming language such as c++ or python?

What I would like to do is create import a programming language in order to be used to program something in game. Say for example the player is given a reactor with sensor outputs and inputs and are told to give parts of it commands depending on different conditions.

Does anyone know if this would be possible? I want to base it on real languages rather than create one just for the game, for example c++, python or maybe multiple different languages so that the player can chose what they are comfortable with or want to learn.

I know I could essentially create the language from scratch in a sudo sort of way but I think that could lead down a very dark path full of bugs and tears haha.