Euphoria (programming language)
   HOME

TheInfoList



OR:

Euphoria is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
created by Robert Craig of Rapid Deployment Software in
Toronto Toronto ( ; or ) is the capital city of the Canadian province of Ontario. With a recorded population of 2,794,356 in 2021, it is the most populous city in Canada and the fourth most populous city in North America. The city is the anch ...
,
Ontario Ontario ( ; ) is one of the thirteen provinces and territories of Canada.Ontario is located in the geographic eastern half of Canada, but it has historically and politically been considered to be part of Central Canada. Located in Central C ...
, Canada. Initially developed (though not publicly released) on the Atari ST, the first commercial release was for
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
as
proprietary software Proprietary software is software that is deemed within the free and open-source software to be non-free because its creator, publisher, or other rightsholder or rightsholder partner exercises a legal monopoly afforded by modern copyright and i ...
. In 2006, with the release of version 3, Euphoria became
open-source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Op ...
. The openEuphoria Group continues to administer and develop the project. In December 2010, the openEuphoria Group released version 4 of openEuphoria along with a new identity and mascot for the project. OpenEuphoria is currently available for
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, w ...
,
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
and three flavors of *BSD. Euphoria is a general-purpose high-level imperative-procedural interpreted language. A
translator Translation is the communication of the meaning of a source-language text by means of an equivalent target-language text. The English language draws a terminological distinction (which does not exist in every language) between ''transl ...
generates C
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the w ...
and the
GNU compiler collection The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free softwar ...
(GCC) and
Open Watcom Watcom C/C++ (currently Open Watcom C/C++) is an integrated development environment (IDE) product from Watcom International Corporation for the C, C++, and Fortran programming languages. Watcom C/C++ was a commercial product until it was disco ...
compilers are supported. Alternatively, Euphoria programs may be bound with the interpreter to create stand-alone executables. A number of
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inst ...
(GUI) libraries are supported including Win32lib and wrappers for
wxWidgets wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with mini ...
, GTK+ and IUP. Euphoria has a simple built-in
database In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases s ...
and wrappers for a variety of other databases.


Overview

The Euphoria language is a general purpose procedural language that focuses on simplicity, legibility, rapid development and performance via several means. *''Simplicity'' – It uses just four built-in data types (see below) and implements automatic
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
. *''Legibility'' – The syntax favors simple English keywords over the use of punctuation to delineate constructs. *''Rapid development'' – An interpreter encourages prototyping and incremental development. *''Performance'' – An efficient reference-counting garbage collector correctly handles cyclic references.


History

Developed as a personal project to invent a programming language from scratch, Euphoria was created by Robert Craig on an Atari Mega-ST. Many design ideas for the language came from Craig's
Master's A master's degree (from Latin ) is an academic degree awarded by universities or colleges upon completion of a course of study demonstrating mastery or a high-order overview of a specific field of study or area of professional practice.
thesis A thesis ( : theses), or dissertation (abbreviated diss.), is a document submitted in support of candidature for an academic degree or professional qualification presenting the author's research and findings.International Standard ISO 7144: ...
in
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includi ...
at the
University of Toronto The University of Toronto (UToronto or U of T) is a public university, public research university in Toronto, Ontario, Canada, located on the grounds that surround Queen's Park (Toronto), Queen's Park. It was founded by royal charter in 1827 ...
. Craig's thesis was heavily influenced by the work of
John Backus John Warner Backus (December 3, 1924 – March 17, 2007) was an American computer scientist. He directed the team that invented and implemented FORTRAN, the first widely used high-level programming language, and was the inventor of the Backu ...
on
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
(FP) languages. Craig ported his original Atari implementation to the 16-bit
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
platform and Euphoria was first released, version 1.0, in July 1993 under a proprietary licence. The original Atari implementation is described by Craig as "primitive" 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. In October 2006 RDS released version 3 of Euphoria and announced that henceforth Euphoria would be freely distributed under an
open-source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Op ...
licence. RDS continued to develop Euphoria, culminating with the release of version 3.1.1 in August, 2007. Subsequently, RDS ceased unilateral development of Euphoria and the openEuphoria Group took over ongoing development. The openEuphoria Group released version 4 in December, 2010 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
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
platform. Euphoria is an
acronym An acronym is a word or name formed from the initial components of a longer name or phrase. Acronyms are usually formed from the initial letters of words, as in ''NATO'' (''North Atlantic Treaty Organization''), but sometimes use syllables, as ...
for ''End-User Programming with Hierarchical Objects for Robust Interpreted Applications'' although there is some suspicion that this is a
backronym A backronym is an acronym formed from an already existing word by expanding its letters into the words of a phrase. Backronyms may be invented with either serious or humorous intent, or they may be a type of false etymology or folk etymology. The ...
. The Euphoria interpreter was originally written in C. With the release of version 2.5 in November 2004 the Euphoria interpreter was split into two parts: a front-end parser, and a back-end interpreter. The front-end is now written in Euphoria (and used with the Euphoria-to-C translator and the Binder). 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 (more so than, for example, the BASIC language) * Implementation of flat-form 32-bit memory to avoid complex memory management and size-addressing limits * Debugging support and run-time error-handling * Subscript and
type checking In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
* Loose and strict variable typing * Programming via objects as types (user-defined or otherwise) * Interpreted, with automatic memory management and
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
* Heterogeneous collection types (sequences) *
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
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 In computing, a dynamic linker is the part of an operating system that loads and links the shared libraries needed by an executable when it is executed (at " run time"), by copying the content of libraries from persistent storage to RAM, filling ...
*
Bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
compiler and interpreter (shrouder) * The Binder binds the Euphoria source code to the interpreter to create an executable. * A
read–eval–print loop A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written ...
(REPL) version is on the openEuphoria
roadmap A roadmap may refer to: *A road map, a form of map that details roads and transport links *A plan, e.g. **Road map for peace, to resolve the Israeli-Palestinian conflict **Technology roadmap A technology roadmap is a flexible planning schedule ...
.


Use

Euphoria is designed to readily facilitate handling of dynamic sets of data of varying types and is particularly useful for string and image processing. Euphoria has been used in
artificial intelligence Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by animals and humans. Example tasks in which this is done include speech r ...
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 An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
or a 64-bit
IEEE floating-point The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found in ...
. Euphoria dynamically changes between integer and floating point representation according to the current value. :Sequence – A
vector Vector most often refers to: *Euclidean vector, a quantity with a magnitude and a direction *Vector (epidemiology), an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematic ...
(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 needed 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 Elements inside embedded sequences are referenced by additional bracked index values, thus X 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 An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
values in the range to ( to ). ''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 ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
-'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: which is the same as:


Hello, World!

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


Examples

Program comments start with a double hyphen -- 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 before it with all the elements after it. Note that the first element in a sequence has the index one 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 .. pos-1& group os+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 needed as the function will work with any sequence of data of any type and needs 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 os= 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 .. pos-1& group os+1 .. $ shows some of the ''sequence'' handling facilities. A ''sequence'' may contain a set 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 Copy-on-write (COW), sometimes referred to as implicit sharing or shadowing, is a resource-management technique used in computer programming to efficiently implement a "duplicate" or "copy" operation on modifiable resources. If a resource is dupl ...
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

*
Lua Lua or LUA may refer to: Science and technology * Lua (programming language) * Latvia University of Agriculture * Last universal ancestor, in evolution Ethnicity and language * Lua people, of Laos * Lawa people, of Thailand sometimes referred t ...

Phix
*
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
* REBOL * Nim *
Ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called ...


References


External links

Free downloads of Euphoria for the various platforms, packages, Windows IDE, Windows API libraries, a cross-platform GTK3 wrapper for Linux and Windows, graphics libraries (DOS, OpenGL, etc.). * OpenEuphoria * RapidEuphoria
openEuphoria Wiki

openEuphoria Forum

OpenEuphoria · GitHub
Development repositories.
Using Euphoria
{{DEFAULTSORT:Euphoria (programming language) Procedural programming languages Cross-platform software Programming languages created in 1993 Free educational software Software using the BSD license BASIC programming language family Formerly proprietary software