DEV Community

Navid
Navid

Posted on

I wrote a CHIP-8 emulator in my own programming language.

The source and repo for the CHIP-8 emulator is here:

GitHub logo navid-m / chip8emu

Chip8 Emulator

chip8emu

To build you need the Spectre Programming Language toolchain:

spectre ./src/main.sx -o chip8emu

License: GPL-3.0-only - By Navid M




And the Spectre Programming Language:

GitHub logo spectrelang / spectre

Spectre programming language

Spectre

License Status Stars

This repository contains the compiler for the Spectre Programming Language.

Spectre is a statically typed, design-by-contract language aiming to offer low-level control in combination with explicit correctness. The compiler is written entirely in Spectre itself.

The complete documentation can be found at https://spectre-docs.pages.dev

Installation

Prerequisite: cmake

Run the following in the terminal:

curl https://spectrelang.org/get.sh | sh

Then run to confirm installation:

spectre -v

The compiler is tested under MacOS aarch64 and Linux x86_64, for Windows it is untested, though might work under MSYS2.

Examples

val std = use("std")

pub fn main() void! = {
    val xs = ["hello", "world", "this", "is", "a", "test"]
    for x in xs {
        std.stdio.print("{s}\n", {x})
    }
}

Another example, with a simple demonstration of the trust system and pre/postconditions:

val std = use("std")
type Stack = {
    data: mut list[i32]
    len:  mut usize
}

pub fn (Stack) push(s: mut self, vl: i32) void =

Top comments (0)