Go to file
ValKmjolnir bffec20b82 🎨 replace primitive size as constants 2024-11-16 01:08:05 +08:00
.github/workflows 🎨 add remove disabled node pass 2024-11-14 00:19:58 +08:00
bootstrap 🎨 replace primitive size as constants 2024-11-16 01:08:05 +08:00
doc 🎨 upload new colgm logo 2024-08-22 23:12:33 +08:00
src 🎨 replace primitive size as constants 2024-11-16 01:08:05 +08:00
test 🐛 fix type resolve error 2024-11-04 00:29:21 +08:00
.gitattributes 📝 add logs 2024-10-28 00:51:56 +08:00
.gitignore 🐛 bug fixes 2024-11-13 00:42:24 +08:00
LICENSE 📝 change license to apache 2.0 2024-03-25 22:40:10 +08:00
README.md 🐛 bug fixes 2024-11-13 00:42:24 +08:00
makefile 📝 add test.ll generation script 2024-11-04 23:54:28 +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. array type like [i32; 128]