The Magic Behind Programming Languages
The Magic Behind Programming Languages
By Tehreem Ansari
Assembly Language requires a program called the Assembler, to convert the assembly
language into "machine language"(0s and 1s). The very first assemblers were written in
"machine code" itself. It has a direct one-to-one correspondence with the raw language of the
computer itself.
Most of the programming languages, use C or hybrid of C language, for development. They use
a lexical analyzer/tokenizer like Flex to translate the keywords and a Parse Generator like
YACC. Parser generates a parse tree like the one given below:
These are languages that are used for one purpose - to describe the syntax of another language.
Sometimes when it comes to compiled languages, they are first implemented in C. Then the first
version of the language is used to create a new version, and so on.
Some of the languages influenced by C are: AMPL, AWK,csh, C++, C--, C#,Objective-C, BitC,
D, Go,Rust, Java, JavaScript,Limbo, LPC, Perl, PHP,Pike, Processing, Python,Seed7, Verilog
(HDL) (Source Wikipedia)
At the core is the Assembly Language. And example of Hello world in Assembly, in Java and
in Python is below:
Assembly language Hello World
(img from Wikipedia)
The codes written by a programmer in human readable form are called the source code. The
source code is either compiled or interpreted.
In compiled, the entire code is reviewed and then executed.
In an interpreter, you feed it the source code, that it reads [and converts into binary language]
line-by-line, executing as it reads/goes.
No matter in which language the source code is written, it ultimately goes to the lexer, from
where it gets converted to the machine code. Functions such as sin() are represented as a memory
address where its code block is. Keywords (like for) are converted to a list of byte codes, that
jump instructions compiled into assembly instructions and represented as binary.
So far we have seen how the computers enhanced, starting with physical motion, to a more
advanced form of systematic processing using softwares. And maybe in the future with the
imitation of human brain to create Supercomputers (see Blue Brain), the programming languages
will become just a 2nd language to people.