Kompajler

Sa Wikipedije, slobodne enciklopedije

Kompajler (en. compiler) je prevodilac programskog jezika i njegovih instrukcija u mašinski kod (nule i jedinice).

Programski kod - Java Mašinski kod
public class Ggt {
 /*
  */
 private static int ggt(int zahl1, int zahl2) {
   while (zahl1 != zahl2) {
     if (zahl1 < zahl2) {
       zahl2 = zahl2 - zahl1;
     } else {
       zahl2 = zahl1 - zahl2;
     }
   }
   return zahl1;
 }

 /*
  */
 public static void main(String[] args) {
   /*
    */
   int ersteZahl = Integer.parseInt(args[0]);
   int zweiteZahl = Integer.parseInt(args[1]);
   
   int ergebnis = ggt(ersteZahl, zweiteZahl);
   
   System.out.println("Der ggT von "  + ersteZahl + 
       " und " + zweiteZahl + " ist: " + ergebnis);
 }
}
Kompajler →
···
0010 0100 1011 0111
1000 1110 1100 1011
0101 1001 0010 0001
0111 0010 0011 1101
0001 0000 1001 0100
1000 1001 1011 1110
0001 0011 0101 1001
0111 0010 0011 1101
0001 0000 1001 0000
1000 1001 1011 1111
1001 1101 1001 1110
0111 0010 0011 1101
0001 0000 1001 0000
0111 0010 0011 1101
0001 0011 1001 1100
···