I wanted to practice C, so I decided to write a C-interpreter in the spirit of the python interpreter. I have some C knowledge, but I've always been a learn by doing type of programmer.
What I have so far, is very simple. Just parsing the user's input, one line at a time, and distinguishing between declarations such as:
int x = 10;
char c = 'a';
where I create a struct representing the variable's type, name, and ivalue for int value and cvalue for char value. There's a lot more to go there but one step at a time.
I can also parse function calls, as such:
printf("value of x = %d\n, x);
where I extract the name of the function, and store the args in a char** args.
It sounds silly, but I would like to avoid writing a mapper for each standard c library function, in order to execute a call to something like printf or strstr or strcpy. Is there anyway to dynamically call a standard c function without this approach?
Also, suggestions on the design of this thing are very welcome.