How Programming Languages Work—A Brief Overview

Warning: Extremely technical information follows. Feel free to skip this section for now, but make sure you do read it sometime. It’s important enough to know, but not vital for you to begin programming.

A computer only understands a string of commands in a very basic format—machine language. At the lowest level, a computer can only process 0s and 1s—off, or on. In effect, computer is just a huge collection of billions of switches, rapidly turning on and off. A typical command that the computer understands may look like this:

00101011 11110111 10000100 01010110 00000110 10001001

Of course, having to program like this would not be very easy, and it is easy to loose track of what you’re doing. To fix this, chip makers created what is called assembly language—a language that chips understand, and will get translated to machine language, independently of the programmer. A typical command in assembly might look like this:

.quad	_objc_msgSend_fixup
.ascii "long int"
.byte	0x4
.byte	0x8
.byte	0x7
.byte	0x2
.byte	0x1
.byte	0x6
.ascii "char"

Better than machine language, but still not too useful. In addition, the programmer is still interacting directly with the hardware, which increases the chances of mistakes.

Both machine language and assembly are specific to the hardware. Different hardware involves different machine and assembly code.

Higher-level languages were invented to solve of these problems. The “height” of these languages varies, but they all involve English-like syntax, and are hardware-independent. Objective-C is one such language.

The majority of these languages are passed through a compiler—a program that converts the code into assembly. Compilers are usually provided with a system; Xcode, Apple’s native development program, includes gcc, one of the most prominent compilers, as well as LLVM, an Apple-developed compiler that offers many benefits over gcc, all of which are beyond the scope of this book.

Higher-level languages allow programmers to focus on their task, and not on writing obscure code.

For anyone who’s interested in learning more, an even more technical and low-level approach will be coming. When? I don’t know.

Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

  • Welcome

    My goal is to make CupsOfCocoa into a beautiful source for beginners to the iPhone platform to get started. Subscribe below for more, and stay tuned!

  • Contact Me

    If you need to contact me for any reason, feel free to send me an email.
  • The Giving Spirit

    If you've found this site helpful, would you consider donating a little sum? Any amount is appreciated...Thanks so much!

  • Roadmap

  • Enter your email address to follow this blog and receive notifications of new posts by email.

    Join 222 other followers

  • Back to the Past

    September 2010
    S M T W T F S
    « Aug   Oct »
  • Time Machine

  • You count!

  • Worldwide Stats

    free counters
  • Advertisements
%d bloggers like this: