Skip to content
/ latte Public

A small Java-like language with JVM and LLVM compilers

Notifications You must be signed in to change notification settings

pyetras/latte

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Piotr Sokólski (292408) clat

latte is a small java language, including bounded arrays.

int [] doubleArray (int [] a){
  int [] res = new int [a . length];
  int i = 0 ;
  for (int n : a){
    res [i] = 2 * n ;
    i ++ ;
  }
  return res ;
}

void shiftLeft (int [] a){
  int x = a [0];
  int i = 0 ;
  while (i < a.length - 1){
    a [i] = a [i + 1];
    i ++ ;
  }
  a[a.length - 1]= x ;
  return;
 }

int scalProd(int[] a, int[] b) {
  int res = 0;
  int i = 0;
  while (i < a.length) {
    res = res + a[i] * b[i];
    i++;
  }
  return res;
}

int main () {
  int [] a = new int [5];
  int i = 0 ;
  while (i < a.length){
    a [i]= i ;
    i ++ ;
    }
  shiftLeft (a);
  int [] b = doubleArray (a);
  for (int x : a)printInt (x);
  for (int x : b)printInt (x);
  printInt(scalProd(a,b));
  return 0 ;
}

It has a JVM compiler src/JVMCompiler.java and an LLVM compiler src/LLVMCompiler.java. The code produced by LLVM compiler is in the SSA form.

Compile with make. Requires boost 1.5.

About

A small Java-like language with JVM and LLVM compilers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published