| Imp |
Copyright (c) 1998-1999 Redshift
Software Inc. All Rights Reserved
|
|
|
IMP Introduction |
||
|
What is IMP? IMP is low level, imperative programming language intended for approximately the same kind of tasks that C was originally designed for i.e. system programming, tools, and moderate sized applications. IMP's design goals are pretty much as follows:
A consistent syntax has similar semantics for similar structures and different semantics for different structures. Unfortunately, most programming languages violate this simple concept in a number of ways. C, for example, has constructs that have different semantics for similar syntax and multiple syntactic forms with the same semantics. The static keyword is an example of the first case, since it can restrict the scope of a variable or function, or it can specify that a variable's storage is not allocated on the stack (and therefore survives from one function call to another). On the flip side C has not one, but three different ways to dereference a pointer. (using *,[], and ->) Simplicity in a programming language means that the language has the minimum number of features needed to achieve it's other goals. Simplicity, like small language size, makes it easier to understand the language. Also simplicity can make a language more aesthetically pleasing. IMP omits any feature that is not justified by other design goal. Unfortunately, this goal is more subjective than most and thus it is hard to judge whether IMP (or any language) meets it. Small language size is just what it sounds like. A small language has few syntactic structures and has a small number of features. Like Simplicity, small language size is a matter of judgement, but it is simple enough to point out examples of large languages. Common Lisp and Ada are both large languages. Large languages have the advantage that many things you would like to do already exist in the language. The drawback is that the user pays for a multitude of features with code that may not be as efficient, fast, or small as that produced with a small language. Although it is true that this is less of a problem than it used to be. Small language size makes it easier to have a consistent syntax, and promotes simplicity. Sufficient power to build an operating system basically means that a language must provide a number of features including:
Generality in a programming language means that the language is suitable for a variety of different application types. The usual tradeoff is that the more general a programming language the more complex and larger the language.
Our final design goal is to include a few unusual features in the language. In IMP we include multiple assignment, any number of return values for routines, and a very powerfull conditional statement. We describe each of these features in more detail in the reference section. |
|||
Reference |
|||||||
|
|
1 Lexical |
2 Programs |
3 Declarations |
4 Expressions |
5 Statements |
6 Preprocessor |
7 EBNF |