Is there a REPL for C programming? [closed]

假如想象 提交于 2019-11-28 15:37:58

问题


I am on osx. I found this http://neugierig.org/software/c-repl/ but the links on that page for code seem to be broken.


回答1:


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
  • ccons
  • Cling, successor of CINT, but only supports C++ (which might or might not be a problem, depending on what features you need)



回答2:


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




回答3:


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/)



来源:https://stackoverflow.com/questions/10766900/is-there-a-repl-for-c-programming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!