It's possible to use the exec,passthru and system functions to call external programs from a PHP script and return their output. Exec returns the output to an array rather than outputting raw data, so this may be more suitable.
The steps I would take to approach this:
1) Fetch code from textarea and write to a new C source file.
2) Use exec to pass the file to your compiler and return the output.
3) Output the array.
There may be a more elegant means of dealing with external programs but this is the best method that springs to mind.