arXivDaily arXiv每日学术速递 周一至周五更新
arXiv cs/0605104cs.PL
收藏

解析转换LR(1)语言

Parsing Transformative LR(1) Languages

Blake Hegerle

摘要:

我们认为,作为一种手段,使程序设计语言更灵活和强大的分析算法,其中分析器可以自由地修改语法,同时分析。我们特别感兴趣的是,在一个修改的规范LR(1)分析算法,在减少某些产品后,我们检查到目前为止看到的源句子,以确定语法使用继续分析。沿着这些路线对规范LR(1)解析算法进行的天真修改不能保证停止;因此,我们开发了一个测试,它在语法变化时检查语法,如果语法变化的方式使解析器先前的假设无效,则停止解析。有了这个测试,我们可以开发我们的解析算法并证明它是正确的。这样做,我们转向早期的相关工作;程序设计语言的想法,它可以扩展到包括新的语法结构几乎已经存在,只要高级程序设计语言的想法。早期构建这样一种程序设计语言的努力受到了不成熟的形式语言理论的阻碍。最近构建转换语言的努力要么依赖于一个低效的源到源翻译链;要么它们有一个缺陷,存在于我们的天真解析算法中,因为它们无法停止。本算法不具有这些不期望的属性,因此,它应该证明是一种新的程序设计语言的有用的基础。

英文摘要:

We consider, as a means of making programming languages more flexible and powerful, a parsing algorithm in which the parser may freely modify the grammar while parsing. We are particularly interested in a modification of the canonical LR(1) parsing algorithm in which, after the reduction of certain productions, we examine the source sentence seen so far to determine the grammar to use to continue parsing. A naive modification of the canonical LR(1) parsing algorithm along these lines cannot be guaranteed to halt; as a result, we develop a test which examines the grammar as it changes, stopping the parse if the grammar changes in a way that would invalidate earlier assumptions made by the parser. With this test in hand, we can develop our parsing algorithm and prove that it is correct. That being done, we turn to earlier, related work; the idea of programming languages which can be extended to include new syntactic constructs has existed almost as long as the idea of high-level programming languages. Early efforts to construct such a programming language were hampered by an immature theory of formal languages. More recent efforts to construct transformative languages relied either on an inefficient chain of source-to-source translators; or they have a defect, present in our naive parsing algorithm, in that they cannot be known to halt. The present algorithm does not have these undesirable properties, and as such, it should prove a useful foundation for a new kind of programming language.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑