使用 Antlr 进行源代码补全是否可行? [英] Is it feasible to use Antlr for source code completion?

查看:28
本文介绍了使用 Antlr 进行源代码补全是否可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这个问题是否有效,因为我对源代码解析不是很熟悉.我的目标是为一种现有的编程语言(语言X")编写一个源代码完成函数,以供学习之用.Antlr(v4) 是否适合这样的任务,还是应该手动完成必要的 AST/解析树创建和解析,假设不存在现有解决方案?

I don't know, if this question is valid since i'm not very familiar with source code parsing. My goal is to write a source code completion function for one existing programming language (Language "X") for learning purposes. Is Antlr(v4) suitable for such a task or should the necessary AST/Parse Tree creation and parsing be done by hand, assuming no existing solutions exists?

除了编译器书籍列表之外,我还没有找到关于该特定主题的太多信息,除了编译器不是我所追求的.

I haven't found much information about that specific topic, except a list of compiler books, except a compiler is not what i'm after for.

推荐答案

GoWorks 中的代码补全完全是使用 ANTLR 4 实现的.下面的视频展示了这个代码补全引擎的补全级别.代码完成示例从 5 分钟到视频结束.

The code completion in GoWorks is completely implemented using ANTLR 4. The following video shows the level of completion of this code completion engine. The code completion example runs from 5 minutes through the end of the video.

Tunnel Vision Labs 的 GoWorks IDE 简介(预览版)

我多年来一直在研究代码完成算法,并且坚信没有更好的解决方案(自动或手动)可以为新语言生成代码完成解决方案,以满足我称之为高度要求的要求 -响应式代码完成.如果您对这种级别的性能或准确性不感兴趣,那么您可能更容易参与其他解决方案(我不亲自与那些人合作,因为我很容易对结果感到失望).

I have been working on code completion algorithms for many years, and strongly believe that there is no better solution (automated or manual) for producing a code completion solution for a new language that meets the requirements for what I would call highly-responsive code completion. If you are not interested in that level of performance or accuracy, other solutions may be easier for you to get involved with (I don't work with those personally, because I am too easily disappointed in the results).

这篇关于使用 Antlr 进行源代码补全是否可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆