GLang

GLang

22 devlogs
32h 49m
Created by GLStudios

Rust-inspired ToyLang

Timeline

guess who just wrote an entire LR(0) parser before realizing the grammar is too complex for an LR(0) parser

Update attachment

trust me bro its all very easy

Update attachment

Many, many, many iterations of parsing later and we're just gonna hand-roll a LR parser now. Might make a custom Parser Generator later, but this (should) work fine for now

Update attachment

A week in and still working on the Lexer

Update attachment

(slowly) working on rewriting tree.h for the 3rd time

Update attachment

Yet Another Language Syntax

Update attachment

Got Operator parsing done + a little debug printing system for the AST

Update attachment

gotta love having a clean valgrind report

Update attachment

it only took 3+ hours of work... but its (partially) done. WE HAVE AST BOI

Update attachment

ok feel much better bout this one

Update attachment

Did some LLVM research... yeah I'ma redo some of this AST while I'm ahead

Update attachment

You ever seen a recursive freeing mechanism? nor have i this is awful code im sorry

Update attachment

Ok I think I finally got an AST that might work

Update attachment

Still working on getting the structures right :(

Update attachment

ASTs are hard :(

Update attachment

Some cleanup to start the morning

Update attachment

Lexer is now complete (probably)

Update attachment

Got the Lexer somewhat designed; Just gotta actually throw it in.

Oh, and I Decided on a Bottom-up Parser design w/ separate Lexer & AST generation.

Update attachment

Gotta love ANSI escape codes

Update attachment

Got Input file parsing implemented (LinkedLists my beloved)

Update attachment

Got a basic CLI parsing setup + Created a logger function for future usage

Update attachment

The Beginning.

So the other day I was doing a project in Rust, particularly using Const Generics to do some cool stuff with Matricies and Compile-time Verification of arithmetic. However, as I tried to implement the Kronecker Product (if you don't know what that is; good), I encountered limitations with the current implementation of Const Generic Expressions.

This, combined with a few other small gripes with the language, and running on 2am energy; I had the idea. If Rust is so bad, why not make my own? And GLang was born.

Some Goals I have with this language is;
- Similar Syntax to Rust (my beloved)
- Simple & Robust Type System
- Easy binding with C Libraries
- Actually usable Const Generics
- Memory Safety via Borrows & Ownership
- (Potentially) Async-forward Design

So far just a simple Bazel project to make a bootstrapper in C. This Bootstrapper is just a simple compiler for the language, feature complete enough to compile a GLang project complex enough to implement itself. That's right; Compiler Inception. I chose to write this in C instead of Rust for one simple reason; LLVM.

I'm not insane enough to write a full compiler; complete with an optimization system, linker system, and compilation for target systems (Assembly D:). So, like Rust, I'll be using LLVM to actually do the hard part of compiling to a usable program. LLVM is written in C++, and does have a C API, alongside bindings in Rust. However I thought it might be easier to just remove a layer of abstraction and just work directly with C. It had also been a while since I've worked with C, so I thought it might be a fun challenge to return to my roots.

Whether I get very far in this; I have no clue. A fully functional Programming Language is a massive project and incredibly stupid idea [INSERT XKCD-927 HERE], however I excel in stupidity, so hopefully this doesn't get dropped after 30 seconds :3

Update attachment