Skip to content

Release v0.4.0

Compare
Choose a tag to compare
@dosisod dosisod released this 08 Dec 04:40
· 743 commits to master since this release

Lots has been added since the version 0.3.0 release, including while, else, block comments and functions!

Replace [] syntax with {} and ()

if true {
  func()
}

Native and external functions

# external function declaration
external puts(string: str) int

err := puts("hello world!")

# native function definition
func() {
  # do something
}

func()

While statments

while true {
  # do something
}

Else statements

if something {
  # do something
}
else {
  # do something else
}

Multi-line/block comments

#{
this is a block comment!
#}

Skull flags

$ skull main.sk -c -o main.o

Compiles main.sk into an object file called main.o.

$ skull main.sk -S

Output assembler for main.sk.

$ skull main.sk -E
...

Outputs LLVM IR from main.sk to stdout.

Skull header file

C/C++ programs can now include headers for Skull types:

#include <skull/Skull.h>

SkullInt add_one(SkullInt num) {
	return num + 1;
}

New escape sequences

# \0 null terminator
c_str := "hello world\0"

# \e escape shorthand
color := "\e[32;1Bright Green"

Other notable features/bugfixes:

  • main implicitly returns 0.
  • Variables can be used on the left/right hand side of operations (add, subtract, etc).
  • Error when explicitly dividing by zero.
  • Error on redundant reassignment of variable (x = x).
  • Error on unreachable code after return.