免费语法:面向Ad Hoc语法分析器的语法推理
Grammars for Free: Toward Grammar Inference for Ad Hoc Parsers
摘要:
特设解析器无处不在:它们出现在任何时候,一个字符串被分割,循环,解释,转换,或以其他方式处理。每一个特别的解析器都会产生一种语言:程序接受而不会出错的可能无限的输入字符串集合。任何语言都可以用形式语法来描述:一组有限的规则,可以生成该语言的所有字符串。但是程序员并不为专门的解析器编写语法--即使它们非常有用。语法可以作为文档,帮助程序理解,生成测试输入,并允许对语言理论安全性进行推理。我们提出了一个自动语法推理系统的特设解析器,使所有这些用例,除了挖掘软件库和双向解析器合成开辟了新的可能性。
英文摘要:
Ad hoc parsers are everywhere: they appear any time a string is split, looped over, interpreted, transformed, or otherwise processed. Every ad hoc parser gives rise to a language: the possibly infinite set of input strings that the program accepts without going wrong. Any language can be described by a formal grammar: a finite set of rules that can generate all strings of that language. But programmers do not write grammars for ad hoc parsers -- even though they would be eminently useful. Grammars can serve as documentation, aid program comprehension, generate test inputs, and allow reasoning about language-theoretic security. We propose an automatic grammar inference system for ad hoc parsers that would enable all of these use cases, in addition to opening up new possibilities in mining software repositories and bi-directional parser synthesis.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。