Euphoria (programming language)
Euphoria
openEuphoria logo
openEuphoria logo
Paradigm(s) Imperative, procedural
Appeared in 1993
Designed by Jeremy Cowgar, Robert Craig (original), Matt Lewis, Derek Parnell
Developer openEuphoria Group
Stable release 4.0.3 (June 23, 2011; 4 months ago (2011-06-23))
Typing discipline static, dynamic
OS Cross-platform WIN32, Linux, OSX, FreeBSD, NetBSD, OpenBSD
License BSD
Usual filename extensions .e, .ex, .exw, .edb
Website openeuphoria.org

Euphoria is a programming language originally created by Robert Craig of Rapid Deployment Software[1] in Toronto. Initially developed (though not publicly released) on the Atari ST,[2] the first commercial release[3] was for the 16-bit Microsoft MS-DOS platform and was proprietary. In 2006 (with the release of version 3),[4] Euphoria became open source and the openEuphoria Group[5] continues to administer and develop the project. In December 2010, the openEuphoria Group released version 4[6] of openEuphoria along with a new identity and mascot for the project. OpenEuphoria is currently available for Microsoft Windows, Linux, Mac OS X and three flavors of *BSD.

Euphoria is a general-purpose high-level imperative/procedural interpreted language. A translator generates C source code and the GCC and Open Watcom compilers are supported. Alternatively, Euphoria programs may be bound[7] with the interpreter to create stand-alone executables. A number of GUI libraries are supported including Win32lib[8] and wrappers for wxWidgets,[9] GTK+[10] and IUP.[11] Euphoria has a simple built-in database[12] and wrappers for a variety of other databases.[13]

Contents

Overview

The Euphoria language is a general purpose procedural language that focuses on simplicity, legibility, rapid development and performance.

Simplicity
- The language uses just four built-in data types (see below)
- Automatic garbage collection is implemented.
Legibility
- The syntax favors simple English keywords over the use of punctuation to delineate constructs.
Rapid Development
- Euphoria is interpreted to encourage prototyping and incremental development.
Performance
- Euphoria incorporates an efficient reference-counting garbage collector that correctly handles cyclic references.

History

Developed as a personal project to invent a programming language from scratch, Euphoria was created by Robert Craig[1] on an Atari Mega-ST.[2] Many design ideas for the language came from Craig's Master's Thesis in Computer Science at the University of Toronto.[14] Craig's thesis was heavily influenced by the work of John Backus on functional programming (FP) languages.[14]

Craig ported his original Atari implementation to the 16-bit Microsoft MS-DOS platform and Euphoria was first released (version 1.0) in July, 1993[3] under a proprietary licence. The original Atari implementation is described by Craig as "primitive"[15] and has not been publicly released. Euphoria continued to be developed and released by Craig via his company Rapid Deployment Software (RDS) and website rapideuphoria.com.[1] In October, 2006 RDS released version 3[4] of Euphoria and announced that henceforth Euphoria would be freely distributed under an open source licence.

RDS continued to develop Euphoria, culminating with the release of version 3.1.1 in August, 2007.[14][16] Subsequently, RDS ceased unilateral development of Euphoria and the openEuhporia Group[5] took over ongoing development. The openEuphoria Group released version 4 in December, 2010[17] along with a new logo and mascot for the openEuphoria project.

Version 3.1.1 remains an important milestone release being the last version of Euphoria which supports the Microsoft MS-DOS platform.[18]

Euphoria is an acronym for "End-User Programming with Hierarchical Objects for Robust Interpreted Applications" although there is some suspicion that this is a backronym.

The Euphoria language interpreter was originally written in C. With the release of version 2.5[14] in November, 2004 the Euphoria interpreter was split into two sections: the front-end parser and the back-end interpreter. The front-end (which is also used with the Euphoria-to-C translator and the Binder) is now written in Euphoria. The main back-end and run time library are written in C.

Features

Euphoria was conceived and developed with the following design goals and features:

  • Ease of learning and with consistent high-level constructs (moreso than e.g. the BASIC language)
  • Implementation of flat-form 32-bit memory to avoid complicated memory management and size/addressing limits
  • Debugging support and run-time error-handling
  • Subscript and type checking
  • Loose and strict variable typing
  • Programming via objects as types (user-defined or otherwise)
  • Interpreted, with automatic memory management and garbage collection
  • Heterogeneous collection types (sequences)
  • DOS graphics library (Euphoria language versions up to and including 3.1.1)
  • Debugger
  • Integrated database system
  • Low-level memory handling
  • Straightforward wrapping of (or access to) C libraries

Execution modes

  • Interpreter
  • C translator (E2C) for standalone executables or dynamic linking
  • Bytecode compiler and interpreter (shrouder[7])
  • The Binder[7] binds the Euphoria source code to the interpreter to create an executable.
  • A REPL version is on the openEuphoria roadmap.[19]

Use

Euphoria is designed to readily facilitate the handling of dynamic collections of data of varying types and is particularly useful for string and image processing. Euphoria has been used in artificial intelligence experiments, the study of mathematics, for teaching programming, and to implement fonts involving thousands of characters. A large part of the Euphoria interpreter is written in Euphoria.

Data types

Euphoria has two basic data types:

atom 
A number, implemented as a 31-bit signed integer or a 64-bit IEEE floating-point. Euphoria dynamically changes between integer and floating point representation according to the current value.
sequence 
A vector (array) with zero or more elements. Each element may be an atom or another sequence. The number of elements in a sequence is not fixed (i.e. the size of the vector/array does not have to be declared). The program may add or remove elements as required during run-time. Memory allocation/deallocation is automatically handled by reference counting. Individual elements are referenced using an index value enclosed in square brackets. The first element in a sequence has an index of one [1]. Elements inside embedded sequences are referenced by additional bracked index values, thus X[3][2] refers to the second element contained in the sequence that is the third element of X. Each element of a sequence is an object type (see below).

Euphoria has two additional data types predefined:

integer 
An atom, restricted to 31-bit signed integer values in the range -1073741824 to 1073741823 (-2^30 to 2^30-1). Integer data types are more efficient than the atom data types, but cannot contain the same range of values. Characters are stored as integers, e.g. coding ASCII-'A' is exactly the same as coding 65.
object 
A generic datatype which may contain any of the above (i.e. atom, sequence or integer) and which may be changed to another type during run-time.

There is no character string data type. Strings are represented by a sequence of integer values. However, because literal strings are so commonly used in programming, Euphoria interprets double-quote enclosed characters as a sequence of integers. Thus

"ABC"

is seen as if the coder had written:

{'A', 'B', 'C'}

which is the same as:

{65,66,67}

Hello World

 puts(1,"Hello World!\n")

Examples

Note: Comments start with a double dash "--" and go through the end of line.

The following code looks for an old item in a group of items. If found, it removes it by concatenating all the elements prior to it with all the elements after it. Note that the first element in a sequence has the index one [1] and that $ refers to the length (i.e. total number of elements) of the sequence.

global function delete_item( object old, sequence group )
   integer pos
             -- Code begins --
   pos = find( old, group )
   if pos > 0 then
       group = group[1 .. pos-1] & group[pos+1 .. $]
   end if
   return group
end function

The following modification to the above example replaces an old item with a new item. As the variables old and new have been defined as objects, they could be atoms or sequences. Type checking is not required as the function will work with any sequence of data of any type and requires no external libraries.

global function replace_item( object old, object new, sequence group )
   integer pos
             -- Code begins --
   pos = find( old, group )
   if pos > 0 then
       group[pos] = new
   end if
   return group
end function

Furthermore, no pointers are involved and subscripts are automatically checked. Thus the function cannot access memory out-of-bounds. There is no need to allocate or deallocate memory explicitly and no chance of a memory leak.

The line

group = group[1 .. pos-1] & group[pos+1 .. $]

shows some of the sequence handling facilities. A sequence may contain a collection of any types, and this can be sliced (to take a subset of the data in a sequence) and concatenated in expressions with no need for special functions.

Parameter passing

Arguments to routines are always passed by value; there is no pass-by-reference facility. However, parameters are allowed to be modified locally (i.e. within the callee) which is implemented very efficiently as sequences have automatic copy-on-write semantics. In other words, when you pass a sequence to a routine, initially only a reference to it is passed, but at the point the routine modifies this sequence parameter the sequence is copied and the routine updates only a copy of the original.

Comparable languages

External links

Free downloads of Euphoria for the various platforms, packages, Windows IDE, Windows API libraries, a GTK+ wrapper for Linux, graphics libraries (DOS, OpenGL, etc.).

References

  1. ^ a b c "RapidEuphoria homepage". http://www.rapideuphoria.com/. Retrieved 2010-12-30. 
  2. ^ a b "RapidEuphoria forum, 2002-09-10 by Robert Craig". http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=9&fromYear=7&toMonth=9&toYear=7&keywords=atari. Retrieved 2010-12-30. 
  3. ^ a b "RapidEuphoria forum, 2006-10-18 16:44 by Robert Craig". http://www.rapideuphoria.com/cgi-bin/esearch.exu?toMonth=A&toYear=B&keywords=BBS*. Retrieved 2010-12-30. 
  4. ^ a b "RapidEuphoria forum, 2006-10-18 1:19 by Robert Craig". http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=A&fromYear=B&toMonth=A&toYear=B&keywords=oct+18+1%3A19. Retrieved 2010-12-30. 
  5. ^ a b "openEuphoria group homepage". http://openeuphoria.org. Retrieved 2010-12-30. 
  6. ^ "openEuphoria download page". http://openeuphoria.org/wiki/view/DownloadEuphoria.wc. Retrieved 2010-12-30. 
  7. ^ a b c "openEuhporia manual, Binding and Shrouding". http://openeuphoria.org/docs/bind.html. Retrieved 2011-01-07. 
  8. ^ "Euphoria Win32Lib project at Sourceforge". http://sourceforge.net/projects/win32libex. Retrieved 2010-12-30. 
  9. ^ "Euphoria wxEuphoria project at Sourceforge". http://wxeuphoria.sourceforge.net. Retrieved 2010-12-30. 
  10. ^ "Euphoria GTK+ project at Sourceforge". http://sourceforge.net/projects/eugtk. Retrieved 2010-12-30. 
  11. ^ "Euphoria IUP Project by Jeremy Cowgar". http://jeremy.cowgar.com/euiup. Retrieved 2010-12-30. 
  12. ^ "openEuphoria manual, Database". http://openeuphoria.org/docs/database.html. Retrieved 2010-12-30. 
  13. ^ "openEuphoria wiki, Database Interfaces". http://openeuphoria.org/wiki/view/EuphoriaDatabaseInterfaces.wc. Retrieved 2011-01-02. 
  14. ^ a b c d "RapidEuphoria webiste, release notes". http://www.rapideuphoria.com/relnotes.htm. Retrieved 2010-12-30. 
  15. ^ "RapidEuphoria forum, 2 Mar 1998 13:04 by Robert Craig". http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=3&fromYear=3&toMonth=3&toYear=3&keywords=13%3A04. Retrieved 2010-12-30. 
  16. ^ "RapidEuphoria news". http://www.rapideuphoria.com/news.htm. Retrieved 2010-12-30. 
  17. ^ "openEuphoria release notes". http://openeuphoria.org/docs/relnotes. Retrieved 2010-12-30. 
  18. ^ "openEuhporia manual, Platform Specific Issues". http://openeuphoria.org/docs/platform.html. Retrieved 2010-12-30. 
  19. ^ "openEuphoria roadmap". http://openeuphoria.org/wiki/view/EuphoriaRoadmap.wc. Retrieved 2010-12-30. 


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Microsoft Visual Programming Language — или MVPL  язык визуального и поточного программирования, разработанный корпорацией Microsoft для своей Microsoft Robotics Developer Studio. Microsoft Visual Programming Language выделяется среди прочих языков программирования Microsoft,… …   Википедия

  • Euphoria — or euphoric may refer to: * Euphoria (emotion), a state of very intense happiness and feelings of well being * 4 Methyl aminorex (commonly known as Euphoria or U4EA ), a stimulant drug with effects comparable to methamphetamine. Note: Euphoria is …   Wikipedia

  • Comparison of programming languages (syntax) — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Comparison of programming languages — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Interpreted language — In computer programming an interpreted language is a programming language whose implementation often takes the form of an interpreter. Theoretically, any language may be compiled or interpreted, so this designation is applied purely because of… …   Wikipedia

  • Generational list of programming languages — Here, a genealogy of programming languages is shown. Languages are categorized under the ancestor language with the strongest influence. Of course, any such categorization has a large arbitrary element, since programming languages often… …   Wikipedia

  • Digital Novel Markup Language — Original author(s) Karin (Internet name) Developer(s) J. Miguel Initial release 1998 Stable release 2.24 / 2000 Developm …   Wikipedia

  • List of computing topics — Originally, the word computing was synonymous with counting and calculating, and the science and technology of mathematical calculations. Today, computing means using computers and other computing machines. It includes their operation and usage,… …   Wikipedia

  • List of game engines — Many tools called game engines are available for game designers to code a game quickly and easily without building from the ground up. Contents 1 Free and open source 2 Proprietary 2.1 Commercial 2.2 Freeware …   Wikipedia

Share the article and excerpts

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