如何在 Emacs 中为 Ocaml 生成和设置注释?
我正在使用 Emacs 用 Ocaml 编写编译器。我听说使用 -annot
可以在编译时生成文件 .annot
,这可以帮助 Emacs 显示我的代码的类型。但奇怪的是,运行这个makefile后没有生成.annot
。谁能告诉我这有什么问题吗?
另外,一旦我获得了 .annot
,我是否需要设置任何内容(例如 .emacs
?)以便我的 Emacs 读取它并显示我的代码类型?
非常感谢!
Edit1:在 make clean
和 make
之后,我得到了 .annot
...但我仍然不知道如何使用它Emacs 中的 .annot
。
Edit2:实际上有必要遵循这个链接,复制文件在本地文件夹中,然后更新 .emacs
。然后,当在 Emacs 中编辑 .ml
时,Cc Ct 从 .annot
返回其类型。
I am writing a compiler in Ocaml with Emacs. I am told that with -annot
a file .annot
could be generated while compiling, which could help Emacs to show the type of my code. But it is odd that no .annot
is generated after running this makefile. Could anyone tell me what is wrong with that?
Also, once i have got .annot
, do I need to set up anything (for instance .emacs
?) so that my Emacs read it and show the type of my code?
Thank you very much!
Edit1: after make clean
and make
, I have got the .annot
... But I still do not know how to make use of this .annot
in Emacs.
Edit2: actually it is necessary to follow this link, copy the files in a local folder, then update .emacs
. Then when a .ml
is edited in Emacs, C-c C-t returns its type from .annot
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关于您的 emacs 查询——我不使用 emacs——,这是来自
ocamlc
的手册页,线程中还有其他工具我之前提到过。
至于
Makefile
没有创建.annot
文件,我创建了一个模拟目录并成功创建了.annot
文件。我也没有发现你的Makefile
有什么问题。您可能想要清理目录并重试,或者切换到另一种方式来构建您的工具,例如ocamlbuild
——这需要最少的设置,不过,我还没有将它与menhir 一起使用
。我还要指出
-annot
是新的自 OCaml 3.11.0 起,之前的标志为-dtypes
。Regarding your emacs inquiry --I don't use emacs--, this is from the man-pages for
ocamlc
,There are also other tools from the thread I mentioned previously.
As for the
Makefile
not creating the.annot
files, I made a mock directory and successfully had.annot
files created. I also don't see anything wrong with yourMakefile
. You may want to clean the directory and try again, or switch to another way to build your tool likeocamlbuild
--which would require minimal setup, although, I haven't used it withmenhir
.I will also note that
-annot
is new since OCaml 3.11.0, and prior the flag was-dtypes
.