Introduction to Theory of Programming Languages
This is a lesson in in the course, Theory of Programming Languages, which is a part of The School of Computer Science
Objective![]() In this lesson, students will be introduced to programming languages and the distinctions between them. Students will be able to answer:
|
IntroductionProgramming languages are special purpose languages used to instruct machines and express the semantics of algorithms. They were invented to make machines easier to use, as their processes could be automated in logical ways. New languages are still being written to this day to make different logical or mechanical problems easier to solve. Programming languages are strikingly different from human languages as they are highly formal and logical. Yet many of the concepts applied can be directly compared to human language. Programming languages can be divided in many ways, but the clearest distinction is between "Low Level Languages" (LLL) or "High Level Languages" (HLL). Low Level Languages![]() A R4700 Orion chip, which runs the LLL MIPS. LLLs are very simple, often based directly on the machines which they control - different brands of computer chips use different LLLs. Low Level Languages are also unique in that they can be directly represented by machine code, made of electrical signals or other physical processes. These languages can be represented using simple strings of text but even with that level of detail, humans have great difficulty reading the code - they are primarily the mother tongue of the machine. This is an example of a lower level language called MIPS assembly: add $t3, $a0, $t0 lw $t3, 0($t0) sub $v0, $0, $t1 srl $v2,$t1, $s7 Because MIPS assembly (or assembler language) is a LLL, it can be directly represented in binary form. Here is that same program written in its binary counterpart: 00000000100010000101100000100000 10001101000010110000000000000000 00000000000010010001000000100010 00000000000010010000010111000010 Binary is often written in hexadecimal format to reduce size: 00885820 8D0B0000 00091022 000905C2 As you can clearly tell, it is hard to read "008858208D0B000000091022000905C2" and discern the program behind it. This is why people tend to avoid LLLs unless they are directly working with or learning about the hardware within a computer. High Level LanguagesHigh Level languages, while just as logical as their lower level siblings, provide other useful features. Besides being much easier for a human to read, these languages are not based on a specific machine - they are translated down by "compilers", "interpreters" and "virtual machines" into LLLs. (This process will be covered in later lessons, at this point simply understand that HLLs can run on a variety of machines while LLLs are limited to a single type.) HLLs are also less efficient than LLLs because they need to be translated to machine code, but this extra step gives a computer the chance to check code for logical errors. Generally, HLLs are easier for people to learn and are more pleasing to work with - but they are less efficient than LLLs and are more distantly connected to the machines they run on. High Level Languages fall into several main varieties: Imperative, Object Oriented, Functional, and Logical. Later lessons will go into detail describing the pros and cons of each type. |
Assignments![]()
|
|