mirror of https://github.com/colgm/colgm.git
c6e5e2eb29 | ||
---|---|---|
.github/workflows | ||
bootstrap | ||
doc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
LICENSE | ||
README.md | ||
makefile |
README.md
Colgm Compiler Project
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
- support foreach/forindex, may not support in bootstrap compiler:
- forindex loop, container should have
size()
method - foreach loop, container should have iterator-like stuff
- forindex loop, container should have
- llvm debug info, may not support in bootstrap compiler
- develop bootstrapped compiler
- array type like
[i32; 128]