You are browsing as a guest. Sign up (or log in) to start making projects!

SpookyDervish

@SpookyDervish

Joined June 7th, 2026

  • 3Devlogs
  • 1Projects
  • 1Ships
  • 1Votes
Open comments for this post

6h 56m 52s logged

Optimizing Compiler | Devlog #03

New Features

─────────────────────────────────────────
Hello again!

I’ve turned Comet into an optimizing compiler! So far we don’t have much, but Comet now has constant folding and constant propagation. But what does that actually mean?

“Constant Folding”

Constant folding means we look through the code for any math expressions or other things of the like. If there are any constants in the math expression, then we can replace the expression with what it will equal.

For example:

int x = (2 + 3) * (4 + 5)

The constant folder will see (2+3), and because the expression only has constants it will replace it with 5

int x = 5 * (4 + 5)

The constant folder then sees (4+5), and replaces it with 9.

int x = 5 * 9

And finally it sees 5 * 9 and replaces it with 45.

int x = 45

We’ve turned a 7 instruction expression into 1 instruction!

“Constant Propogation”

Constant propogation means that if a variable stays a value that the compiler knows throughout the variable’s lifetime, then we can replace all instances of that variable with its value. For example:

int x = 2 + 3
int y = x + 3 * 2

Constant folding runs and we get

int x = 5
int y = x + 6

x is a compile time constant now, and because it never stops being a constant, we can replace all values of x with 5.

int x = 5
int y = 5 + 6

See how we can now run constant folding again now that we have more information? This is why compilers run optimizations over and over, until the code doesn’t change anymore.

Bug Fixes

─────────────────────────────────────────
Along with adding an optimizer, I’ve fixed a large bug Return statements are automatically added to functions now! Before, if you didn’t add a return statement, your function could go past where it should’ve been, crashing your program and possibly even running code it shouldn’t. That is now fixed. Comet also throws an error if you don’t include a return statement in a non-void function.

Docs

─────────────────────────────────────────
Finally, I’ve extended the docs on the Comet website. It previously only have information on everything up to loops, but now includes info on structs and arrays.

That’s all from me, see you next time!

0
0
8
Ship Changes requested

Comet is in a mostly stable state and ready for people to use! I've written a large amount of documentation for the syntax itself, however, Comet is a lower-level programming language and not written for absolute beginner programmers.

Please report any bugs on the "Issues" page of the Github/Chookspace repository!

  • 2 devlogs
  • 95h
Try project → See source code →
Open comments for this post

3h 59m 25s logged

Sockets in Comet | Devlog #02

External Library Updates

─────────────────────────────────────────
External libraries now have the ability to define enums. With this, I’ve begun work on a socket library for fun.

Socket External Lib

─────────────────────────────────────────
In the screenshot I’ve included, I’ve got a very tiny client and server example set up where the server waits for a single connection, and then prints out what the connection sent.

I’ve got the core functions done but I’m gonna add more methods like readExact, readAll, those kinds of methods that just make your life a bit easier.

Bug Fixes

─────────────────────────────────────────
With the help of a friend, I’ve fixed a number of bugs. I also got cometc and comet to compile without any warnings, which is nice.

Some bugs where:

  • A lexer issue where trying to access a field from a list access would be incorrectly seen as a decimal number unless you added a space.
  • Type checking on arrays was extremely strict and so I’ve lessened it so that arrays are usable

See you next time!

0
0
15
Open comments for this post

91h 16m 34s logged

Devlog #1 - Core of Comet is done

What I currently have

I’ve got generics, arrays, structs, inheritance, external library support, a package manager, exceptions, loops, enums, and everything else working.

My next steps are writing some of the standard library in C, after I get the language to a usable state I’m planning to bootstrap it!

What I did since I created the project

When I created this project on Stardance I had already begun working on it before the competition started. I think I had already spent around 100 hours on the project. The project was originally written in LLVM, however, LLVM was quite difficult to get working, and I wanted to make progress rather than be stuck fighting with a slow piece of junk.

So I decided to rewrite the entire compiler. I created a VM and decided that the VM would be my compilation target. This made things such as exceptions possible because I would not have to worry about stack unwinding and other very complicated and difficult things.

I’ve made a huge amount of progress since then, and have gotten exceptions, external libraries, generics and structs, as well as arrays working since I created this project.

I must admit, I forgot about the devlogs until now and so this is why I’m so far ahead and creating my first devlog only now. :P
I’ll make sure to keep you guys updated though, see you soon once I get a socket running!

0
0
13

Followers

Loading…