Is there a REPL for C programming?

Seems like the code of c-repl can now be found at a Github repository. It seems to be a dead project, though (last commit was 3 years ago), so I'd suggest looking into alternatives as well:

  • CINT Archived old official page from web.archive.org or "Masaharu Goto" CINT page
  • ccons Github or code.google
  • Cling, successor of CINT, but only supports C++ (which might or might not be a problem, depending on what features you need)

gdb makes a pretty good REPL. You can't define new functions there, but you can evaluate expressions (including those with side effects).


Just found the IGCC (Interactive GCC) REPL. I like it.

Example:

./igcc

g++> int a = 1, b = 2;
g++> printf("%d\n", a + b);
3
g++> 

And it gives you compile errors like this:

g++> c = 3;
[Compile error - type .e to see it.]
g++> .e
<stdin>:14:1: error: use of undeclared identifier 'c'
c = 3;
^

(SF download: http://sourceforge.net/projects/igcc/files/)