close
Skip to Main Content

Instructions written in a programming language. Source code is the text that a programmer writes, but it is not directly executable by the computer. Source code must be converted into machine language by compilers or assemblers ahead of time or by interpreters at the time the program is run. See programming language and source code editor.

Source code can also be machine generated by programs that convert the source code of one programming language or dialect into the source code of another language or dialect. See lines of code, compiler, assembler and interpreter.

High Level vs. Low Level

Most programmers write in high-level languages such as C/C++, Java and Python. However, programs are also occasionally written in assembly language, which is essentially a mnemonic version of the hardware's machine language. Generally, one line of assembly language is converted to one machine instruction. Following are examples of converting Fahrenheit to Celsius in three high-level languages and one low-level assembly language:

C (High Level - Compiled)

float fahr;
printf("Enter Fahrenheit: ");
scanf("%f", &fahr);
printf("Celsius is %f\n", (fahr-32)*5/9);


Python (High Level - Interpreted)

printf("Enter Fahrenheit: ")
fahr = float(input)
cell = ((fahr -32) * 5 / 9, 1)
printf("Celsius is {}".format(cell))


 Java (High Level - Interpreted)

import java.io.*;
class Convert {
public static void main(String[]args)
throws IOException {
float fahr;
StreamTokenizer in=new
StreamTokenizer
(new InputStreamReader(System.in));
System.out.print("Enter Fahrenheit ");
in.nextToken();
fahr = (float) in.nval;
System.out.println ("Celsius is " +
(fahr-32)*5/9);
}
}



Intel x86 Assembly Language (Low Level)

cseg    segment para public 'CODE'
assume  cs:cseg,ds:cseg
start:
jmp     start1
msgstr  db      'Enter Fahrenheit '
crlf    db      13,10,'$'
nine    db      9
five    db      5
outstr  db      'Centrigrade is $'
start1: push    ds
push    cs
pop     ds
mov     dx,offset cseg:msgstr
mov     ah,9
int     21h
sloop:
cent:   call    getnumb
test    ax,ax
je      exit
push    ax
mov     dx,offset cseg:outstr
mov     ah,9
int     21h
pop     ax
sub     ax,32
jns     c1
push    ax
mov     dl,'-'
mov     ah,6
int     21h
pop     ax
neg     ax
cl:     mul     five
div     nine
call    putval
mov     dx,offset cseg:crlf
mov     ah,9
int     21h
jmp     sloop
exit:   pop     ds
mov     ah,4ch
int     21h
getnumb:
xor     bx,bx
llp:    mov     dl,0ffh
mov     ah,1
int     21h
cmp     al,0dh
je      llr
sub     al,'0'
jb      llr
cmp     al,'9'
ja      llr
xor     ah,ah
shl     bx,1
add     ax,bx
shl     bx,1
shl     bx,1
add     bx,ax
jmp     llp
llr:    mov     dx,offset cseg:crlf
mov     ah,9
int     21h
mov     ax,bx
ret
putval: xor     bx,bx
push    bx
mov     bx,10
llg:    xor     dx,dx
div     bx
add     dx,'0'
push    dx
test    ax,ax
jne     llg
bloop:  pop     dx
test    dx,dx
je      endx
mov     ah,6
int     21h
jmp     bloop
endx:   ret
cseg    ends
end     start

THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction requires permission.
Copyright © 1981- 2026. The Computer Language Co Inc. All rights reserved. CLC Logo