The G-Code and M-Code that we used to instruct CNC lathe, 3d-Printers and engraving machines, to my understanding, is not a programming language, but a scripting language like Python where scripts such as G00, T01, M18 etc would instruct the micro-controller to call a functions (e.g. some numerical mathematics). Where are these functions or library of functions? Is there a ISO standard C/C++ libraries that these G-Code call from?I am trying to understand how a machine understands the G-code and where it is fetching the series of logics and movement that the G-code points to. Take Marlin firmware for example. It supposed to parse the G-code and instruct the stepper motors accordingly, but I do not fine the mathematics and the logic by going through the codes. It seems the MCU magically understands what G-Code is and compile the machine binaries and output the respective digital signal. I believe I am either misunderstanding or missing some information, which I do not find in wikipedia. 
What is involved in compiling or interpreting machine G-Code?
machine code;firmware