/lang

Programming Language.

Primary LanguagePython

C+ (WIP name)

A Programming Language like the C Programming Language that adds some useful features, different syntax, etc that ultimately transpiles to C itself.

Goals

  • Lexical Analysis (Generate Tokens from source file)
  • Parsing (Generate a Syntax Tree from the Tokens)
  • Convert C+ syntax to C syntax
  • Call C compiler and linker to create the executable
  • Success!!!

Why?

I mainly program using C because of its simpilicty. But some features are kinda bad and some even missing such as defer, shitty macros(preprocessor), shitty variadic functions, etc.

  • Why not use C++, doesn't it basically solve all those problems?

Because i don't like feel like its a good language... I'm not an big OOP person and don't get me started on the mess that is called the templates. Anyways i won't use C++ as my main language and i'm not quite satisfied with C, so i wondered "why don't i make my own language that adds these features to C?". And that's what i'm trying to do with this project. I'm not talking about creating a completely new programming language from scratch, just change some syntax of C, add these new features and make some of it better. This is also a great exercise to further increase my wisdom of computers.

TL;DR:

  • I like C but quite not, (don't likey C++) so create C+ that is in the middle.
  • Good opportunity to learn how a programming language works.
  • Because it's fun.

Syntax (WIP)

How hello world would look like:

#include <stdio> // includes remove .h suffix

// argc and argv merged into a static array (new built-in type)
// 'fun' keyword for declaring a function.
fun main(args: [string]) -> int { // return type after the function decl.
    printf("Hello, World\n");
    return 0;
}

References