c - 有C语言的解释器吗?

标签 c interpreter read-eval-print-loop

<分区>

我想知道是否有类似 C 解释器的东西。也就是说,在 Linux 终端中我可以输入“python”,然后在该解释器中编写代码。 (我不确定解释正确的词)。这对于测试不同的东西真的很有帮助,我很好奇 C 是否存在类似的东西。虽然我对此表示怀疑。我唯一能想到的就是 C shell...

最佳答案

There are many - 如果您缩小问题范围,我们或许可以针对您的需求提出一些具体建议。

著名的解释器是“Ch: A C/C++ Interpreter for Script Computing”,详见 Dr. Dobbs:

Ch is a complete C interpreter that supports all language features and standard libraries of the ISO C90 Standard, but extends C with many high-level features such as string type and computational arrays as first-class objects.

Ch standard is freeware但不是开源的。只有 Ch professional 具有绘图功能和其他人们可能需要的功能。

我以前从未看过这个,但手头有一个 c 解释器听起来非常有用,而且我可能会添加到我的工具集中。谢谢提问!


编辑:

刚发现我最喜欢的编译器之一,TCC , 将执行 C 脚本:

It also handles C script files (just add the shebang line "#!/usr/local/bin/tcc -run" to the first line of your C source code file on Linux to have it executed directly.

TCC can read C source code from standard input when '-' is used in place of 'infile'. Example:

echo 'main(){puts("hello");}' | tcc -run -

关于c - 有C语言的解释器吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/584714/

相关文章:

c++ - 从堆执行指令

python - 为 python 脚本设置默认解释器

Python命令解释器

emacs - 如何使用 ielm 在 Emacs lisp 中打印字符串?

node.js - 在 Emacs 中使用带有 JS-comint 的 Node.js

c - Linux/C : Redirecting Pipes to STDIN/STDOUT

c - 将 trie 保存到文件 - C

lisp - 如何使用 telnet 在低级别与 Swank 服务器进行交互?

c - 为使用 C 和 Haskell 的项目构建系统

c++ - llvm 解释器可以处理 c++ 异常吗?