I don't think the example had any practical use, really. I understood it more as an illustration of how weird Chrome's scripting support is: On the one hand, it lets you put programs as complex as a working C compiler in there - but on the other hand, interaction with the outside world is limited to putting stuff into text fields...
> also, is the "input" and "output" of this compiler just code and executables?
Mostly yes. I'm not sure how much of a typical build chain he was trying to convert to JS here, but the compiler itself typically takes a bunch of files with C code and outputs a number of "object files", which are really chunks of machine code. In an actual build process, you'd then use a linker to glue those object files together in the right way and make an executable.
I guess, what you could do if you wanted was to include the whole build chain (including linker) into the PDF, encode the executable as Base64 and fill some form field of the PDF with it. Then your workflow would be as follows:
1) Write some C code
2) Copy the C code into form field #1 if the PDF.
3) Hit a "compile" button or something. Form field #2 fills with what looks like an enormous amount of random gibberish (really the Base64-encoded binary)
5) Copy all the text from form field #2, use a program of your choice to decode the Base64 and save the decoded binary on your hard drive.
6) Run the binary on your hard drive and watch your C code execute. Hooray!
> also, is the "input" and "output" of this compiler just code and executables?
Mostly yes. I'm not sure how much of a typical build chain he was trying to convert to JS here, but the compiler itself typically takes a bunch of files with C code and outputs a number of "object files", which are really chunks of machine code. In an actual build process, you'd then use a linker to glue those object files together in the right way and make an executable.
I guess, what you could do if you wanted was to include the whole build chain (including linker) into the PDF, encode the executable as Base64 and fill some form field of the PDF with it. Then your workflow would be as follows:
1) Write some C code
2) Copy the C code into form field #1 if the PDF.
3) Hit a "compile" button or something. Form field #2 fills with what looks like an enormous amount of random gibberish (really the Base64-encoded binary)
5) Copy all the text from form field #2, use a program of your choice to decode the Base64 and save the decoded binary on your hard drive.
6) Run the binary on your hard drive and watch your C code execute. Hooray!