Parrot assembly language
Encyclopedia
The Parrot assembly language (PASM) is the basic assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

 used by the Parrot virtual machine
Parrot virtual machine
Parrot is a register-based process virtual machine designed to run dynamic languages efficiently. It uses just-in-time compilation for speed to reduce the interpretation overhead. It is currently possible to compile Parrot assembly language and PIR to Parrot bytecode and execute it...

.

PASM is the lowest level assembly language in the Parrot stack. The Parrot intermediate representation
Parrot intermediate representation
The Parrot intermediate representation , previously called Intermediate code , is one of the two assembly languages for the Parrot virtual machine. The other is Parrot assembly language or PASM...

 (PIR) is PASM extended to simplify development of compilers.

The hello world program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

 in PASM is simply:
print "Hello world!\n"
end

Although it appears similar to source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 in some high-level programming language
High-level programming language
A high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be from the specification of the program, making the process of...

s, more complex PASM programs will resemble other assembly languages. The main exceptions to this low level programming
Low-level programming language
In computer science, a low-level programming language is a programming language that provides little or no abstraction from a computer's instruction set architecture. Generally this refers to either machine code or assembly language...

 in PASM are string handling and, as shown above, input and output. Additionally, PASM has automatic garbage collection
Garbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program...

 from the virtual machine, and it does not allow pointer arithmetic.

Parrot assembly language has more instructions than hardware assembly languages, even CISC
Complex instruction set computer
A complex instruction set computer , is a computer where single instructions can execute several low-level operations and/or are capable of multi-step operations or addressing modes within single instructions...

 processors. This is because the marginal cost
Marginal cost
In economics and finance, marginal cost is the change in total cost that arises when the quantity produced changes by one unit. That is, it is the cost of producing one more unit of a good...

 of creating a new instruction in Parrot is low compared to the marginal cost of doing so in hardware, and the creators of Parrot had no particular goal of minimalism.

External sources

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK