Skip to content
/ zephyr Public

A Statically, Strongly Typed Native Programming Language

License

Notifications You must be signed in to change notification settings

QcO-dev/zephyr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

347 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zephyr Logo

Zephyr Programming Language

Zephyr is a statically, strongly typed language which compiles to assembly. Currently supported is Linux x86_64.

Zephyr is currently WIP and highly likely to change - use at your own risk!

Installation / Bootstrapping

As Zephyr is self-hosted, it must be bootstrapped first.

The assembly files in the ./bootstrap directory can be used for this.

Firstly, you must have yasm installed into your $PATH.

Note:

To sync the bootstrap files you may need to run:

$ git lfs pull

With make

$ make bootstrap

$ ./build/zephyr -o ./build/zephyr ./src/main.zpr
$ ./build/zephyr -o ./build/zephyr ./src/main.zpr
$ ./build/zephyr -o ./build/zephyr ./src/main.zpr
$ ...

Without make

$ yasm -felf64 -o ./bootstrap/bootstrap_x86_64_linux.o ./bootstrap/bootstrap_x86_64_linux.yasm
$ ld -o ./bootstrap/bootstrap_x86_64_linux ./bootstrap/bootstrap_x86_64_linux.o

$ ./bootstrap/bootstrap_x86_64_linux -o ./build/zephyr ./src/main.zpr

$ ./build/zephyr -o ./build/zephyr ./src/main.zpr
$ ./build/zephyr -o ./build/zephyr ./src/main.zpr
$ ./build/zephyr -o ./build/zephyr ./src/main.zpr
$ ...

Examples

Hello, World

import "std/io.zpr";

function main(): int {
	putsln("Hello, World!");
	return 0;
}

File Write

import "std/io.zpr";

function main(): int {
	var file = fopen("./myfile.txt", 'w');
	file.putsln("Hello, Zephyr FileIO!");
	file.close();
	return 0;
}

Struct Methods

import "std/io.zpr";

struct Person {
	name: i8*;
}

function Person.constructor(name: i8*) {
	this.name = name;
}

function Person.say_hi() {
	puts("Hi, I'm "); puts(this.name); putsln("!"); // f"Hi, I'm {name}!\n"
}

function main(): int {
	var alice: Person("Alice");

	alice.say_hi();

	return 0;
}

More Examples

See ./examples for more examples of the language.

Testing

Running the bash scripts in ./tests can be used to test the language.

Running ./tests/all.sh will run all the tests and give a count of the successful, total, and skipped tests.

Note:

Due to git, you may need to change the line endings of each test file to LF instead of CRLF.

About

A Statically, Strongly Typed Native Programming Language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published