DaGooseYT / DaCompiler

A front-end Unix x86-64 compiler for the Goose programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DaCompiler

A front-end Unix x86-64 compiler for the Goose programming language.

Features

  • Fast compilation
  • Compiles to intel-syntax x86 assembly and uses NASM to assemble
  • Goose code has a C-like syntax
  • Can implement C standard library functions in Goose code
  • Can output assembly files for advanced debugging

Goose code syntax

Basic hello world program (only 3 lines!):

UI0 main[] {
    extern::printf["Hello world!\n"];
}

In Goose code, function arguments and parameters are encapsulated with the square brackets.
Arrays uses parenthesis.
Stucts are called "flock".
Enums are called "gaggle".
Int is "SI32".
Double is "FP64".
Boolean is "B8".
Char is "SC8".
Void is "UI0".
Switch statement is called "match".
The pre-processor directive symbol is "~". "~using FILE.goose" includes external .goose code file. "~macro NAME VALUE" is a pre-processor macro constant.

Usage

DaCompiler was made with simple compilation arguments in mind:

Syntax: dacompiler [OPTION] <input>
Options:
     --asm                output assembly file
     --output <output>    output file name (without extension)

TODO

  • Change LR parsing to operator precedence based parsing
  • Use stack arguments over register arguments (this is possible)
  • Make a code optimizer
  • Make a custom standard library
  • Make a back-end assembler

About

A front-end Unix x86-64 compiler for the Goose programming language.

License:GNU Affero General Public License v3.0


Languages

Language:C 99.9%Language:Makefile 0.1%