Today s High-Level Languages

[ LiB ]

Today's High-Level Languages

The terms high-level , interpreted , and scripting all share a similar conceptual space when it comes to programming, and this often causes confusion. Over the next few pages I'll explain each term . Pay attentionthere may be a quiz coming up!

High-level languages are designed with the native language of the programmer in mind. They are sometimes referred to as problem-oriented languages and are often very specific in focus. BASIC is a good example of a high-level language; it was designed for first-time programmers as a learning tool. COBOL and FORTRAN are other good examples. COBOL was designed for business problems, and FORTRAN for solving scientific and mathematical problems.

NOTE

Python is sometimes referred to as a "Very High Level Language" (VHLL). This term appeared in the mid 1990s to describe languages used for rapid prototyping. Two features that sup posedly separate VHLLs from your standard high-level language are dynamic types and an interactive environment that allows you to make changes without having to go through the entire relink recompile steps.

Instructions in high-level languages closely resemble everyday language, making high-level languages much easier to learn and use than their low-level equivalents. The programmer does not need to have detailed knowledge of the internal working of the computer in order to program instructions. Each instruction in high-level is equivalent to several machine code instructions that then are either compiled or interpreted to translate them into machine code.

Interpreted versus Compiled Languages

A high-level interpreted language translates the programmer's written code step-by-step at runtime , or when the program is actually running. A high-level compiled language translates a programmer's written code before the program is run, a process normally called compiling . This changes the written code into an executable or object-code that can then be run as a program on a computer.

Many modern programming languages allow themselves to be both interpreted and compiled, but normally a particular language is more suited to one or the other. AWK, Perl, and Python are examples of interpreted programming languages. BASIC, COBOL, C, and FORTRAN are examples of compiled programming languages.

When a program is compiled, the compiler takes the source code files and generates object code with those files. The object code is then wrapped together during a linking process to produce an actual executable. This process is illustrated in Figure 1.2.

Figure 1.2. The process of compiling source code into an executable file or program

graphic/01fig02.gif


When comparing the two types of languages, you can usually make two generalizations . The first is that interpreted programs are usually much slower than their compiled counterparts (although the actual process of compiling may take quite a bit of time as well). The second is that interpreted languages are more flexible at runtime than compiled languages because they can interact with the execution environment. In other words, in order to gain flexibility, you must slow down.

Scripting Languages

Scripting is a term used to denote the scripting of a computer, akin to an actor who follows a script to perform a play. A scripting language is a high-level language used to assemble components into a predefined software architecture. Scripting languages, sometimes called glue- languages , are designed for scripting the operation of a computer. Normal operations that would be considered scripting are administrative tasks such as running automatic backups , text processing, running server-side requests such as CGI processing, or automating software tests. Python, Lua, and Ruby are considered scripting languages in one form or another, as are ASP, AWK, JavaScript, Perl, and VBScript.

The scripting-language family is hard to pin down. VHLL languages include the various types of UNIX shell command-line interpreters, and even languages like AWK, Perl, and Lisp can be classified as scripting languages. Unfortunately, there is no universally accepted definition of what a pure scripting language actually is, but they usually have most of the following features:

  • They are interpreted languages.

  • They possess a simple syntax.

  • Variables are dynamic, so that they can act as strings or numbers , depending on what operation is being performed on them.

  • Variables are created when referenced, as opposed to being allocated to memory early on or during compile time. Internal details about the variables are only resolved when necessary. This process is sometimes called late binding .

  • They possess high-level string manipulation features. Concatenation and searching are built into the language.

  • They do not possess pointers.

  • The programmer does not handle memory allocation; the language handles it automatically.

  • Garbage collection (release of unused memory) is handled automatically.

  • The language is interactive and can give feedback while running, often pointing out errors, mistakes, and problems.

  • The code is stored in a plain text format.

  • Processor and operating system independence exists, and the code can work in many different environments.

  • They simplify the usage of common commands such as array sizes, data types, or expressions. Common commands are often built in.

    NOTE

    Statically versus Dynamically Typed Languages

    The specific system by which data is organized in a program is called the type system . There is an actual discipline devoted to the design and study of type systems, called type theory . In practice, however, there are normally only two type systems: static and dynamic.

    Statically typed languages need predefined types for pieces of data, and values can only have one fixed typed. Static systems are sometimes called type-safe or strongly typed. C++ and Java are examples of statically typed systems.

    Dynamic systems treat data locations interchangeably. They are sometimes called latently typed systems. Again, the key here is flexibility versus speed. Dynamic systems are a bit slower during runtime than their static brethren, but they are faster to code, as there is no need to predefine variables or check for buffer overflow against them. Examples of dynamically typed systems include Lisp, JavaScript, TCL, and Prolog.

  • Statements are usually terminated by returns or new lines, rather than with semicolons or punctuation.

  • They are optimized for programmer efficiency as opposed to program efficiency.

  • They are optimized for text manipulation, data filtering, system applications, and/or building graphical user interfaces.

  • Components of foreign code, such as shell commands, other language libraries, or COM, can be embedded or "glued" to the scripts, and the language provides interfaces to external components. This process is called extensibility .

  • They are considered a rapid prototyping language.

[ LiB ]


Game Programming with Pyton, Lua and Ruby
Game Programming with Pyton, Lua and Ruby
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net