A Beginners Guide To Euphoria
Euphoria Programs And The Programming Language
Before any understanding of Euphoria programming is begun, you must first understand what the terms"program" and "programming" mean. A program, simply put, is a series of computer instructions organized in order to complete a given task. For example, this tutorial's task is to teach a newcomer how to program in Euphoria.
It is made up of computer instructions organized in a way so it can carry out that given task. More complex programs may have their primary task broken down into a series of smaller tasks. For example, a spreadsheet program's primary purpose is to organize and calculate numeric data but this is then broken down further into smaller tasks like graphing forecasting, incorporating the computed figures into a report and so
forth. Your very first programs will have very simple tasks, but as you create larger programs, those tasks will become more complex.
To create a program on your computer is referred to as "programming".
You may have also heard of the phrase "coding", which is the same
as "programming". "Coding" comes from the fact that the
instructions that make up a program are sometimes referred to as
"program code". It doesn't really matter what terms you use, just
as long as you understand what they mean. But exactly what do the
individual instructions that make up a program look like? And how
do we enter and group program instructions to create a
program? Just as all words of our vocabulary make up the
English language, a set of all related computer instructions make
up a programming language. The one programming language a computer
understands is called "binary". It's called binary because the
program instructions are made up of two numbers, 1 and 0, like
100101 for example. Binary language is also referred to as
Unfortunately, to write a program in this very difficult language
is beyond the ability of most people, save for a very chosen few.
The very first computers of the 1950's and 1960's could only be
maintained by scientists who had a good understanding of machine
language. As time went on, more understandable and easy to use
programming languages were created. The program instructions of
these languages were more English-like in appearance. Perhaps you
may have seen or heard of some of them, such as BASIC, COBOL, RPG,
ADA, FORTRAN, PASCAL, C and others. Euphoria is the newest form of
computer programming language. For your personal interest,
Euphoria stands for End User Programming with Hierarchical Objects for Robust Interpreted Applications.
Quite a mouthful, but as you will soon discover, the name is the
only difficult part of the Euphoria programming language to
To create a Euphoria program, you first start up an editor program
that lets you enter Euphoria programming instructions, called
"statements". Just as if you were writing a letter, you start
typing at the top of the editor window, and then proceed
downwards. Exactly what you will be typing will be revealed soon.
Understand for now you will require an editor program to do this.
MS-DOS's EDIT program is satisfactory, or you can use ED, which
comes with the Euphoria software. Once you have finished typing
your Euphoria program, you can save it to the hard drive or floppy
drive as a file with .EX as the extension. But you're not finished
just yet. Remember that your computer only understands machine
It cannot understand Euphoria programming statements.
So, it must be converted to machine language.
There are two types of programs that can translate Euphoria to
machine language. Both do the same thing but they differ in their
methods. One is called a compiler. It takes a Euphoria program and
creates a machine language program. This machine language replica
has the same name as your Euphoria program, but has a different
file extension of .EXE. The other type of translator program is
called an interpreter. It translates each Euphoria program
statement to a machine language instruction, which is then run.
This differs from a compiler, which creates the entire program to
be run. Euphoria both comes with a compiler (BIND.BAT) and an
interpreter (EX.EXE). To run a program using EX.EXE, you type:
To create an executable using BIND.BAT, you type:
When the executable is created, type:
The Euphoria program that BIND.BAT will translate into
a machine language program is called a "source file". The machine
language program is called an "object file". EX.EXE generates "object
code". Sometimes it may not be possible to successfully translate
your Euphoria program to machine language. While entering Euphoria
statements, it is possible you may misspell a word. Just as we
have spelling and grammar rules in the written language, Euphoria
also demands we follow set rules when typing in these statements.
When a spelling or grammar type error is made during the typing in
of these statements, it's referred to as a "syntax error". When
your compiler encounters this error in your program while trying
to translate it to machine language, it will stop. You will then
see a message explaining what the error is, and where it is in
your Euphoria program. You then start up your editor, correct the
statement in error and try to run the compiler or interpreter
All programs, no matter what purpose each serves, perform one
function. They all process data. This processing of data is broken
down into the following three stages listed below:
No doubt all of this has you eager to start learning how to write
your own Euphoria programs. Well, let's get started on learning
the actual concepts and instruction statements of the Euphoria
- A program will accept data. The data
will consist of numeric figures from either an external source (a
keyboard, mouse, digital camera,or voice card) or from somewhere inside
the computer (such as a file on
a CD-ROM, floppy diskette, or your hard drive).
- A program will analyze the accepted
data. This step involves temporarily storing the data for both
arithmetic calculations and comparison against predefined values, and
then making a decision based on the result of the calculation or
- A program will present data in a
meaningful form. This means either displaying figures on the screen or
printer, storing information on the hard or floppy drive for another
program to use later, or creating
graphics and sound from the computer that has a meaning to the person running the program.