n4o847 / nazuki-hs

A language that compiles into Brainfuck

Home Page:https://n4o847.github.io/nazuki-hs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nazuki

CI GitHub Pages

Nazuki ("the brain" in Old Japanese) is a compiler toolchain for generating Brainfuck code. It is implemented in Haskell.

Playground

Try it out on your browser: https://n4o847.github.io/nazuki-hs/

Design overview

Nazuki consists of three layers: NazukiScript, NazukiAssembly and NazukiVM.

Architecture overview

NazukiScript

NazukiScript is the most high-level script language that can be written like Python.

a = scan()
b = scan()
print(a + b)

NazukiAssembly

NazukiAssembly is the low-level assembly language that consists of a sequence of instructions and labels.

scan
scan
add
print

NazukiVM

The generated instruction sequence is embedded into Brainfuck code along with the virtual machine code that interprets and executes the instructions.

NazukiVM is (currently) a 32-bit stack machine with a text segment and a stack segment.

Memory layout of NazukiVM

Resources

About

A language that compiles into Brainfuck

https://n4o847.github.io/nazuki-hs/

License:MIT License


Languages

Language:Haskell 78.4%Language:TypeScript 17.6%Language:JavaScript 2.4%Language:CSS 0.9%Language:Shell 0.5%Language:Dockerfile 0.3%