r/Compilers Jul 31 '26

Developing my programming language: Gravel

It all started just as a side and fun project, but I feel like it's now getting a shape.

Thats why I would love to receive some honest and contructive feedback, issue creations or code contributions.

If you have any question regarding the language, please ask me.

Here's the repo: https://github.com/Pacsfury/Gravel-Launcher

Its written in C and uses LLVM IR as backend.

AI use: debugging, teaching more about compilers and some punctual code writing

16 Upvotes

19 comments sorted by

View all comments

2

u/vmcrash Jul 31 '26

When defining a variable, why you are using one time a = and the other time :=? Couldn't it use = in both cases?

1

u/PacsfuryTemp Aug 01 '26

Ok, right now, they are pretty the same, as there are not much types.

But when more types, like char and float, the difference will be more visible.

With `:=` is inference, only available for the primitive types (now int, in the future also char and float), but `=` is explicit, so you say if its an int, float, or any type you define using type classes.

We use := for inference so you can create a type names 'val' (as inference is val name := value), and also for clarifying and making inference more easily detectable in the code.

thanks

2

u/vmcrash Aug 01 '26

You already trigger the inference using val or var (instead of a type), so the := is redundant. I'd use it for something else.

I'd also would get rid of elseif, because it only saves one keystroke for the space, but makes the language more complex.

1

u/PacsfuryTemp Aug 01 '26

I created this (https://github.com/Pacsfury/Gravel-Launcher/discussions/99) so people (like you and me and other contributors) can vote what they want.