一个名为Yantra的C++解析器生成器项目近日在Hacker News上展示1。该工具采用MIT许可证,当前版本为0.5.1,使用C++23语言开发1。Yantra的核心创新在于其工作流程:先完整构建抽象语法树(AST),随后进行独立的遍历和语义动作执行,这与Yacc、Bison等传统解析器生成器在解析阶段即时执行动作的方式存在明显区别1。
该项目集成了词法分析器、模式支持等功能,并提供可选的单文件输出模式1。单个语法定义可支持多个遍历器的创建,例如同一语法可分别生成C++和Java代码1。开发者表示该项目"处于早期阶段"(版本0.5.1,pre-1.0),且目前由单一维护者负责1。
A developer has introduced Yantra, a new LALR(1) parser generator designed for C++, on Hacker News 1. The project distinguishes itself from conventional parser generators like Yacc and Bison by constructing a complete abstract syntax tree (AST) first, followed by separate traversal and semantic action execution, rather than executing actions immediately during parsing 1.
Yantra is released under the MIT license and currently stands at version 0.5.1, marking an early stage of development 1. The tool is built with C++23 and integrates a lexical analyzer, pattern support, and an optional single-file output mode 1. The developer has noted that the project is "young (0.5.1, pre-1.0) and single-maintainer, so treat it as early" 1. The implementation supports defining multiple traversals from a single grammar, enabling outputs in different languages—such as one traversal generating C++ code while another generates Java 1. The source code is available on GitHub at https://github.com/TantrixAuto/yantra 1.
评论
还没有评论,欢迎留下第一条。