Skip to content

colgm/colgm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colgm Compiler Project

Ask DeepWiki bootstrap nightly-build discord

use std::io::io;

pub func main() -> i32 {
    io::stdout().out("hello world!").endln();
    return 0;
}

Repo Content

Language Guide

See simple language guide in:

See compiler library reference in:

Usage

Use this command to show help:

<colgm compiler path> -h

Example

If you want to compile test.colgm with debug mode, and output the executable file to test.out, use this command:

<colgm compiler path> test.colgm -g -o test.out

Optimization

Colgm accepts -O option to enable optimization.

  • -O0: disable optimization
  • -O1: enable basic optimization
  • -O2: enable advanced optimization
  • -O3: enable maximum optimization
  • -Oz: enable speed optimization
  • -Os: enable size optimization

Also you could use -O[x] -g for release with debug info.

Build and Development

Requirements

Before building the project, here's the requirements:

  • python >= 3.8
  • llvm >= 13.0
  • clang >= 13.0
  • cmake >= 3.21
  • zip

Build

We suggest you to just follow the build script at misc/build.py.

Use this command in top level directory:

python3 misc/build.py

The build script will generate 3 executables in the build directory:

  1. build/colgm: bootstrap compiler (compiled by gcc/clang)
  2. build/colgm_lifted: lifted compiler (compiled by build/colgm)
  3. build/colgm_selfhost: self-host compiler (compiled by build/colgm_lifted)

If only want to build the bootstrap compiler, you can use this:

python3 misc/build.py -boot

If only want to build the self-host compiler after running the build script once, you can use this to just build the self-host compiler:

python3 misc/build.py -self

Test

And use another script to test:

python3 misc/test.py

Use this script to test tcp/udp utils:

python3 misc/test_tcp_udp.py

To check if any memory leakage, use this script:

python3 misc/memleak_check.py

Code Style

And for development, you should follow the code style.

Features and Roadmap

  1. feature: fuzzy match when variable is not found
  2. feature: reference type
  3. feature: to_string method for struct/enum/tagged union
  4. feature: smart pointer
  5. feature: std
    • Filesystem API (read, write, join, exists, etc)
    • Datetime utils
    • String and Unicode Helpers
    • Math Utils
    • map, filter, reduce, sort, reverse, etc
    • JSON
    • TOML, YAML and other formats parsing
    • networking (socket, TCP/UDP Server and Client)
    • HTTP Utilities
    • OS Utils (exec, env, args, etc)
    • Assert and Bench
    • Deprecation Marker
    • Regex
    • Package manager
    • Docs generator
  6. SIR refactor
  7. constant fold
  8. DCE opt
  9. CSE opt

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages