Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Euphoria (programming language)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Infobox programming language |name = Euphoria |logo = [[File:OpenEuphoria logo.png|openEuphoria logo]] |paradigm = [[Imperative programming|Imperative, procedural]] |released = {{Start date and age|1993}} |designer = Jeremy Cowgar, Robert Craig (original), Matt Lewis, Derek Parnell |developer = [http://openeuphoria.org/ openEuphoria Group] |latest release version = 4.1.0 |latest release date = {{Start date and age|2021|03|01}} |typing = static, dynamic |operating system = [[Cross-platform]]: [[Microsoft Windows|Win32]], [[Linux]], [[macOS]], [[FreeBSD]], [[NetBSD]], [[OpenBSD]] |license = [[BSD licenses|BSD]] |file_ext = .e, .ex, .exw, .edb |influenced by = [[BASIC]] |influenced = [http://phix.x10.mx Phix] |website = {{URL|openeuphoria.org}} }} '''Euphoria''' is a [[programming language]] created by Robert Craig of Rapid Deployment Software<ref name=rehomepage/> in [[Toronto]], [[Ontario]], Canada. Initially developed (though not publicly released) on the [[Atari ST]],<ref name=atari1/> the first commercial release<ref name=firstversion/> was for [[MS-DOS]] as [[proprietary software]]. In 2006, with the release of version 3,<ref name=opensource/> Euphoria became [[open-source software]]. The openEuphoria Group continues to administer and develop the project.<ref name=oehomepage/> In December 2010, the openEuphoria Group released version 4<ref name=oedownload/> of openEuphoria along with a new identity and mascot for the project. OpenEuphoria is currently available for [[Microsoft Windows|Windows]], [[Linux]], [[macOS]] and three flavors of [[Berkeley Software Distribution#Significant BSD descendants|*BSD]]. Euphoria is a general-purpose [[High-level programming language|high-level]] [[Imperative programming|imperative-procedural]] [[interpreter (computing)|interpreted]] language. A [[translator (computers)|translator]] generates [[C (programming language)|C]] [[source code]] and the [[GNU compiler collection]] (GCC) and [[Open Watcom]] compilers are supported. Alternatively, Euphoria programs may be bound<ref name=binding/> with the interpreter to create stand-alone [[executable]]s. A number of [[graphical user interface]] (GUI) libraries are supported including Win32lib<ref name=win32lib/> and [[wrapper function|wrappers]] for [[wxWidgets]],<ref name=wxeuphoria/> [[GTK+]]<ref name=GTK/> and [[IUP (software)|IUP]].<ref name=IUP/> Euphoria has a simple built-in [[database]]<ref name=database/> and wrappers for a variety of other databases.<ref name=oedatabases/> ==Overview== The Euphoria language is a general purpose [[procedural programming|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 (computer science)|garbage collection]]. *''Legibility'' β The syntax favors simple English keywords over the use of punctuation to delineate constructs. *''Rapid development'' β An [[Interpreter (computing)|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<ref name=rehomepage/> on an [[Atari ST|Atari Mega-ST]].<ref name=atari1/> Many design ideas for the language came from Craig's [[Master's degree|Master's]] [[thesis]] in [[computer science]] at the [[University of Toronto]].<ref name=renotes/> Craig's thesis was heavily influenced by the work of [[John Backus]] on [[functional programming]] (FP) languages.<ref name=renotes/> Craig ported his original Atari implementation to the 16-bit [[DOS]] platform and Euphoria was first released, version 1.0, in July 1993<ref name=firstversion/> under a [[proprietary software|proprietary]] licence. The original Atari implementation is described by Craig as "primitive"<ref name=atari2/> 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.<ref name=rehomepage/> In October 2006 RDS released version 3<ref name=opensource/> of Euphoria and announced that henceforth Euphoria would be freely distributed under an [[open-source software]] licence. RDS continued to develop Euphoria, culminating with the release of version 3.1.1 in August, 2007.<ref name=renotes/><ref name=renews/> Subsequently, RDS ceased unilateral development of Euphoria and the openEuphoria Group<ref name=oehomepage/> took over ongoing development. The openEuphoria Group released version 4 in December, 2010<ref name=oenotes/> 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]] platform.<ref name=oeplatform/> 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]].{{according to whom|date=August 2013}} The Euphoria interpreter was originally written in [[C (programming language)|C]]. With the release of version 2.5<ref name=renotes/> 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 system|type checking]] * Loose and strict variable typing * Programming via objects as types (user-defined or otherwise) * Interpreted, with automatic memory management and [[Garbage collection (computer science)|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 [[wrapper function|wrapping]] of (or access to) [[C (programming language)|C]] libraries ==Execution modes== * [[Interpreter (computing)|Interpreter]] * [[C (programming language)|C]] translator (E2C) for standalone executables or [[Dynamic linker|dynamic linking]] * [[Bytecode]] compiler and interpreter (shrouder<ref name=binding/>) * The Binder<ref name=binding/> binds the Euphoria source code to the interpreter to create an executable. * A [[readβevalβprint loop]] (REPL) version is on the openEuphoria [[technology roadmap|roadmap]].<ref name=repl/> ==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]] experiments, the study of [[mathematics]], for teaching programming, and to implement fonts involving thousands of characters.{{citation needed|date=June 2015}} 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 standard|IEEE floating-point]]. Euphoria dynamically changes between integer and floating point representation according to the current value. :Sequence β A [[Array data type|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 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 [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 {{val|-1073741824}} to {{val|1073741823}} ({{tmath|-2^{30} }} to {{tmath|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 (computer science)|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== Program comments start with a double hyphen <code>--</code> 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 [1] and that $ refers to the length (i.e., total number of elements) of the sequence. <span style="color:blue;">global function</span> delete_item( <span style="color:magenta;">object</span> old, <span style="color:magenta;">sequence</span> group ) <span style="color:magenta;">integer</span> pos <span style="color:red;">-- Code begins --</span> pos = <span style="color:magenta;">find</span>( old, group ) <span style="color:blue;">if</span> pos > 0 <span style="color:blue;">then</span> group = group[1 .. pos-1] & group[pos+1 .. $] <span style="color:blue;">end if return</span> group <span style="color:blue;">end function</span> 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. <span style="color:blue;">global function</span> replace_item( <span style="color:magenta;">object</span> old, <span style="color:magenta;">object</span> new, <span style="color:magenta;">sequence</span> group ) <span style="color:magenta;">integer</span> pos <span style="color:red;">-- Code begins --</span> pos = <span style="color:magenta;">find</span>( old, group ) <span style="color:blue;">if</span> pos > 0 <span style="color:blue;">then</span> group[pos] = new <span style="color:blue;">end if return</span> group <span style="color:blue;">end function</span> 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 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]] 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 (programming language)|Lua]] * [http://phix.x10.mx Phix] * [[Python (programming language)|Python]] * [[REBOL]] * [[Nim (programming language)|Nim]] * [[Ruby (programming language)|Ruby]] ==References== {{Reflist|refs= <ref name=rehomepage>{{cite web|url=http://www.rapideuphoria.com/|title=RapidEuphoria homepage|access-date=2010-12-30|archive-url=https://web.archive.org/web/20120711213426/http://www.rapideuphoria.com/|archive-date=2012-07-11|url-status=dead}}</ref> <ref name=atari1> {{cite web|url=http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=9&fromYear=7&toMonth=9&toYear=7&keywords=atari|title=RapidEuphoria forum, 2002-09-10 by Robert Craig|access-date=2010-12-30|url-status=dead|archive-url=https://web.archive.org/web/20110716180721/http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=9&fromYear=7&toMonth=9&toYear=7&keywords=atari|archive-date=2011-07-16}} </ref> <ref name=firstversion> {{cite web|url=http://www.rapideuphoria.com/cgi-bin/esearch.exu?toMonth=A&toYear=B&keywords=BBS*|title=RapidEuphoria forum, 2006-10-18 16:44 by Robert Craig|access-date=2010-12-30|url-status=dead|archive-url=https://web.archive.org/web/20110716180543/http://www.rapideuphoria.com/cgi-bin/esearch.exu?toMonth=A&toYear=B&keywords=BBS%2A|archive-date=2011-07-16}} </ref> <ref name=opensource> {{cite web|url=http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=A&fromYear=B&toMonth=A&toYear=B&keywords=oct+18+1%3A19|title=RapidEuphoria forum, 2006-10-18 1:19 by Robert Craig|access-date=2010-12-30|url-status=dead|archive-url=https://web.archive.org/web/20110716180705/http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=A&fromYear=B&toMonth=A&toYear=B&keywords=oct+18+1%3A19|archive-date=2011-07-16}} </ref> <ref name=oehomepage> {{cite web|url=http://openeuphoria.org|title=openEuphoria group homepage|access-date=2010-12-30}} </ref> <ref name=oedownload> {{cite web|url= http://openeuphoria.org/wiki/view/DownloadEuphoria.wc|title=openEuphoria download page|access-date=2010-12-30}}</ref> <ref name=binding> {{cite web|url=http://openeuphoria.org/docs/bind.html|title=openEuhporia manual, Binding and Shrouding|access-date=2011-01-07}} </ref> <ref name=win32lib> {{cite web|url=http://sourceforge.net/projects/win32libex|title=Euphoria Win32Lib project at Sourceforge|access-date=2010-12-30}}</ref> <ref name=wxeuphoria> {{cite web|url= http://wxeuphoria.sourceforge.net|title=Euphoria wxEuphoria project at Sourceforge|access-date=2010-12-30}} </ref> <ref name=GTK> {{cite web|url=http://sourceforge.net/projects/eugtk|title=Euphoria GTK+ project at Sourceforge|access-date=2010-12-30}} </ref> <ref name=IUP> {{cite web|url=http://jeremy.cowgar.com/euiup|title=Euphoria IUP Project by Jeremy Cowgar|access-date=2010-12-30}} </ref> <ref name=database> {{cite web|url=http://openeuphoria.org/docs/database.html|title=openEuphoria manual, Database|access-date=2010-12-30}} </ref> <ref name=oedatabases> {{cite web|url=http://openeuphoria.org/wiki/view/EuphoriaDatabaseInterfaces.wc|title=openEuphoria wiki, Database Interfaces|access-date=2011-01-02}} </ref> <ref name=renotes>{{cite web|url=http://www.rapideuphoria.com/relnotes.htm|title=RapidEuphoria website, release notes|access-date=2010-12-30|archive-url=https://archive.today/20130104121322/http://www.rapideuphoria.com/relnotes.htm|archive-date=2013-01-04|url-status=dead}}</ref> <ref name=atari2> {{cite web|url=http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=3&fromYear=3&toMonth=3&toYear=3&keywords=13%3A04|title=RapidEuphoria forum, 2 Mar 1998 13:04 by Robert Craig|access-date=2010-12-30|url-status=dead|archive-url=https://web.archive.org/web/20110716180757/http://www.rapideuphoria.com/cgi-bin/esearch.exu?fromMonth=3&fromYear=3&toMonth=3&toYear=3&keywords=13%3A04|archive-date=2011-07-16}} </ref> <ref name=renews>{{cite web|url=http://www.rapideuphoria.com/news.htm|title=RapidEuphoria news|access-date=2010-12-30|archive-url=https://web.archive.org/web/20101216054849/http://www.rapideuphoria.com/news.htm|archive-date=2010-12-16|url-status=dead}}</ref> <ref name=oenotes>{{cite web|url=http://openeuphoria.org/docs/relnotes|title=openEuphoria release notes|access-date=2010-12-30|archive-url=https://web.archive.org/web/20110727150731/http://openeuphoria.org/docs/relnotes|archive-date=2011-07-27|url-status=dead}}</ref> <ref name=oeplatform> {{cite web|url=http://openeuphoria.org/docs/platform.html|title=openEuhporia manual, Platform Specific Issues|access-date=2010-12-30}} </ref> <ref name=repl> {{cite web|url=http://openeuphoria.org/wiki/view/EuphoriaRoadmap.wc|title=openEuphoria roadmap|access-date=2010-12-30}} </ref> }} ==External links== {{commons category|Euphoria}} 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.). * {{Official website|openeuphoria.org}} OpenEuphoria * {{Official website|www.rapideuphoria.com}} RapidEuphoria * [http://openeuphoria.org/wiki/view/home.wc openEuphoria Wiki] * [http://openeuphoria.org/forum/index.wc openEuphoria Forum] * [https://github.com/OpenEuphoria OpenEuphoria Β· GitHub] Development repositories. * [https://web.archive.org/web/20080509094445/http://www.usingeuphoria.com/ Using Euphoria] {{BASIC}} {{DEFAULTSORT:Euphoria (programming language)}} [[Category:Procedural programming languages]] [[Category:Cross-platform software]] [[Category:Programming languages created in 1993]] [[Category:Free educational software]] [[Category:Software using the BSD license]] [[Category:BASIC programming language family]] [[Category:Formerly proprietary software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:According to whom
(
edit
)
Template:BASIC
(
edit
)
Template:Citation needed
(
edit
)
Template:Commons category
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Official website
(
edit
)
Template:Reflist
(
edit
)
Template:Tmath
(
edit
)
Template:Val
(
edit
)