Aikido (programming language)

Aikido (programming language)

infobox programming language
name = Aikido
paradigm = object oriented, multithreading, scripting language, imperative
year = 2003
designer = David Allison, Sun Microsystems
latest release version =
latest release date =
typing = Partially dynamic (duck), weak
implementations = [http://sourceforge.net/projects/aikido Aikido]
influenced_by =
C, C++, Java, JavaScript, Perl, BASIC, Verilog, Ada 83, Pascal
operating_system =
license =
website =

Aikido is a relatively new programming language that can be used for rapid scripting, prototyping and general programming tasks. It was developed in Sun Microsystems Laboratories by David Allisonand released as open source in September 2003. It is a dynamically typed,
object oriented language with built-in multithreading. In somerespects it is similar in functionality to Python,
Perl, JavaScript and Java. Syntactically it is verysimilar to C++ and Java.

Full documentation for the Aikido language is available in the [http://downloads.sourceforge.net/aikido/aikido_prm.pdf Programmers reference manual]

Heritage

The name "Aikido" refers to the Japanese martial art of the same name and waschosen because the language, like the martial art is derived from many other parts, takingthe most desirable aspects of each. The original name for the Aikido language was "Darwin" butthis was such a common name that it was unavailable for use by Sun.

The original use for Aikido was as the control language for an assemblerfor an internal experimental simulation project within Sun Microsystems Laboratories. The language run-timesystem still maintains the hooks necessary to make it into a control language.

Characteristics

Modern scripting languages are used for many tasks ranging from control of the computer operatingsystem to general application programming. The ever increasing speed of computers has made itmuch more feasible to write programs using an interpreted language rather than the traditionalcompiled languages.

Interpreted languages typically run slower than their compiled cousins, but provide much moreflexibility for the programmer, resulting in a much compressed development time.

Aikido is an interpreted language that retains most of the syntactic characteristics of C++. Mostof the elements of the language will be familiar to anyone who understands C++ (or Java, since it isalso derived somewhat from C++).

Design Goals

The Aikido language was designed with a number of goals in mind.

*Familiarity. Anyone who is familiar with programming in C++ or similar languages should recognize the constructs used in Aikido.
*Evolution. There are many desirable features in the multitude of programming languages in existence. Aikido selects the most desirable of these from languages ranging from BASIC to Verilog.
*Speed. Being an interpreted language, Aikido cannot compete with compiled languages in terms of speed. Aikido's speed goal is to be fast enough to be useful in its own right without trying to attain compiled speeds.
*Readability. A program written in Aikido should be readable by a person who did not write it.

Hello world

The Hello world program in Aikido is very simple:

println ("Hello world")

This is executed by the following command in a Unix like shell (assuming that it is saved in a file called "hello.aikido"

$ aikido hello.aikido

The result is

$ aikido hello.aikido Hello world $

Implementations

Aikido is supplied primarily as [http://sourceforge.net/projects/aikido source code] . It is written entirely in C++ and is available for Linux, Mac OS X and Solaris. There is currently no Windows port available.

Language Features

Novel features

Aikido contains a number of novel language features:

;Partially dynamically typed variables:Variables are assigned a value of any type when they are created and cannot change type after that.

var x = 1 var pi = 3.14159265

x = pi // error, cannot change type once defined

This feature reduces programming errors by not permitting arbitrary type changes at runtime. A variable may also be declared as generic thus allowing its type to change.

;Block derivation:In most object oriented languages, a class may be derived from another class forming a class hierarchy. In Aikido, this concept is available for any "block". This includes functions, threads, monitors and enumerations.

;Statement macros:A macro is a textually-replaced name that may be used at the statement level of a program

;Stream operator:The built-in stream operator (->) may be used to stream data to and from devices and program elements.

;Raw native functions:Aikido can invoke code that resides in an external library directly without requiring complex mapping and conversion. This is subject to certain rules.

;Switch statement comparison operators:The "case" limbs of a "switch" statement can contain comparison operators that allow for comparisons other than the normal equality comparison. The operators can be one of "=", "!=", "<", "<=", ">", ">=", "in".

;Smart statement boundary detection:The use of a semicolon (;) character is optional in Aikido. It may be used if desired to separate statements but the language compiler has a special algorithm that is used to detect the end of statements unambiguously. This means that you rarely need to insert a semicolon at the end of a line, unlike most other languages.

Familiar features

In common with many other languages, Aikido provides the following program constructs:

;Variables and constants:A variable is a named program storage location. Variables must be assigned a value when they are declared. Variables and constants are held in scopes and do not interfere with enclosing or non-intersecting scopes. Variables and constants must be declared before use

A variable may also be declared as fully dynamic using the generic keyword. In this case no value need be assigned to it at declaration time

;Type casts:A value can be converted to another type using a cast operation. The syntax is similar the that in C++ but simplified. Casts are always performed at runtime and a specific cast operator may be defined for a class.

;Functions:A function is a program segment that is called and performs some operations before (possibly) returning a value. If no value is explicitly returned, the value none is returned.

A function can be declared as returning a particular type. The actual value returned is cast to the return type at runtime.

;Classes:A class is an object oriented type. They may be derived from other classes to form a "class hierarchy". They provide a set of functions and operators that manipulate instances of the class. The class may take arguments and its constructor is the body of the block.

class Planet (name) extends Object (name) { public function draw (screen) { // draw the planet } }

var earth = new Planet ("earth") earth.draw (screen3)

;Access control:Like C++ and Java, Aikido controls access to all members of blocks. By default membership is "private" but may be made "public" or "protected" using keywords.

;Interfaces:Similar to Java, Aikido provides an interface concept to constitute a contract to provide certain functions in the class. A class may implement one or more interfaces

;Closures and coroutines:A closure in Aikido is an object that contains everything that is needed to invoke a function from any point in the program. This includes the function's static link chain. A closure is created by passing a function name as an argument or by returning it from a function. A coroutine is an extension of a closure that also includes the current state of a function (all data, program counter and registers). A coroutine yields to its caller using the "yield" keyword. It can be resumed inside a "foreach" statement or by calling the "next()" function on the closure.

;Polymorphic functions:Similar to Java, all public functions in a block are be overridden by a block derived from it. This is known as "virtual functions" in C++.

;Static members:Block members may be declared "static" meaning that their memory resides in the outer program level. This allows them to maintain their value.

;Parameters:Block (function, class, etc.) parameters have the following facilities:
*Access control
*Type coercion
*Pass by reference using the "var" keyword
*Variable parameter list using the ellipsis notation
*Default values

The following example shows the various parameter mechanisms

function foo (a, public b, var c, d:int, e = "hello", ...) { // a is private and passed by value // b is public and passed by value // c is passed by reference // d is cast to int on call // e is passed by value and has a default value // more parameters available in "args" variable }

The use of access control for functions is only useful in the case of function derivation.

;Threads:A thread is a "thread of control" in the program and executes independently of other threads.

;Packages: A package is a collection of program constructs collected in one place for use by another program. They may be used to provide libraries.

;Monitors:A monitor is a thread synchronization object that controls access to memory and also provides a signaling facility

;Strings:A string is a sequence of characters. Many operations are available for them including insertion, searching, deletion, shifting, etc.

;Vectors:A vector is a sequence values of any type. They may be manipulated and extended by built-in operations

;Maps:A map is an associative container that maps one value to another.

;Iteration:The iteration constructs of Aikido are similar to those in other languages from the "C" family ("while", "for" and "do..while" loops), but also includes a high-level iteration construct "foreach".

;Selection:The selection facilities include "if" and "switch" statements.

;Enumeration:Aikido provides an enumeration ability that is similar to that provided in Pascal.

;Operator Overloading:The C++ style of operator overloading is provided by Aikido. This is also used to provide type conversions and iterators.

;Lexical Scoping:Similar to languages such as Pascal and Ada, Aikido allows nested definitions for blocks. In this way, a function (or indeed, any block) can be defined within another function to an arbitrary depth.

;Garbage Collection:Aikido uses reference counting garbage collection. It keeps track of all references to objects and deletes the memory when there is nothing referring to them. In addition, a delete operator is available to allow removal of circular references.

In addition, raw memory may be allocated for use in the program using the familiar malloc function. This memory is garbage collected when there are no references remaining. Access to the contents of the memory is performed using the peek and poke facilities, borrowed from the venerable BASIC language.

;Exceptions:Exceptions are very similar to C++ in that you throw a value that is caught using a catch clause. The major difference is that there may only be one catch clause for a try block. Any value may be thrown and caught.

Native functions

An interpreted programming language cannot execute a program independently from the operating system upon which it is running. It must make use of the operating system facilities to perform certain tasks such as input/output, memory allocation, etc. Aikido provides a relatively easy way to invoke code that resides outside the interpreter in an external library. This facility is normally referred to as "native" function access.

Uses

Along with general scripting and programming, Aikido can be used as a control language for alarger application. One such application is Command Line Interpreter where it can be usedto provide a built-in scripting ability.

Whenever the Aikido interpreter comes across a section of code that it does not understand, it has the ability to pass this off to another program known as a "worker". This worker programcan then use this unrecognized text as a command.

Comparison with other languages

Aikido is in part derived from the syntax and semantics of other programming languages.

C++

Aikido's syntactic constructs are mostly derived from the C++ programminglanguage. The expression syntax is almost exactly like C++ with some extensions forhigher level constructs. The object orientation is similar to C++ except that multiple inheritance is not available.

Java

Java is also a language that is similar in construct to C++. Aikido takes a number ofJava's constructs in favor of similar constructs in C++. For example, the object oriented class structure is Java-like in that is provides single inheritance, uses "extends" for derivation and provides interfaces.

Pascal

Niklaus Wirth's Pascal language provides a number of features that Aikidohas borrowed. In particular, the lexical structure of an Aikido program is similar tothat in Pascal. This is known as lexical scoping and allows a nested blockto access the variables in an enclosing block. Some syntactic elements are also derived fromPascal. For example, the use of the keyword "var" to denote call by referencein function formal argument lists.

Python

Python and Aikido are quite similar in some respects, but vastly different in others. Syntactically,Aikido is a lot different from Python, the former being derived from the Cfamily of languages, and the latter having a unique syntactic style. Despite their differences, Aikidoand Python share a similar goal and runtime ability. The runtime libraries for both languages arevery similar, with Python having a much richer set of functions.

JavaScript

Aikido is very similar to the JavaScript language. Syntactically it is almost identical, but one major difference is the object orientation features. JavaScript uses a prototype style of inheritance where Aikidouses a traditional class hierarchy.

Runtime library

Aikido's runtime library is relatively small in comparison to otherlanguages. A lot of the features normally found in runtime librariesin other language systems are built in to the Aikido interpreter. Forexample, Aikido provides extensive string manipulation operationsin the interpreter itself rather than relying on calls to an externallibrary.

Most of the library functions and classes are used to provide operatingsystem access facilities. For example, runtime library functions areavailable to access the operating system shell.

The runtime library is accessed in an Aikido program by importing one of thefew files contained in the Aikido package. Once imported, the functions andclasses of that section of the runtime library can be used in the program.

Patents

Many of the features and facilities in Aikido are subject to a number of US patents:

*cite web
url=http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=7146601.PN.&OS=PN/7146601&RS=PN/7146601
title=US Patent 7,146,601 - Method and apparatus for deriving functions from other functions in a programming language

*cite web
url=http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=7028289.PN.&OS=PN/7028289&RS=PN/7028289
title=US Patent 7,028,289 - Stream operator in a dynamically typed programming language

*cite web
url=http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=6925640.PN.&OS=PN/6925640&RS=PN/6925640
title=US Patent 6,925,640 - Method and apparatus for extending a program element in a dynamically typed programming language

*cite web
url=http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=7003764.PN.&OS=PN/7003764&RS=PN/7003764
title=US Patent 7,003,764 - Method and apparatus for dynamic configuration of a lexical analysis parser

*cite web
url=http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.htm&r=1&f=G&l=50&s1=6988265.PN.&OS=PN/6988265&RS=PN/6988265
title=US Patent 6,988,265 - Method and apparatus for statement boundary detection

External references

*cite web
url=http://sourceforge.net/projects/aikido
title=Aikido Language System

*cite web
url=http://downloads.sourceforge.net/aikido/aikido_prm.pdf
title=Aikido Programming Reference Manual


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Coroutine — Coroutines are computer program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations. Coroutines are well suited for implementing more familiar program components such as …   Wikipedia

  • Liste des langages de programmation — Le but de cette Liste des langages de programmation est d inclure tous les langages de programmation existants, qu ils soient actuellement utilisés ou historiques, par ordre alphabétique. Ne sont pas listés ici les langages informatiques de… …   Wikipédia en Français

  • Matematička gimnazija — Beograd Mathematical Gymnasium Belgrade Address Kraljice Natalije 37 Belgrade Serbia …   Wikipedia

  • University of Sussex — Infobox University name = University of Sussex latin name = image size = 185px caption = motto = Be still and know established = 1961 type = [New] endowment = staff = 2120cite web | url=http://www.sussex.ac.uk/Units/staffing/personnl/newstaff/news… …   Wikipedia

  • japan — japanner, n. /jeuh pan /, n., adj., v., japanned, japanning. n. 1. any of various hard, durable, black varnishes, originally from Japan, for coating wood, metal, or other surfaces. 2. work varnished and figured in the Japanese manner. 3. Japans,… …   Universalium

  • Japan — /jeuh pan /, n. 1. a constitutional monarchy on a chain of islands off the E coast of Asia: main islands, Hokkaido, Honshu, Kyushu, and Shikoku. 125,716,637; 141,529 sq. mi. (366,560 sq. km). Cap.: Tokyo. Japanese, Nihon, Nippon. 2. Sea of, the… …   Universalium

  • Bilkent University — Infobox University name=Bilkent University native name=Bilkent Üniversitesi motto=Veritas established=1984 type=Private (Foundation university) rector=Prof. Dr. Ali Doğramacı provost= Prof. Dr. Abdullah Atalar students=12,000 city=Ankara… …   Wikipedia

  • Kata — For other uses, see Kata (disambiguation). Kata Solo training of kata is the primary form of practice in some martial arts, such as iaidō. Japanese name …   Wikipedia

  • Richard Waldinger — Richard J. Waldinger is a computer science researcher at SRI Artificial Intelligence Laboratory (where he has worked since 1969) whose interests focus on the application of automated deductive reasoning to problems in software engineering and… …   Wikipedia

  • police — /peuh lees /, n., v., policed, policing. n. 1. Also called police force. an organized civil force for maintaining order, preventing and detecting crime, and enforcing the laws. 2. (used with a pl. v.) members of such a force: Several police are… …   Universalium

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”