Go to file
ValKmjolnir 67c4a448ae 🐛 fix memory out of bound error in str module 2024-10-30 00:12:48 +08:00
.github/workflows 🐛 fix memory out of bound error in str module 2024-10-30 00:12:48 +08:00
bootstrap 📝 change comment syntax 2024-10-27 00:15:01 +08:00
doc 🎨 upload new colgm logo 2024-08-22 23:12:33 +08:00
src 🐛 fix memory out of bound error in str module 2024-10-30 00:12:48 +08:00
test 📝 change comment syntax 2024-10-27 00:15:01 +08:00
.gitattributes 📝 add logs 2024-10-28 00:51:56 +08:00
.gitignore 🎨 add more mir2sir rules 2024-07-25 00:53:14 +08:00
LICENSE 📝 change license to apache 2.0 2024-03-25 22:40:10 +08:00
README.md 🎨 type convert support same type 2024-10-25 19:52:43 +08:00
makefile 🔥 adjust directory 2024-10-25 00:30:08 +08:00

README.md

Colgm Compiler Project

bootstrap

Repo Content

  • bootstrap : available now, features not stable these days, but welcome to try.
  • src : bootstrapped compiler, not available now (lexer and parser is ready).
  • test: test cases.

Bootstrap Compiler

Bootstrap compiler locates at {repo_path}/bootstrap, written by C++(-std=c++17):

Use these commands to build the bootstrap compiler, use -DCMAKE_BUILD_TYPE=Debug if want debug version:

mkdir build && cd build
cmake ../bootstrap -DCMAKE_BUILD_TYPE=Release && make -j

The executable is located as build/colgm.

Then use this command to build bootstrapped compiler:

make colgm.ll

The bootstrapped compiler should be {repo_path}/colgm.ll. If having lli(llvm jit interpreter), you could try this to execute bootstrapped new compiler:

lli colgm.ll main.colgm --library .

LLVM jit interpreter maybe unstable on some platforms, if lli crashed, try using clang to build out.ll to executable:

clang colgm.ll -o colgm

Hello World

Hello world example is available in bootstrap:

use libc::puts;

pub func main() -> i64 {
    puts("hello world!");
    return 0;
}

Tutorial

See simple tutorial in bootstrap/README.md.

TODO

  1. support foreach/forindex, may not support in bootstrap compiler:
    • forindex loop, container should have size() method
    • foreach loop, container should have iterator-like stuff
  2. llvm debug info, may not support in bootstrap compiler
  3. develop bootstrapped compiler
  4. conditional compilation
  5. array type like [i32; 128]