Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

135 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compiled Coding Language

This is an experimental project where I create a coding language from scratch (without the help of tools like LLVM or the like)
If you're here to critique this repository, please see Source code deep-dive website for anylizers for a more in-depth explination on my source code

Table of Contents

Overview

Unimal is very simple procedural coding language that closely follows assembly in the same vane as C. Because of the way this compiler functions, most actions you write require prefixing using reserved keywords.

Variable Declaration

If you wanted to create an integer, i, equal to 1, then you wanted to change the value to 2, it would translate to the following C code:

int main() {
    int i = 1;
    i = 2;

    return 0;
}

The equivalent Unimal code would look very similar, but you'd need to declare the third line above as a variable reassignment with the keyword, chng. Here's an example

subroutine main::[] -> int :
    decl i:=[int] = 1
    chng i = 2
    
    expose 0
;

Function Declaration

Note: The inline function block is between : and ;, where the end of a line is created using a newline character

Functions in unimal are constructed by first using the subroutine keyword, followed by the name, the arguments (held between ::[ and ]), and the return type.
Say you needed a function, add, that returned the sum of the integers first and second then returned the result as an integer. This hypothetical situation would translate to the following

subroutine add::[int first, int second] -> int:
    expose first + second
;

Releases

Packages

Used by

Contributors

Languages