euphoria.gif

The Euphoria Programming Language 3.1.1

Contents

1. What is Euphoria?

Euphoria is a simple, flexible, and easy-to-learn programming language. It lets you quickly and easily develop programs for Windows, DOS, Linux and FreeBSD. Euphoria was first released in 1993. Since then Rapid Deployment Software has been steadily improving it with the help of a growing number of enthusiastic users. Although Euphoria provides subscript checking, uninitialized variable checking and numerous other run-time checks, it is extremely fast. People use it to develop Windows GUI programs, high-speed DOS games, and Linux/FreeBSD X Windows programs. It is also very useful for CGI (Web-based) programming.

1.1 Tutorial - Hello World!

with trace
trace(1)

-- Tutorial - Print Hello World on the Screen

-- To run this tutorial,
--        Press Enter to execute the highlighted Euphoria statement.
--        Press F1 to flip to the main output screen.
--        Press F2 to flip back to this trace screen.
--        Read the comments as you go.

-- Step 1: Just to be neat - we'll clear the screen.
-- First, press F1 then F2 (Works best on DOS or DOSBox).
-- Then press Enter:
clear_screen()
-- Check again with F1/F2 - was the screen cleared?

-- Step 2: Let's position the cursor at line 10, column 30
position(10, 30)
-- Is the cursor now at 10,30? Press F1/F2

-- Step 3: Display the text:
puts(1, "Hello World")
-- Is the text there? Press F1/F2

-- Step 4 Output 2 blank lines and we're done
puts(1, "\n\n")

1.2 Example Program

The following is an example of a complete Euphoria program.
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sequence list, sorted_list

function merge_sort(sequence x)
-- put x into ascending order using a recursive merge sort
    integer n, mid
    sequence merged, a, b

    n = length(x)
    if n = 0 or n = 1 then
	return x  -- trivial case
    end if

    mid = floor(n/2)
    a = merge_sort(x[1..mid])       -- sort first half of x
    b = merge_sort(x[mid+1..n])     -- sort second half of x

    -- merge the two sorted halves into one
    merged = {}
    while length(a) > 0 and length(b) > 0 do
	if compare(a[1], b[1]) < 0 then
	    merged = append(merged, a[1])
	    a = a[2..length(a)]
	else
	    merged = append(merged, b[1])
	    b = b[2..length(b)]
	end if
    end while
    return merged & a & b  -- merged data plus leftovers
end function

procedure print_sorted_list()
-- generate sorted_list from list
    list = {9, 10, 3, 1, 4, 5, 8, 7, 6, 2}
    sorted_list = merge_sort(list)
    ? sorted_list
end procedure

print_sorted_list()     -- this command starts the program

-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The above example contains 4 separate commands that are processed in order. The first declares two variables: list and sorted_list to be sequences (flexible arrays). The second defines a function merge_sort(). The third defines a procedure print_sorted_list(). The final command calls procedure print_sorted_list().

The output from the program will be:
 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.

merge_sort() will just as easily sort {1.5, -9, 1e6, 100} or {"oranges", "apples", "bananas"} .

This example is stored as euphoria\tutorial\example.ex. This is not the fastest way to sort in Euphoria. Go to the euphoria\demo directory and type "ex allsorts" to see timings on several different sorting algorithms for increasing numbers of objects. For a quick tutorial example of Euphoria programming see euphoria\demo\bench\filesort.ex.

2. Download Euphoria (32-bit)

Checksum
Euphoria Release Notes
Read Me
How to Install Euphoria on Windows
How to Install Euphoria on Linux or FreeBSD
How to run Euphoria on 64-bit Linux
How to run Euphoria on 64-bit (& 32-bit) FreeBSD
Euphoria Reference Manual Part I - Core Language


Note: all .doc files are actually simple ASCII .txt files.

3. Download Lib2 for Euphoria

Lib2 is an extended standard library for the Euphoria Programming Language version 3.1, with lots of useful functions.

Lib2 includes also the edu IDE with context sensitive help (control-K), syntax coloring and more.

Checksum
Lib2 Release Notes

4. Utilities and Demo Programs

Checksum

6. FAQ

7. About

euphoria.gif
  • Name: Shian.    (The author of Euphoria is Robert Craig).
  • Education: Started Elementary School, then By Shlomo Kalo.
  • Faith: God's Love.
  • Profession: Staring and wondering.
  • Quote: “I am the way, the truth, and the life. No one comes to the Father except through Me." - John 14:6, the New Testament.
  • Contact: s h i a n @ r a p i d e u p h o r i a 3 1 1 . c o m