使用函子的遗传Source-Code生成
Hygienic Source-Code Generation Using Functors
摘要:
现有的源代码生成工具,如Lex和Yacc,由于使用非实体代码来实现操作,因此存在实际的不便。为了防止这个问题,这样的工具可以生成封闭的函子,然后由程序员用适当的动作代码实例化。这将导致所有代码在其适当的上下文中进行类型检查,并帮助类型检查器正确地定位错误。我们已经为标准ML、OCaml和Haskell实现了基于这种技术的词法生成器和解析器生成器。
英文摘要:
Existing source-code-generating tools such as Lex and Yacc suffer from practical inconveniences because they use disembodied code to implement actions. To prevent this problem, such tools could generate closed functors that are then instantiated by the programmer with appropriate action code. This results in all code being type checked in its appropriate context, and it assists the type checker in localizing errors correctly. We have implemented a lexer generator and parser generator based on this technique for Standard ML, OCaml, and Haskell.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。