Author Topic: Weird ideas #5: "always on" compiler  (Read 11584 times)

kyle

  • Newbie
  • *
  • Posts: 48
    • View Profile
Weird ideas #5: "always on" compiler
« on: July 02, 2014, 12:29:03 AM »
This idea is not mine. I am not sure who came up with it.  I have seen it referenced from time to time for several years, most lately on the PiLuD mailing list.

The idea is this:

Instead of running the compiler when you have changed a file, make the compiler always run in the background and notice when a file changes. 

This can be accomplished now by combining some standard Linux tools (inotifytools etc.) with gcc/make.  But, it is not packaged all together.

So, the technology is there, but what can you do with it?  One of the ways this could work with C2 would be to trigger the compiler when a file changed.   Since C2 has a built in build system, you do not need as many extra tools. 

The inotifywait program can be run on a directory and will spit out a stream of things that changed.  This can be used with shell scripts to prototype something like this very quickly.  Now imagine that this was built in to the C2 compiler:

$> c2 --watch ~/myProject
$> cd myProject
$ myProject> vi main.c2
...

The nice part about decoupling the compiler from any IDE is that you can play with both the IDE and the compiler without worrying about the other one.  I.e. I can use vi, you can use emacs.  The compiler stays the same.

Best,
Kyle

bas

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: Weird ideas #5: "always on" compiler
« Reply #1 on: July 23, 2014, 08:07:10 AM »

it would not be very difficult to implement and this is even used in some Vi plugins that
I use. But since the actual parse/analysis time is so short (I think it should be less then
a second for large projects like the Linux kernel), there's no real gain other then integration
with an editor (like clang does).