home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
progmisc
/
euphor10.zip
/
GOALS.DOC
< prev
next >
Wrap
Text File
|
1993-06-24
|
9KB
|
164 lines
The Euphoria Programming Language
---------------------------------
Introduction
------------
Euphoria is a new, general purpose, programming language. Euphoria is
currently available for IBM PC compatibles running MS-DOS. It will run
comfortably with 2Mb of memory on any 386/486/Pentium processor.
It is very portable and will soon be available on many platforms.
Why A New Language?
-------------------
The project to develop Euphoria was started because it was felt that there
was no really good language for the average non-professional to use on
their PC. BASIC was outdated years ago. C has grown into ANSI C and into
C++. C is a good language for professional programmers to use in
developing large programs, where performance is critical. There is however
a long learning curve in mastering C or C++. A part-time programmer will have
difficulty in developing proficiency in these languages. Debugging can be
very frustrating and time-consuming. A programmer working for a
large company might be willing to spend all day on a bug. The cost of his
efforts can be recovered by selling many copies of the resulting program.
Programs developed by end users must be developed at minimal
cost or not at all. The time spent developing the program greatly overshadows
the time spent executing the program. Professional compiler packages come with
thousands of pages of documentation, and unfortunately a large number of these
pages must actually be read before you can accomplish anything. End users do
not have time for this. Programming is not something that they wish to devote
their lives to.
Goals
-----
The goal then was to develop a language for end users that was:
- simple
- easy to write
- easy to debug
- practical
It seemed likely that an interpreter would be called for, since
interpreted languages tend to be simpler, more flexible, friendlier,
and provide better debugging facilities. However, interpreters have
acquired a reputation for being very slow, compared to compiled languages.
We wanted to change that. A good deal of research went into developing an
interpreter that would provide all the good things associated with
interpreters while executing programs at blinding speed.
The result of this research was Euphoria.
How did we Achieve these Goals?
-------------------------------
Simplicity
----------
The first goal of Euphoria was "keep it simple". This was achieved by
minimizing the number of different statements, and using only familiar
control-flow statements, such as "if", "while" etc. Most people can understand
the control-flow statements of Euphoria right away without reading the manual.
Euphoria eliminates the need for braces or begin..end brackets around series
of statements. We defined a consistent syntax using:
if ... end if,
while ... end while,
for ... end for
procedure ... end procedure
function ... end function
etc.
This lets you see more clearly which construct is being "ended". When only
braces are used, as in C, it is more difficult to match things up. The
Euphoria editor highlights keywords in blue, making it even easier to see the
structure.
We also eliminated those annoying, and unnecessary semicolons that are
pervasive in many other languages, and cause a large percentage of the
syntax errors. For comments we chose the clearly superior style of having
a marker ,"--", start each comment, and the end of line end it.
For data structures, we adopted the "sequence" as a simple recursive
structure that takes the place of *all* of the complicated structures in other
languages. You can use sequences as arrays, 2-d arrays, n-d arrays, arrays of
structures, arrays of strings etc.
Easy to Write
-------------
One of the tedious aspects of programming in conventional languages is
that you are constantly forced to specify how big things are allowed
to be. This happens at the level of choosing char vs short vs int vs long
for your integers, or double vs float for your floating-point data (or
even choosing between floating point and integer). It also happens at the
level of declaring maximum sizes for all of your arrays. When you pass arrays
to a subroutine you must also pass the size of the array. In Euphoria
everything is dynamic. Sequences can easily grow or shrink from either end or
anywhere in between. You do not have to declare the size of scalar values
(atoms). Say goodbye to malloc() and free() and all the bugs associated with
using them. Programs requiring dynamic allocation/deallocation of storage
become particularly easy to write and to understand.
C programmers must always keep a picture in their minds of the exact layout of
bits and bytes in memory. Euphoria programmers think only of the values they
are manipulating, and not the storage layout or bit-level representation of
those values. In Euphoria, the value 17 is the value 17, period. In C it might
be (char)17 or (short)17 or (int)17 or (unsigned)17 or (float)17 or (double)17
or even (char *)17 etc. What happens when you add (char)-17 to (int)17? All of
this complexity is unnecessary in an applications development language and
Euphoria completely eliminates it. Euphoria frees you to think at the higher
level of pure *values*, rather than having to mess around at the level of bits,
bytes and pointers.
MS-DOS programmers are well aware of the 640K memory limit. Euphoria
destroys this limit by using a 32-bit DOS-extender. Euphoria programs can
effortlessly and seamlessly use the full multi-megabyte memory of your machine.
Euphoria programs are naturally generic. See include\sort.e for
an example of a single subroutine that sorts any type of data -- and does
it several times faster than the MS-DOS sort command.
Easy to Debug
-------------
At all times, Euphoria checks that subscripts or slices of sequences are
in bounds, that variables have been initialized before being used, that
integers overflow nicely into floating point numbers, that more space is
provided for the call stack when necessary, that arguments to built-in
functions are legal values, that you don't return from a function without
specifying a return value, etc. etc.
On top of this, you can precisely restrict the legal values for any variable,
and have this enforced at runtime.
An integrated full-screen source level debugger and a profiler are included.
The debugger/tracer is much easier to use than debuggers for other languages,
as much of what it does is automatic. Variable names and values are updated
automatically on your screen. Even professional programmers will shy away
from using a source debugger, because they haven't used it for a while and
they have forgotten how to get started. Not so in Euphoria.
Practical
---------
Using conventional technology, Euphoria could have been developed
to run at the speed of BASIC. In fact you'd expect it to run *slower* than
BASIC, since data types are not predetermined and fixed, it checks
for uninitialized variables, it has dynamic storage allocation, etc.
In fact, Euphoria programs run 10 to 15 times *faster* than equivalent
programs in Microsoft QBASIC (see demo\bench\readme.doc). This lets you
write programs, such as the Euphoria full-screen color editor, the Mset
plotter, the 3-D wire frame rotator etc. that would be totally impractical
in QBASIC. (see demo directory)
Of course there's more to practicality than speed. Euphoria supplies you with
a set of built-in routines that let you do just about anything on your system
that you can do with languages costing 10 times as much. Don't be fooled by
the 57 different library functions provided by WATCOM C for memory
allocation/deallocation - *none* of those routines are at all necessary in
Euphoria! You can also throw away the 67 different memory and string
manipulation functions - in Euphoria strings are just sequences like
anything else - you don't need special functions to manipulate them!
Conclusion
----------
Euphoria is a simple, elegant, complete, practical, easy to use, and
surprisingly fast language for your PC that we know you will enjoy using.
--> For more details on the language see miniman.doc.
--> C programmers who need more convincing see c.doc.
--> BASIC programmers who need more convincing see basic.doc.