我在哪里可以找到C-REPL文档? [英] Where can I find c-repl documentation?
问题描述
我刚刚遇到了Ubuntu C-REPL包,它提供了C语言中REPL接口。大!它是试图片段和想法相当出色,而且使用简便直观。我喜欢它。但没有文档可言的,我想了解更多关于如何推动它。
I've just come across the Ubuntu c-repl package which provides a REPL interface for C programming. Great! It is quite excellent for trying snippets and ideas, and intuitive to use. I love it. But there is no documentation at all, and I'd like to find out more about how to drive it.
例如:
> int foo( double x ) { return x+0.5;}
> foo(5.5);
> int x = foo(5.5);
> x
p x
$1 = 6
事情顺顺当当很好,但是之后:
Things are going swimmingly well but then:
> #include <stdlib.h>
<stdin>:1:22: warning: extra tokens at end of #include directive
所以我想它不这样的...
任何人都知道一个很好的教程/博客/参考的?
So I guess it doesn't like that... Anyone know of a good tutorial/blog/reference?
推荐答案
据该的在Git仓库README文件,它使用gcc来编译code和gccxml的每一行包括指令。
According to the README file on the git repository, it's using gcc to compile each line of code and gccxml for include directives.
工作原理
该方法是出奇的简单:你进入,我们code的每一行
编译在后台的共享对象。如果编译成功,
该对象通过的dlopen装入一个子进程()。的C解析
#包括
使用gccxml。 (不幸的是,我无法弄清楚如何使用
gccxml解析用户的输入,并且由于解析的C复杂
输入解析器是目前哈克和启发式。)
The approach is surprisingly simple: for each line of code you enter, we
compile a shared object in the background. If the compilation succeeds,
the object is loaded into a child process via dlopen(). Parsing of C
#includes
uses gccxml. (Unfortunately, I can't figure out how to use
gccxml to parse the user's input, and due to the complexity of parsing C
the input parser is currently hacky and heuristic.)
错误消息是同样的措辞,你用gcc得到(虽然不是与输入)之一。也许尝试无任何空白。
The error message is the same wording as the one you get with gcc ( though not with that input ). Maybe try without any whitespace.
这篇关于我在哪里可以找到C-REPL文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!