Skip to content

Repository files navigation

CColon Logo

CColon (C:)

A bytecode-compiled programming language built in Go.
Clean like Python, structured like Go, expressive like Kotlin.

DocumentationInstallationQuick StartFull Example


Installation

Linux / macOS

curl -fsSL https://raw.githubusercontent.com/TRC-Loop/CColon/main/install.sh | sh

Or specify a version:

curl -fsSL https://raw.githubusercontent.com/TRC-Loop/CColon/main/install.sh | sh -s v1.0.0

Windows (PowerShell)

irm https://raw.githubusercontent.com/TRC-Loop/CColon/main/install.ps1 | iex

Build from source

Requires Go 1.22 or later.

git clone https://github.com/TRC-Loop/CColon.git
cd CColon/ccolon
go build -o ccolon .

Move the binary somewhere on your PATH:

sudo mv ccolon /usr/local/bin/

Quick Start

Interactive Shell

Run ccolon with no arguments to start the REPL (with readline, history, and tab completion):

$ ccolon
CColon v1.0.0 - Interactive Mode
Type 'exit' to quit.
c: > import console
c: > console.println("Hello from C:!")
Hello from C:!
c: >

Running a File

ccolon hello.ccl

hello.ccl:

import console
function main() {
console.println("Hello, World!")
}

LSP

Find LSP Instructions here: https://github.com/TRC-Loop/ccl-lsp

Features

FeatureDescription
Bytecode compiledCompiles to bytecode, runs on a stack-based VM
Static typesint, float, string, bool, list, array, dict, sint
ClassesInheritance, constructors, public/private fields and methods
Error handlingtry/catch/throw with custom error classes
File importsimport "file.ccl" for multi-file projects
Arbitrary precisionsint type for unlimited-size integers (like Python)
Code formatterccolon fmt with configurable .ccolonfmt
Bytecode filesccolon compile to .cclb, ccolon file.cclb to run
Package managerccolon pkg install from any GitHub repo
Rich REPLReadline, history, tab completion, colored output
Standard libraryconsole, math, random, json, fs, datetime, os, http

Language Overview

CColon source files use the .ccl extension.

Types

TypeDescriptionExample
int64-bit integervar int x = 42
sintArbitrary precision integervar sint x = 99999999999999999999
float64-bit floatvar float pi = 3.14
stringTextvar string s = "hello"
boolBooleanvar bool ok = true
listDynamic listvar list a = [1, 2, 3]
arrayFixed-size arrayvar array a = fixed([1, 2])
dictDictionaryvar dict d = {"a": 1}

Functions

function add(int a, int b) int {
return a + b
}
function greet(string name, string prefix = "Hello") {
console.println(prefix + ", " + name + "!")
}

Classes

class Dog {
var public string name = ""
public function init(string name) {
self.name = name
}
public function speak() string {
return self.name + " barks!"
}
}

Error Handling

try {
throw Error("something went wrong")
} catch (Error e) {
console.println("caught: " + e.message)
}

Control Flow

if (x > 0) {
console.println("positive")
} else {
console.println("not positive")
}
while (count < 10) {
count = count + 1
}
for i in range(5) {
console.println(i.tostring())
}
for item in items {
console.println(item)
}

Tools

ccolon file.ccl # Run a source file
ccolon file.cclb # Run a compiled bytecode file
ccolon fmt file.ccl # Format source code
ccolon compile file.ccl # Compile to bytecode
ccolon pkg install <url># Install a package
ccolon pkg list # List installed packages

For the full language reference, see the documentation.

License

MIT

Logo

You might want to rotate the logo by 90.

This is a happy language indeed.

About

CColon (C:) -- A bytecode-compiled programming language written in Go

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages