Nuo-Math-Compiler

Nuo-Math-Compiler 是一个用于小型自定义数学表达式语言的简单编译器。它对输入表达式进行词法分析、语法分析和语义分析,并输出每个阶段的 json 文件。您可以查看 项目要求 以了解更多详细信息。

我们在 sample/ 文件夹中提供了一个示例实现供您参考,而 test/ 文件夹则包含各种测试用例。

Set Up

  1. 克隆这个仓库
git clone git@gitee.com:nuo534202/nuo-math-compiler.git
cd Nuo-Math-Compiler
  1. 构建并运行
  • 使用 Makefile

    make
    ./nuo-math-compiler sample
    
  • 使用 CMakeLists.txt

    mkdir build && cd build
    cmake ..
    make
    ./nuo-math-compiler sample
    

    构建器会自动将 parsing_table.csvsample 文件从 lib/ 文件夹复制到构建文件夹目录下。

nuo-math-compiler 是编译器的可执行文件。您可以使用上面示例中的输入文件 sample 运行它。建议输入文件命名时不带后缀,输出文件分别为 sample_lexer.jsonsample_parser.jsonsample_ast.jsonsample_type.json

行为准则

行为准则

贡献

贡献指南

许可证

Nuo-Math-Compiler 是为了学习和练习,所以遵循的是 MIT 许可证

posted @ 2025-12-31 01:10  nuo534202  阅读(0)  评论(0)    收藏  举报