Gamma Lang: Introduction

Starting a new project is always an exciting time for me. In fact, it is so exciting, I normally stop my projects before they are anywhere near completion, to start a new project; sometimes the new project is a replacement for the current unfinished project. This project is no exception, however I have been really good for the last 4 months, to not switch projects. I have been working on this website platform for about 4 months now, and a game engine project for about 2 months. Now it is about time to start a new project ;) or, at least normally. This time however I am not working on either, but both at the same time, via Gamma Programming Language.

Gamma Language is a simple programming language which compiles to C99 (hopefully) and is then compiled by any C compiler (only GCC & Clang are supported now). This new language is designed to help me be more productive, and enjoy writing code. I am writing this language to one day replace all other languages I currently use, for hobby projects mainly. This website "" is developed in 3 languages (server side, of course the front end is 3 on it's own) PHP, Javascript, & QLisp. Now when I am programming applications that need to be really fast (as in Javascript with V8 is not even close to fast enough), I normally go directly to C++ or C. Which leads me to the Why's in my decision to create Gamma Programming Language (Gamma).

Why create this language?

  1. Speed (Raw calculations per second)
    I want everything I write to be fast by default, and down right blazing fast given some time to optimize it. Using PHP or Javascript, I can only ever be as fast as the their VM or JIT runs, with no ability to speed things up myself.
  2. Speed (Time developing applications)
    I want to be very productive when I am writing code, I know people can be productive in most languages. I think I will be most productive in a language in which I have complete control of the syntax and language features. Not to mention I can design the syntax closer to the way I think about programming and logic, giving me a more natural flow in my thoughts to code translation.
  3. Speed (Time compiling projects)
    I know that most people are going to disagree with me here, and either say C/C++ doesn't compile that slow, or that there are ways to deal with it, maybe even telling me to take a break while my code compiles and get some more coffee. You might think that because I am compiling to C and then to Machine Code, that it might take longer to compile to machine code (Which is possible in some cases). Most of the time taken in compiling C/C++ applications is including headers, and Gamma doesn't do headers. In fact Gamma outputs only one '.h and one '.c' file, so compiling will take way more memory, but will be really fast.
  4. Practice & Learning
    I think it is important to learn new technology, and stretch you comfort zone. I have never made a language which has these same goals, or is even the same type of language. Recently I created QLisp for my service which currently runs this website and others (extremely fast I might add). I want to challange myself and exercise my mind, I think this is a great way to do such a thing.
  5. New project itch?
    You know that feeling you get when you are about 40% of the way complete with a project, and you just want to ball your eyes out. It seems that every bug you fix, 4 more pop up, out of the wood works. Well that is about where I am with one of my projects, and I wanted a distraction. So I started thinking how it would be cool to write a language which results in an executable binary file, and can be compiled on multiple platforms easily.
  6. Finally, Simplicity
    Some people will say that Javascript is simple, well, it's not, and those people are wrong. Dead wrong, and cannot be any more wrong. I agree it is easy to write a couple little functions that make your webpage feel more interactive or that even do make it more dynamic. But, I say to those people that they should write a complete hosting environment in Javascript, sit back for a couple months maybe a year depending on how good your memory is; and then try to fix a major bug because you know there is one, it is written in javascript after all, what did you expect? Gamma is statically typed, and will hopefully have strong static analysis tools to help out with finding errors at compile time. The language itself is simple to understand and write, with some design patterns baked into the language, saving me from having to write them over and over.

What it looks like.

Simply put, I am still working out the syntax, and it will change more over time, until I hit stable 1.0 release. But for the moment it resembles Go language a lot I think, with a mix of some C, a little Pascal, and maybe some love from more dynamic languages like ActionScript.


module main;

import std;

fun main(args : String[]) >> Int32 {
    std.writeln("Hello World!");


module main;

import std;
import std.strutils;

fun isPrime(val : Int32) >> Bool {
    for i : Int32 = 2 to val {
        if value % i == 0 {
            return false;
    return val > 1;

fun isPrime() Int32 >> Bool {
    return isPrime(self);

fun main(args : String[]) >> Int32 {
    # First call function directly
    std.writelnf("Is %d a prime? %s", isPrime(args[1].toInt32()) ? "Yes" : "No");
    # Now using the type extension function
    std.writelnf("Is %d a prime? %s", args[1].toInt32().isPrime() ? "Yes" : "No");

    # Now using pass forward function operator
    std.writelnf("Is %d a prime? %s", args[1]->toInt32()->isPrime() ? "Yes" : "No");