├── .clang-format ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── README.md ├── src ├── common │ ├── buildin.hpp │ ├── config.cpp │ ├── config.h │ └── value.hpp ├── compiler │ ├── ast │ │ ├── ast.hpp │ │ ├── ast_visitor.h │ │ ├── ast_visualize.cpp │ │ ├── ast_visualize.h │ │ ├── expr.hpp │ │ └── stmt.hpp │ ├── bytecode │ │ ├── bytecode_basicblock.hpp │ │ ├── bytecode_generator.cpp │ │ ├── bytecode_generator.h │ │ ├── bytecode_writer.cpp │ │ ├── bytecode_writer.h │ │ ├── peephole_optimization.cpp │ │ └── peephole_optimization.h │ ├── ir │ │ ├── basicblock.hpp │ │ ├── cfg.cpp │ │ ├── cfg.h │ │ ├── ir_generator.cpp │ │ ├── ir_generator.h │ │ └── ir_instruction.hpp │ ├── lexer.cpp │ ├── lexer.h │ ├── parser.cpp │ ├── parser.h │ ├── symbol.hpp │ └── token.hpp ├── core │ ├── bytecode_reader.cpp │ ├── bytecode_reader.h │ ├── frame.hpp │ ├── opcode.hpp │ ├── vm.cpp │ ├── vm.hpp │ └── vm_instruction.hpp ├── main.cpp └── utility │ ├── log.h │ └── utility.hpp └── test ├── in └── overall │ ├── buildin.txt │ ├── fast_pow_mod.txt │ ├── fibonacci.txt │ ├── fibonacci2.txt │ ├── prime.txt │ └── quick_sort.txt ├── out ├── basic │ ├── array.txt │ ├── func_overload.txt │ ├── loop.txt │ ├── loop2.txt │ ├── num_calc.txt │ ├── optional_semicolon.txt │ ├── string_calc.txt │ └── var.txt ├── overall │ ├── buildin.txt │ ├── comment.txt │ ├── daffodil_number.txt │ ├── fast_pow_mod.txt │ ├── fibonacci.txt │ ├── prime.txt │ ├── quick_sort.txt │ └── swap.txt └── ssa │ ├── constant_folding1.txt │ ├── constant_folding2.txt │ └── ssa1.txt ├── run_test.cpp └── testcase ├── basic ├── array.cyx ├── comment.cyx ├── func_overload.cyx ├── loop.cyx ├── loop2.cyx ├── num_calc.cyx ├── optional_semicolon.cyx ├── string_calc.cyx └── var.cyx ├── overall ├── buildin.cyx ├── daffodil_number.cyx ├── fast_pow_mod.cyx ├── fibonacci.cyx ├── fibonacci2.cyx ├── prime.cyx ├── quick_sort.cyx └── swap.cyx └── ssa ├── constant_folding1.cyx ├── constant_folding2.cyx └── ssa1.cyx /.clang-format: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/.clang-format -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/.github/workflows/build.yml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/.gitignore -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/.gitmodules -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/CMakeLists.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/README.md -------------------------------------------------------------------------------- /src/common/buildin.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/common/buildin.hpp -------------------------------------------------------------------------------- /src/common/config.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/common/config.cpp -------------------------------------------------------------------------------- /src/common/config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/common/config.h -------------------------------------------------------------------------------- /src/common/value.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/common/value.hpp -------------------------------------------------------------------------------- /src/compiler/ast/ast.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ast/ast.hpp -------------------------------------------------------------------------------- /src/compiler/ast/ast_visitor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ast/ast_visitor.h -------------------------------------------------------------------------------- /src/compiler/ast/ast_visualize.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ast/ast_visualize.cpp -------------------------------------------------------------------------------- /src/compiler/ast/ast_visualize.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ast/ast_visualize.h -------------------------------------------------------------------------------- /src/compiler/ast/expr.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ast/expr.hpp -------------------------------------------------------------------------------- /src/compiler/ast/stmt.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ast/stmt.hpp -------------------------------------------------------------------------------- /src/compiler/bytecode/bytecode_basicblock.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/bytecode_basicblock.hpp -------------------------------------------------------------------------------- /src/compiler/bytecode/bytecode_generator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/bytecode_generator.cpp -------------------------------------------------------------------------------- /src/compiler/bytecode/bytecode_generator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/bytecode_generator.h -------------------------------------------------------------------------------- /src/compiler/bytecode/bytecode_writer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/bytecode_writer.cpp -------------------------------------------------------------------------------- /src/compiler/bytecode/bytecode_writer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/bytecode_writer.h -------------------------------------------------------------------------------- /src/compiler/bytecode/peephole_optimization.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/peephole_optimization.cpp -------------------------------------------------------------------------------- /src/compiler/bytecode/peephole_optimization.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/bytecode/peephole_optimization.h -------------------------------------------------------------------------------- /src/compiler/ir/basicblock.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ir/basicblock.hpp -------------------------------------------------------------------------------- /src/compiler/ir/cfg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ir/cfg.cpp -------------------------------------------------------------------------------- /src/compiler/ir/cfg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ir/cfg.h -------------------------------------------------------------------------------- /src/compiler/ir/ir_generator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ir/ir_generator.cpp -------------------------------------------------------------------------------- /src/compiler/ir/ir_generator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ir/ir_generator.h -------------------------------------------------------------------------------- /src/compiler/ir/ir_instruction.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/ir/ir_instruction.hpp -------------------------------------------------------------------------------- /src/compiler/lexer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/lexer.cpp -------------------------------------------------------------------------------- /src/compiler/lexer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/lexer.h -------------------------------------------------------------------------------- /src/compiler/parser.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/parser.cpp -------------------------------------------------------------------------------- /src/compiler/parser.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/parser.h -------------------------------------------------------------------------------- /src/compiler/symbol.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/symbol.hpp -------------------------------------------------------------------------------- /src/compiler/token.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/compiler/token.hpp -------------------------------------------------------------------------------- /src/core/bytecode_reader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/bytecode_reader.cpp -------------------------------------------------------------------------------- /src/core/bytecode_reader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/bytecode_reader.h -------------------------------------------------------------------------------- /src/core/frame.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/frame.hpp -------------------------------------------------------------------------------- /src/core/opcode.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/opcode.hpp -------------------------------------------------------------------------------- /src/core/vm.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/vm.cpp -------------------------------------------------------------------------------- /src/core/vm.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/vm.hpp -------------------------------------------------------------------------------- /src/core/vm_instruction.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/core/vm_instruction.hpp -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/main.cpp -------------------------------------------------------------------------------- /src/utility/log.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/utility/log.h -------------------------------------------------------------------------------- /src/utility/utility.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/src/utility/utility.hpp -------------------------------------------------------------------------------- /test/in/overall/buildin.txt: -------------------------------------------------------------------------------- 1 | 1.11 2 | 6 3 | -------------------------------------------------------------------------------- /test/in/overall/fast_pow_mod.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/in/overall/fast_pow_mod.txt -------------------------------------------------------------------------------- /test/in/overall/fibonacci.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/in/overall/fibonacci.txt -------------------------------------------------------------------------------- /test/in/overall/fibonacci2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/in/overall/fibonacci2.txt -------------------------------------------------------------------------------- /test/in/overall/prime.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 0 2 3 5 6 10 11 23 267 269 -------------------------------------------------------------------------------- /test/in/overall/quick_sort.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/in/overall/quick_sort.txt -------------------------------------------------------------------------------- /test/out/basic/array.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/basic/array.txt -------------------------------------------------------------------------------- /test/out/basic/func_overload.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/basic/func_overload.txt -------------------------------------------------------------------------------- /test/out/basic/loop.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/basic/loop.txt -------------------------------------------------------------------------------- /test/out/basic/loop2.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/out/basic/num_calc.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/basic/num_calc.txt -------------------------------------------------------------------------------- /test/out/basic/optional_semicolon.txt: -------------------------------------------------------------------------------- 1 | -1 2 | 667 3 | -------------------------------------------------------------------------------- /test/out/basic/string_calc.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/basic/string_calc.txt -------------------------------------------------------------------------------- /test/out/basic/var.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/basic/var.txt -------------------------------------------------------------------------------- /test/out/overall/buildin.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/overall/buildin.txt -------------------------------------------------------------------------------- /test/out/overall/comment.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/out/overall/daffodil_number.txt: -------------------------------------------------------------------------------- 1 | 153 2 | 370 3 | 371 4 | 407 5 | -------------------------------------------------------------------------------- /test/out/overall/fast_pow_mod.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 234 3 | 198 4 | 0 5 | 0 6 | 405942 7 | 1 8 | -------------------------------------------------------------------------------- /test/out/overall/fibonacci.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/overall/fibonacci.txt -------------------------------------------------------------------------------- /test/out/overall/prime.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/overall/prime.txt -------------------------------------------------------------------------------- /test/out/overall/quick_sort.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/overall/quick_sort.txt -------------------------------------------------------------------------------- /test/out/overall/swap.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/out/overall/swap.txt -------------------------------------------------------------------------------- /test/out/ssa/constant_folding1.txt: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /test/out/ssa/constant_folding2.txt: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /test/out/ssa/ssa1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/run_test.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/run_test.cpp -------------------------------------------------------------------------------- /test/testcase/basic/array.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/array.cyx -------------------------------------------------------------------------------- /test/testcase/basic/comment.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/comment.cyx -------------------------------------------------------------------------------- /test/testcase/basic/func_overload.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/func_overload.cyx -------------------------------------------------------------------------------- /test/testcase/basic/loop.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/loop.cyx -------------------------------------------------------------------------------- /test/testcase/basic/loop2.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/loop2.cyx -------------------------------------------------------------------------------- /test/testcase/basic/num_calc.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/num_calc.cyx -------------------------------------------------------------------------------- /test/testcase/basic/optional_semicolon.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/optional_semicolon.cyx -------------------------------------------------------------------------------- /test/testcase/basic/string_calc.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/string_calc.cyx -------------------------------------------------------------------------------- /test/testcase/basic/var.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/basic/var.cyx -------------------------------------------------------------------------------- /test/testcase/overall/buildin.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/buildin.cyx -------------------------------------------------------------------------------- /test/testcase/overall/daffodil_number.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/daffodil_number.cyx -------------------------------------------------------------------------------- /test/testcase/overall/fast_pow_mod.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/fast_pow_mod.cyx -------------------------------------------------------------------------------- /test/testcase/overall/fibonacci.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/fibonacci.cyx -------------------------------------------------------------------------------- /test/testcase/overall/fibonacci2.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/fibonacci2.cyx -------------------------------------------------------------------------------- /test/testcase/overall/prime.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/prime.cyx -------------------------------------------------------------------------------- /test/testcase/overall/quick_sort.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/quick_sort.cyx -------------------------------------------------------------------------------- /test/testcase/overall/swap.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/overall/swap.cyx -------------------------------------------------------------------------------- /test/testcase/ssa/constant_folding1.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/ssa/constant_folding1.cyx -------------------------------------------------------------------------------- /test/testcase/ssa/constant_folding2.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/ssa/constant_folding2.cyx -------------------------------------------------------------------------------- /test/testcase/ssa/ssa1.cyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flylai/cyx2/HEAD/test/testcase/ssa/ssa1.cyx --------------------------------------------------------------------------------