Nuo-Math-Compiler-en

The Nuo-Math-Compiler is a simple compiler for a small self-defined mathematical expression language. It performs lexical analysis, syntax analysis, and semantic analysis on input expressions, and output the json files of each phase. You can see the project requirement for more details.

We provide a sample implementation in sample/ folder for your reference, and test/ folder with various test cases.

Set Up

  1. Clone this repository
git clone git@gitee.com:nuo534202/nuo-math-compiler.git
cd Nuo-Math-Compiler
  1. Build and Run
  • Use Makefile

    make
    ./nuo-math-compiler sample
    
  • Use CMakeLists.txt

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

    The builder will automatically copy the parsing_table.csv and sample files from lib/ folder to the build folder.

nuo-math-compiler is the executable file for the compiler. You can run it with the sample input file sample as shown above. The input file is recommended to name with no suffix, and output files are sample_lexer.json, sample_parser.json, sample_ast.json, and sample_type.json.

Code of Conduct

Code of Conduct

Contributing

Contributing Guidelines

License

Nuo-Math-Compiler is for learning and practice purpose, so it is under MIT License.

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