Skip to content

superadi04/Fun-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fun-Compiler

"Fun", a simple functional, pythonic, compiled language with support for conditionals, functions, recursion types, arrays, and co-routines. Below are some examples:

Conditionals

integer n = 90

if (n % 2 == 0) {
    print("The number is even.")
} else {
    print("The number is odd.")
}

For Loops

integer f[n+2]
f[0] = 0
f[1] = 1
for(integer i = 2; i<=n; i = i + 1){
    if[i] = f[i-1] + f[i-2]
}
print(f[n])

While Loops

boolean test = true
integer i = 0

while(test) {
    i = i + 1
    
    if (i > 10) {
        test = !test
    }
}

Functions

integer[10] array

array[0] = 10
array[1] = 32
array[2] = 100
array[3] = 1231
array[4] = 43242
array[5] = 342242
array[6] = 2343244
array[7] = 2888899
array[8] = 28888990
array[9] = 909009000

fun binarySearchRecursive(key) {
    integer last = 9
    integer first = 0

    if (last>=first){  
        int mid = first + (last - first) / 2;  

        if (arr[mid] == key ){  
            return true;  
        }  
        if (arr[mid] > key) {  
            return binarySearch(arr, first, mid-1, key)
        } else {  
            return binarySearch(arr, mid+1, last, key)
        }  
    }  

    return false;  
}

About

X86-Assembly Compiler for Fun Programming Language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages