Cetus Script
The "make a game > make a game engine > make a programming language" pipeline is strong. Here's what I've done in Cetus Script so far!
extern Void printf(String format, Int... values)
struct Foo
{
Int a
Int b
}
Void main()
{
Foo foo = New
foo.a = 2
printf("Starting at %i\n", foo.a)
While (foo.a < 6)
{
foo.a = foo.a + 1
printf("Loop %i\n", foo.a)
}
printf("Ending at %i\n", foo.a)
Return
}
The first really big feature of Cetus has already been implemented, at least compiler-side. Every single statement
in main
is a function! Foo foo = New
is secretly just Declare(Foo, foo)
.
foo.a = 2
is secretly Assign(Get(foo, a), 2)
. These functions just have patterns
associated with them that let them be used more fluently. Patterns will also eventually be able to be used for types
as well, so you can say Foo?
instead of Option
.
Another interesting feature is that pointers are handled automatically! foo.a
returns Int*
when used in Assign
, but it also returns Int
when used in printf
! You don't
get to handle reference and dereference pointers manually, but it can figure out what's usable on it's own.
Other quirks of the language include using PascalCase for things that public and camelCase for things that are private, whitespace means nothing and semicolons are optional, etc.
The next thing I'm trying to work on is something like rust's traits, but also allows you to define fields in trait objects, which you can't do with rust. Other planned features are things like properties being automatic type definitions instead of just functions.