Skip to content

colgm/colgm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,182 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colgm Compiler Project

Ask DeepWiki bootstrap nightly-build discord

Colgm aims to be a simple, easy-to-use and easy-to-maintain programming language. It will let you write relatively safe code without too much cognitive load.

Mainly support native targets. Target supported now is LLVM (text IR).

Now nightly-builds are available:

use std::io::{ io };

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

Repo Content

  • bootstrap : bootstrap compiler (C++).
  • doc : documentation.
    • guide : language guide.
    • spec : language specification (experimental features).
  • example : example programs.
  • misc : build and test scripts.
  • src : self-host compiler (Colgm).
  • std : standard library.
  • test : test cases.

Language Guide

See simple language guide in:

See library reference in:

Language Extension

All the extensions are available in colgm-extension.

Here are extensions/plugins for Colgm:

Nightly-build of VSCode extension is here: colgm.vsix

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 >= 16.0
  • cmake >= 3.21
  • valgrind (for memory leakage check)

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, should support at least c++17)
  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: function pointer
  3. feature: lambda
  4. feature: to_string method for struct/enum/tagged union
  5. feature: smart pointer
  6. 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)
    • Deprecation Marker
    • Regex
    • Package manager
    • Docs generator
  7. DCE opt
  8. CSE opt
  9. ref type implicit copy(include assignment/definition/struct init) detection

About

Aim to be a simple, easy-to-use programming language. Let's write relatively safe code without too much cognitive load.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages