SlideShare a Scribd company logo
Euphoria
i
AboutTutorial
This tutorial gives you basic understanding of Euphoria programming language.
Euphoria is simple, flexible, easy to learn, and interpreted high-level programming
language for DOS, Windows, Linux, FreeBSD, and more. This tutorial describes
everything a programmer needs to know such as its environment, data types,
syntax and operators, file handling, and controlling the flow of program.
Audience
This tutorial is designed for the aspiring students who are keen to learn and
understand Euphoria in detail. This tutorial would be of great help for the IT
professionals working as programmers. The enthusiastic readers can access this
tutorial as a source of additional reading.
Prerequisites
Before proceeding with this tutorial, you need to have a basic knowledge of
working on Windows or Linux. You need to be familiar with any programming
language such as C, C++. You need to have sound understanding of operating
system, memory allocation and de-allocation, and basics of efficient programming
and debugging.
Disclaimer&Copyright
 Copyright 2015 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials
Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy,
distribute or republish any contents or a part of contents of this e-book in any
manner without written consent of the publisher. We strive to update the contents
of our website and tutorials as timely and as precisely as possible, however, the
contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides
no guarantee regarding the accuracy, timeliness or completeness of our website
or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at contact@tutorialspoint.com.
Euphoria
ii
TableofContents
About Tutorial.............................................................................................................................................
Audience....................................................................................................................................................i
Prerequisites..............................................................................................................................................i
Disclaimer & Copyright ..............................................................................................................................i
Table of Contents......................................................................................................................................ii
1. EUPHORIA OVERVIEW...........................................................................................................1
Euphoria Features.....................................................................................................................................1
Platform Requirements.............................................................................................................................2
Euphoria Limitations.................................................................................................................................2
Euphoria Licensing ....................................................................................................................................2
2. EUPHORIA ENVIRONMENT....................................................................................................4
Linux, Free BSD Installation.......................................................................................................................4
WIN32 and DOS Installation......................................................................................................................6
Euphoria Interpreters ...............................................................................................................................7
3. BASIC SYNTAX .......................................................................................................................8
First Euphoria Program .............................................................................................................................8
Euphoria Identifiers ..................................................................................................................................8
Reserved Words........................................................................................................................................9
Expressions.............................................................................................................................................10
Blocks of Code ........................................................................................................................................10
Multi-Line Statements ............................................................................................................................10
Escape Characters...................................................................................................................................11
Comments in Euphoria............................................................................................................................11
Euphoria
iii
4. EUPHORIA VARIABLES.........................................................................................................13
Variable Declaration ...............................................................................................................................13
Assigning Values .....................................................................................................................................13
Identifier Scope.......................................................................................................................................14
5. EUPHORIA CONSTANTS.......................................................................................................16
The enums ..............................................................................................................................................17
6. EUPHORIA DATATYPES........................................................................................................19
Euphoria Integers....................................................................................................................................19
Euphoria Atoms ......................................................................................................................................19
Euphoria Sequences................................................................................................................................20
Euphoria Objects.....................................................................................................................................21
7. EUPHORIA OPERATORS.......................................................................................................22
The Arithmetic Operators .......................................................................................................................22
The Relational Operators........................................................................................................................23
The Logical Operators .............................................................................................................................25
The Assignment Operators......................................................................................................................27
Miscellaneous Operators ........................................................................................................................29
Precedence of Euphoria Operators .........................................................................................................30
8. EUPHORIA BRANCHING.......................................................................................................32
The if Statement .....................................................................................................................................32
The if...else Statement ............................................................................................................................33
The if...elsif...else Statement...................................................................................................................34
The if...label...then Statement ................................................................................................................35
Nested if...else Statement.......................................................................................................................36
The switch Statement .............................................................................................................................38
Euphoria
iv
The switch...with fallthru Statement.......................................................................................................39
The switch....label Statement .................................................................................................................41
The ifdef Statement ................................................................................................................................43
The ifdef...elsedef Statement..................................................................................................................45
The ifdef...elsifdef Statement..................................................................................................................46
9. EUPHORIA LOOPS ...............................................................................................................48
While Statement.....................................................................................................................................49
The while....with entry Statement ..........................................................................................................50
The while....label Statement...................................................................................................................51
The loop until Statement ........................................................................................................................53
The loop....with entry Statement............................................................................................................54
The loop....label Statement ....................................................................................................................55
The for Loop............................................................................................................................................57
10. EUPHORIA FLOW CONTROL ................................................................................................60
The exit Statement..................................................................................................................................60
The break Statement ..............................................................................................................................61
The continue Statement..........................................................................................................................63
The retry Statement................................................................................................................................64
The goto Statement................................................................................................................................65
11. SHORT CIRCUIT EVALUATION..............................................................................................67
12. EUPHORIA SEQUENCES.......................................................................................................69
Character String......................................................................................................................................70
String Arrays ...........................................................................................................................................71
Euphoria Structures ................................................................................................................................71
Urinary Operation...................................................................................................................................72
Euphoria
v
Arithmetic Operations ............................................................................................................................72
Command Line Options...........................................................................................................................74
13. EUPHORIA DATE AND TIME.................................................................................................75
The date() Method..................................................................................................................................75
The time() Method..................................................................................................................................77
Date & Time Related Methods................................................................................................................78
14. EUPHORIA PROCEDURES.....................................................................................................79
Procedure Definition...............................................................................................................................79
Calling a Procedure .................................................................................................................................80
Procedure Parameters ............................................................................................................................80
15. EUPHORIA FUNCTIONS .......................................................................................................82
Function Definition .................................................................................................................................82
Calling a Function....................................................................................................................................82
Function Parameters...............................................................................................................................83
The return Statement .............................................................................................................................84
16. EUPHORIA FILE I/O..............................................................................................................85
Displaying on the Screen.........................................................................................................................85
Opening and Closing Files .......................................................................................................................85
The open Method...................................................................................................................................86
The close() Method.................................................................................................................................87
Reading and Writing Files .......................................................................................................................89
The printf() Method................................................................................................................................89
The gets() Method..................................................................................................................................90
File & Directory Related Methods...........................................................................................................92
Euphoria
6
Euphoria stands for End-User Programming with Hierarchical Objects for Robust
Interpreted Applications. Euphoria's first incarnation was created by Robert Craig on
an Atari Mega-ST and it was first released in 1993. It is now maintained by Rapid
Deployment Software.
It is a free, simple, flexible, easy to learn, and interpreted but extremely fast 32-bit
high-level programming language for DOS, Windows, Linux, FreeBSD and more.
Euphoria is being used to develop Windows GUI programs, high-speed DOS games,
and Linux/FreeBSD X Windows programs. Euphoria can also be used for CGI (Web-
based) programming.
EuphoriaFeatures
Here is the list of major features of Euphoria:
 It is a simple, flexible, powerful language definition that is easy to learn and
use.

 It supports dynamic storage allocation which means variables grow or shrink
without the programmer having to worry about allocating and freeing the
memory. It takes care of garbage collection automatically.

 It is extremely faster than conventional interpreters such as Perl and Python.

 Euphoria programs run under Linux, FreeBSD, 32-bit Windows, and any DOS
environment.

 Euphoria programs are not subject to any 640K memory limitations.

 It provides an optimizing Euphoria-To-C translator which you can use to
translate your Euphoria program into C and then compile it with a C compiler
to get an executable (.exe) file. This can boost your program speed by 2 to 5
times.

 Underlying hardware are completely hidden which means programs are not
aware of word-lengths, underlying bit-level representation of values, byte-
order etc.

1. EUPHORIA OVERVIEW
Euphoria
7
 Euphoria installation comes along with a full-screen source debugger, an
execution profiler, and a full-screen multi-file editor.

 It supports run-time error-handling, subscript, and type checking.
 It is an open source language and comes completely free of cost.
PlatformRequirements
Euphoria is available on Windows, Linux, FreeBSD, and OSX. Here is the bare
minimum version required with the following platforms −
 WIN32 version: You need Windows 95 or any later version of Windows. It
runs fine on XP and Vista.

 Linux version: You need any reasonably up-to-date Linux distribution, that
has libc6 or later. For example, Red Hat 5.2 or later works fine.

 FreeBSD version: You need any reasonably up-to-date FreeBSD distribution.

 Mac OS X version: You need any reasonably up-to-date Intel based Mac.
EuphoriaLimitations
 Here are some prominent limitations of Euphoria:

 Even though Euphoria is simple, fast, and flexible enough for the
programmers; it does not provide call support for many important
functionalities. For example, network programming.

 Euphoria was invented in 1993, and still you would not find any book written
on this language. There is also not much documentation available for the
language.
But these days, the language is getting popular very fast and you can hope to have
nice utilities and books available for the language very soon.
EuphoriaLicensing
This product is free and open source, and has benefited from the contributions of
many people. You have complete royalty-free rights to distribute any Euphoria
programs that you develop.
Euphoria
8
Icon files, such as euphoria.ico and binaries available in euphoriabin, may be
distributed with or without your changes.
You can shroud or bind your program and distribute the resulting files royalty-free.
Some additional 3rd
party legal restrictions might apply when you use the Euphoria-
To-C translator.
The generous Open Source License allows Euphoria to use for both personal and
commercial purposes. Unlike many other open source licenses, your changes do not
have to be made open source.
Euphoria
9
This chapter describes about the installation of Euphoria on various platforms. You
can follow the steps to install Euphoria on Linux, FreeBSD, and 32-bit Windows. So
you can choose the steps based on your working environment.
Linux,FreeBSDInstallation
Official website provides .tar.gz file to install Euphoria on your Linux or BSD OS. You
can download your latest version of Euphoria from its official website Download
Euphoria.
Once you have .tar.gz file, here are three simple steps to be performed to install
Euphoria on your Linux or Free BSD machine:
Step 1: Installing Files
Untar the downloaded file euphoria-4.0b2.tar.gz in a directory where you want to
install Euphoria. If you want to install it in /home directory as follows, then:
$cp euphoria-4.0b2.tar.gz /home
$cd /home
$gunzip euphoria-4.0b2.tar.gz
$tar -xvf euphoria-4.0b2.tar
This creates a directory hierarchy inside /home/euphoria-4.0b2 directory as
follows:
$ls -l
-rw-r--r-- 1 1001 1001 2485 Aug 17 06:15 Jamfile
-rw-r--r-- 1 1001 1001 5172 Aug 20 12:37 Jamrules
-rw-r--r-- 1 1001 1001 1185 Aug 13 06:21 License.txt
drwxr-xr-x 2 1001 1001 4096 Aug 31 10:07 bin
drwxr-xr-x 7 1001 1001 4096 Aug 31 10:07 demo
2. EUPHORIA ENVIRONMENT
Euphoria
10
-rw-r--r-- 1 1001 1001 366 Mar 18 09:02 file_id.diz
drwxr-xr-x 4 1001 1001 4096 Aug 31 10:07 include
-rw-r--r-- 1 1001 1001 1161 Mar 18 09:02 installu.doc
drwxr-xr-x 4 1001 1001 4096 Aug 31 10:07 source
drwxr-xr-x 19 1001 1001 4096 Sep 7 12:09 tests
drwxr-xr-x 2 1001 1001 4096 Aug 31 10:07 tutorial
Note: File name euphoria-4.0b2.tar.gz depends on latest version available. We are
using 4.0b2 version of the language for this tutorial.
Step 2: Setting Up the Path
After installing Euphoria, you need to set proper paths so that your shell can find
required Euphoria binaries and utilities. Before proceeding, there are following three
important environment variables you need to set up:
1. Set PATH environment variable to point /home/euphoria-4.0b2/bin directory.
2. Set EUDIR environment variable to point to /home/euphoria-4.0b2.
3. Set EUINC environment variable to point to /home/euphoria-4.0b2/include.
These variables can be set as follows −
$export PATH=$PATH:/home/euphoria-4.0b2/bin
$export EUDIR=/home/euphoria-4.0b2
$export EUINC=/home/euphoria-4.0b2/include
Note: The above commands used to set environment variables may differ depending
on your Shell. We used bash shell for executing these commands to set the variables.
Step 3: Confirming Installation
Confirm if you installed Euphoria successfully or not.
Execute the following command:
$eui -version
If you get following result, then it means you have installed Euphoria successfully;
otherwise you have to go back and check all the steps again.
Euphoria
11
$eui -version
Euphoria Interpreter 4.0.0 beta 2 (r2670) for Linux
Using System Memory
$
That is it, Euphoria Programming Environment is ready on your UNIX machine, and
you can start writing complex programs in easy steps.
WIN32andDOSInstallation
Official website provides .exe file to install Euphoria on your WIN32 or DOS OS. You
can download your latest version of Euphoria from its official website Download
Euphoria.
Once you have .exe file, here are three simple steps to follow for installing Euphoria
Programming language on your WIN32 or DOS machine:
Step 1: Installing Files
Double click on the downloaded .exe setup program to install all the files. We
downloaded euphoria-40b2.exe file for installation.
The filename euphoria-40b2.exe depends on latest version available. We use version
4 beta 2 of the language.
By default Euphoria would be installed in C:euphoria-40b2 directory but you can also
select a desired location.
Step 2: Rebooting the Machine
Re-boot your machine to complete the installation.
Step 3: Confirming Installation
Confirm if you installed Euphoria successfully or not.
Execute the following command:
c:>eui -version
If you get following result, then it means you have installed Euphoria successfully;
otherwise you have to go back and check all the steps again.
Euphoria
12
c:>eui -version
Euphoria Interpreter 4.0.0 beta 2 (r2670) for Windows
Using Managed Memory
c:>
That is it, Euphoria Programming Environment is ready on your WIN32 machine, and
you can start writing complex programs in easy steps.
EuphoriaInterpreters
 Depending on the platform you are using, Euphoria has multiple interpreters:
 The main interpreter is eui.
 On windows platforms, you have two choices. If you run eui then a console
window is created. If you run euiw then no console is created, making it
suitable for GUI applications.

 Euphoria does not care about your choice of file extensions. By convention
however; the console-based applications come with .ex extension.

 GUI-based applications have .exw extension and the include files have .e
extension.
Euphoria
13
The Euphoria language has many similarities to Perl, C, and Java. However, there are
some definite differences between the languages. This chapter is designed to quickly
get you up to speed on the syntax that is expected in Euphoria.
This tutorial assumes you are working with Linux and all the examples have been
written on Linux platform. But it is observed that there is no any prominent difference
in program syntax on Linux and WIN32. Hence you can follow the same steps on
WIN32.
FirstEuphoriaProgram
Let us write a simple Euphoria program in a script. Type the following source code in
test.ex file and save it.
#!/home/euphoria-4.0b2/bin/eui
puts(1, "Hello, Euphoria!n")
Let us say, Euphoria interpreter is available in /home/euphoria-4.0b2/bin/ directory.
Now run this program as follows:
$ chmod +x test.ex # This is to make file executable
$ ./test.ex
This would produce the following result:
Hello, Euphoria!
This script used a built-in function puts() which takes two arguments. First argument
indicates file name or device number, and second argument indicates a string which
you want to print. Here 1 indicates STDOUT device.
3. BASIC SYNTAX
Euphoria
14
EuphoriaIdentifiers
A Euphoria identifier is a name used to identify a variable, function, class, module,
or other object. An identifier starts with a letter A to Z or a to z and then followed by
letters, digits, or underscores.
Euphoria does not allow punctuation characters such as @, $, and % within
identifiers.
Euphoria is a case sensitive programming language. Thus Manpower and
manpower are two different identifiers in Euphoria. For example, the valid identifiers
are:
 n
 color26
 ShellSort
 quick_sort
 a_very_long_indentifier
ReservedWords
The following list shows the reserved words in Euphoria. These reserved words may
not be used as constant or variable or any other identifier names. Euphoria keywords
contain lowercase letters only.
and exit override
as export procedure
break fallthru public
by for retry
case function return
constant global routine
Euphoria
15
continue goto switch
do if then
else ifdef to
elsedef include type
elsif label until
elsifdef loop while
end namespace with
entry not without
enum or xor
Expressions
Euphoria lets you calculate results by forming expressions. However, in Euphoria you
can perform calculations on entire sequences of data with one expression.
You can handle a sequence much as you would handle a single number. It can be
copied, passed to a subroutine, or calculated upon as a unit. For example:
{1,2,3} + 5
This is an expression that adds the sequence {1, 2, 3} and the atom 5 to get the
resulting sequence {6, 7, 8}. You would learn sequences in subsequent chapters.
BlocksofCode
One of the first caveats programmers encounter when learning Euphoria is the fact
that there are no braces to indicate blocks of code for procedure and function
definitions or flow control. Blocks of code are denoted by associated keywords.
Euphoria
16
The following example shows if...then...end if block:
if condition then
code block comes here
end if
Multi-LineStatements
Statements in Euphoria typically end with a new line. Euphoria does however, allow
to write a single statement in multiple lines. For example:
total = item_one +
item_two +
item_three
EscapeCharacters
Escape characters may be entered using a back-slash. For example:
The following table is a list of escape or non-printable characters that can be
represented with backslash notation.
Backslash notation Description
n Newline
r Carriage return
t Tab
 Backslash
" Double quote
' Single quote
Euphoria
17
CommentsinEuphoria
Any comments are ignored by the compiler and have no effect on execution speed.
It is advisable to use more comments in your program to make it more readable.
There are three forms of comment text:
1. Comments start by two dashes and extend to the end of the current line.
2. The multi-line format comment is kept inside /*...*/, even if that occurs on a different line.
3.
4. You can use a special comment beginning with the two character sequence “#!” only on the first
line of the program.
Example
#!/home/euphoria-4.0b2/bin/eui
-- First comment
puts(1, "Hello, Euphoria!n") -- second comment
/* This is a comment which extends over a number
of text lines and has no impact on the program
*/
This will produce the following result:
Hello, Euphoria!
Note: On the first line (only) of your program, you can use a special comment
beginning with “#!”. This informs the Linux shell that your file should be executed by
the Euphoria interpreter.
Euphoria
18
End of ebook preview
If you liked what you saw…
Buy it from our store @ https://store.tutorialspoint.com

More Related Content

What's hot

Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
HarikaReddy115
 
Ios tutorial
Ios tutorialIos tutorial
Ios tutorial
Rkar007
 
Javascript tutorial
Javascript tutorialJavascript tutorial
Javascript tutorial
Doeun KOCH
 
Pascal tutorial
Pascal tutorialPascal tutorial
Pascal tutorial
HarikaReddy115
 
Python3 tutorial
Python3 tutorialPython3 tutorial
Python3 tutorial
HarikaReddy115
 
C standard library_tutorial
C standard library_tutorialC standard library_tutorial
C standard library_tutorial
HarikaReddy115
 
Tcl tk tutorial
Tcl tk tutorialTcl tk tutorial
Tcl tk tutorial
dftmaterialslakshmi
 
Jsf tutorial
Jsf tutorialJsf tutorial
Jsf tutorial
HarikaReddy115
 
Fortran tutorial
Fortran tutorialFortran tutorial
Fortran tutorial
HarikaReddy115
 
Go tutorial
Go tutorialGo tutorial
Go tutorial
Muhammed Hassan M
 
Learn c standard library
Learn c standard libraryLearn c standard library
Learn c standard library
Ashoka Vanjare
 
Go tutorial
Go tutorialGo tutorial
Go tutorial
HarikaReddy115
 
Asp.net mvc tutorial
Asp.net mvc tutorialAsp.net mvc tutorial
Asp.net mvc tutorial
HarikaReddy115
 
Javafx tutorial
Javafx tutorialJavafx tutorial
Javafx tutorial
HarikaReddy115
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
HarikaReddy115
 
php lessons
php lessonsphp lessons
php lessons
Abdo Magdi
 

What's hot (16)

Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
Ios tutorial
Ios tutorialIos tutorial
Ios tutorial
 
Javascript tutorial
Javascript tutorialJavascript tutorial
Javascript tutorial
 
Pascal tutorial
Pascal tutorialPascal tutorial
Pascal tutorial
 
Python3 tutorial
Python3 tutorialPython3 tutorial
Python3 tutorial
 
C standard library_tutorial
C standard library_tutorialC standard library_tutorial
C standard library_tutorial
 
Tcl tk tutorial
Tcl tk tutorialTcl tk tutorial
Tcl tk tutorial
 
Jsf tutorial
Jsf tutorialJsf tutorial
Jsf tutorial
 
Fortran tutorial
Fortran tutorialFortran tutorial
Fortran tutorial
 
Go tutorial
Go tutorialGo tutorial
Go tutorial
 
Learn c standard library
Learn c standard libraryLearn c standard library
Learn c standard library
 
Go tutorial
Go tutorialGo tutorial
Go tutorial
 
Asp.net mvc tutorial
Asp.net mvc tutorialAsp.net mvc tutorial
Asp.net mvc tutorial
 
Javafx tutorial
Javafx tutorialJavafx tutorial
Javafx tutorial
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
php lessons
php lessonsphp lessons
php lessons
 

Similar to Euphoria tutorials

Learn c programming e-books
Learn c programming e-booksLearn c programming e-books
Learn c programming e-books
Kingsman90
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
Ankit Dubey
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
عمر عبد
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
31433143
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
Soham Gajjar
 
C language programming (description in simple words)
C language programming (description in simple words)C language programming (description in simple words)
C language programming (description in simple words)
mujeeb memon
 
c programming tutorial...................
c programming tutorial...................c programming tutorial...................
c programming tutorial...................
rtambade13
 
C Tutorials.pdf
C Tutorials.pdfC Tutorials.pdf
C Tutorials.pdf
Sunil Kumar
 
Learn c programming
Learn c programmingLearn c programming
Learn c programming
Ashoka Vanjare
 
C Programming Tutorial
C Programming TutorialC Programming Tutorial
C Programming Tutorial
suthi
 
Gprs tutoialc
Gprs tutoialcGprs tutoialc
Gprs tutoialc
sushsky1
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
1333sample
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
Petcu Catalin Emil
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
HarikaReddy115
 
Software engineering
Software engineering Software engineering
Software engineering
Pallav
 
Intellij idea tutorial
Intellij idea tutorialIntellij idea tutorial
Intellij idea tutorial
HarikaReddy115
 
design_pattern_tutorial.pdf
design_pattern_tutorial.pdfdesign_pattern_tutorial.pdf
design_pattern_tutorial.pdf
badrfathallah2
 
Design pattern tutorial
Design pattern tutorialDesign pattern tutorial
Design pattern tutorial
HarikaReddy115
 
Eclipse tutorial
Eclipse tutorialEclipse tutorial
Eclipse tutorial
HarikaReddy115
 

Similar to Euphoria tutorials (20)

Learn c programming e-books
Learn c programming e-booksLearn c programming e-books
Learn c programming e-books
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
C language programming (description in simple words)
C language programming (description in simple words)C language programming (description in simple words)
C language programming (description in simple words)
 
c programming tutorial...................
c programming tutorial...................c programming tutorial...................
c programming tutorial...................
 
C Tutorials.pdf
C Tutorials.pdfC Tutorials.pdf
C Tutorials.pdf
 
Learn c programming
Learn c programmingLearn c programming
Learn c programming
 
C Programming Tutorial
C Programming TutorialC Programming Tutorial
C Programming Tutorial
 
Gprs tutoialc
Gprs tutoialcGprs tutoialc
Gprs tutoialc
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
TUTORIAL DE C
TUTORIAL DE CTUTORIAL DE C
TUTORIAL DE C
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
Cprogramming tutorial
Cprogramming tutorialCprogramming tutorial
Cprogramming tutorial
 
Software engineering
Software engineering Software engineering
Software engineering
 
Intellij idea tutorial
Intellij idea tutorialIntellij idea tutorial
Intellij idea tutorial
 
design_pattern_tutorial.pdf
design_pattern_tutorial.pdfdesign_pattern_tutorial.pdf
design_pattern_tutorial.pdf
 
Design pattern tutorial
Design pattern tutorialDesign pattern tutorial
Design pattern tutorial
 
Eclipse tutorial
Eclipse tutorialEclipse tutorial
Eclipse tutorial
 

More from HarikaReddy115

Dbms tutorial
Dbms tutorialDbms tutorial
Dbms tutorial
HarikaReddy115
 
Data structures algorithms_tutorial
Data structures algorithms_tutorialData structures algorithms_tutorial
Data structures algorithms_tutorial
HarikaReddy115
 
Wireless communication tutorial
Wireless communication tutorialWireless communication tutorial
Wireless communication tutorial
HarikaReddy115
 
Cryptography tutorial
Cryptography tutorialCryptography tutorial
Cryptography tutorial
HarikaReddy115
 
Cosmology tutorial
Cosmology tutorialCosmology tutorial
Cosmology tutorial
HarikaReddy115
 
Control systems tutorial
Control systems tutorialControl systems tutorial
Control systems tutorial
HarikaReddy115
 
Computer logical organization_tutorial
Computer logical organization_tutorialComputer logical organization_tutorial
Computer logical organization_tutorial
HarikaReddy115
 
Computer fundamentals tutorial
Computer fundamentals tutorialComputer fundamentals tutorial
Computer fundamentals tutorial
HarikaReddy115
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
HarikaReddy115
 
Communication technologies tutorial
Communication technologies tutorialCommunication technologies tutorial
Communication technologies tutorial
HarikaReddy115
 
Biometrics tutorial
Biometrics tutorialBiometrics tutorial
Biometrics tutorial
HarikaReddy115
 
Behavior driven development_tutorial
Behavior driven development_tutorialBehavior driven development_tutorial
Behavior driven development_tutorial
HarikaReddy115
 
Basics of computers_tutorial
Basics of computers_tutorialBasics of computers_tutorial
Basics of computers_tutorial
HarikaReddy115
 
Basics of computer_science_tutorial
Basics of computer_science_tutorialBasics of computer_science_tutorial
Basics of computer_science_tutorial
HarikaReddy115
 
Basic electronics tutorial
Basic electronics tutorialBasic electronics tutorial
Basic electronics tutorial
HarikaReddy115
 
Auditing tutorial
Auditing tutorialAuditing tutorial
Auditing tutorial
HarikaReddy115
 
Artificial neural network_tutorial
Artificial neural network_tutorialArtificial neural network_tutorial
Artificial neural network_tutorial
HarikaReddy115
 
Artificial intelligence tutorial
Artificial intelligence tutorialArtificial intelligence tutorial
Artificial intelligence tutorial
HarikaReddy115
 
Antenna theory tutorial
Antenna theory tutorialAntenna theory tutorial
Antenna theory tutorial
HarikaReddy115
 
Analog communication tutorial
Analog communication tutorialAnalog communication tutorial
Analog communication tutorial
HarikaReddy115
 

More from HarikaReddy115 (20)

Dbms tutorial
Dbms tutorialDbms tutorial
Dbms tutorial
 
Data structures algorithms_tutorial
Data structures algorithms_tutorialData structures algorithms_tutorial
Data structures algorithms_tutorial
 
Wireless communication tutorial
Wireless communication tutorialWireless communication tutorial
Wireless communication tutorial
 
Cryptography tutorial
Cryptography tutorialCryptography tutorial
Cryptography tutorial
 
Cosmology tutorial
Cosmology tutorialCosmology tutorial
Cosmology tutorial
 
Control systems tutorial
Control systems tutorialControl systems tutorial
Control systems tutorial
 
Computer logical organization_tutorial
Computer logical organization_tutorialComputer logical organization_tutorial
Computer logical organization_tutorial
 
Computer fundamentals tutorial
Computer fundamentals tutorialComputer fundamentals tutorial
Computer fundamentals tutorial
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
 
Communication technologies tutorial
Communication technologies tutorialCommunication technologies tutorial
Communication technologies tutorial
 
Biometrics tutorial
Biometrics tutorialBiometrics tutorial
Biometrics tutorial
 
Behavior driven development_tutorial
Behavior driven development_tutorialBehavior driven development_tutorial
Behavior driven development_tutorial
 
Basics of computers_tutorial
Basics of computers_tutorialBasics of computers_tutorial
Basics of computers_tutorial
 
Basics of computer_science_tutorial
Basics of computer_science_tutorialBasics of computer_science_tutorial
Basics of computer_science_tutorial
 
Basic electronics tutorial
Basic electronics tutorialBasic electronics tutorial
Basic electronics tutorial
 
Auditing tutorial
Auditing tutorialAuditing tutorial
Auditing tutorial
 
Artificial neural network_tutorial
Artificial neural network_tutorialArtificial neural network_tutorial
Artificial neural network_tutorial
 
Artificial intelligence tutorial
Artificial intelligence tutorialArtificial intelligence tutorial
Artificial intelligence tutorial
 
Antenna theory tutorial
Antenna theory tutorialAntenna theory tutorial
Antenna theory tutorial
 
Analog communication tutorial
Analog communication tutorialAnalog communication tutorial
Analog communication tutorial
 

Recently uploaded

Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 

Recently uploaded (20)

Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 

Euphoria tutorials

  • 1.
  • 2. Euphoria i AboutTutorial This tutorial gives you basic understanding of Euphoria programming language. Euphoria is simple, flexible, easy to learn, and interpreted high-level programming language for DOS, Windows, Linux, FreeBSD, and more. This tutorial describes everything a programmer needs to know such as its environment, data types, syntax and operators, file handling, and controlling the flow of program. Audience This tutorial is designed for the aspiring students who are keen to learn and understand Euphoria in detail. This tutorial would be of great help for the IT professionals working as programmers. The enthusiastic readers can access this tutorial as a source of additional reading. Prerequisites Before proceeding with this tutorial, you need to have a basic knowledge of working on Windows or Linux. You need to be familiar with any programming language such as C, C++. You need to have sound understanding of operating system, memory allocation and de-allocation, and basics of efficient programming and debugging. Disclaimer&Copyright  Copyright 2015 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at contact@tutorialspoint.com.
  • 3. Euphoria ii TableofContents About Tutorial............................................................................................................................................. Audience....................................................................................................................................................i Prerequisites..............................................................................................................................................i Disclaimer & Copyright ..............................................................................................................................i Table of Contents......................................................................................................................................ii 1. EUPHORIA OVERVIEW...........................................................................................................1 Euphoria Features.....................................................................................................................................1 Platform Requirements.............................................................................................................................2 Euphoria Limitations.................................................................................................................................2 Euphoria Licensing ....................................................................................................................................2 2. EUPHORIA ENVIRONMENT....................................................................................................4 Linux, Free BSD Installation.......................................................................................................................4 WIN32 and DOS Installation......................................................................................................................6 Euphoria Interpreters ...............................................................................................................................7 3. BASIC SYNTAX .......................................................................................................................8 First Euphoria Program .............................................................................................................................8 Euphoria Identifiers ..................................................................................................................................8 Reserved Words........................................................................................................................................9 Expressions.............................................................................................................................................10 Blocks of Code ........................................................................................................................................10 Multi-Line Statements ............................................................................................................................10 Escape Characters...................................................................................................................................11 Comments in Euphoria............................................................................................................................11
  • 4. Euphoria iii 4. EUPHORIA VARIABLES.........................................................................................................13 Variable Declaration ...............................................................................................................................13 Assigning Values .....................................................................................................................................13 Identifier Scope.......................................................................................................................................14 5. EUPHORIA CONSTANTS.......................................................................................................16 The enums ..............................................................................................................................................17 6. EUPHORIA DATATYPES........................................................................................................19 Euphoria Integers....................................................................................................................................19 Euphoria Atoms ......................................................................................................................................19 Euphoria Sequences................................................................................................................................20 Euphoria Objects.....................................................................................................................................21 7. EUPHORIA OPERATORS.......................................................................................................22 The Arithmetic Operators .......................................................................................................................22 The Relational Operators........................................................................................................................23 The Logical Operators .............................................................................................................................25 The Assignment Operators......................................................................................................................27 Miscellaneous Operators ........................................................................................................................29 Precedence of Euphoria Operators .........................................................................................................30 8. EUPHORIA BRANCHING.......................................................................................................32 The if Statement .....................................................................................................................................32 The if...else Statement ............................................................................................................................33 The if...elsif...else Statement...................................................................................................................34 The if...label...then Statement ................................................................................................................35 Nested if...else Statement.......................................................................................................................36 The switch Statement .............................................................................................................................38
  • 5. Euphoria iv The switch...with fallthru Statement.......................................................................................................39 The switch....label Statement .................................................................................................................41 The ifdef Statement ................................................................................................................................43 The ifdef...elsedef Statement..................................................................................................................45 The ifdef...elsifdef Statement..................................................................................................................46 9. EUPHORIA LOOPS ...............................................................................................................48 While Statement.....................................................................................................................................49 The while....with entry Statement ..........................................................................................................50 The while....label Statement...................................................................................................................51 The loop until Statement ........................................................................................................................53 The loop....with entry Statement............................................................................................................54 The loop....label Statement ....................................................................................................................55 The for Loop............................................................................................................................................57 10. EUPHORIA FLOW CONTROL ................................................................................................60 The exit Statement..................................................................................................................................60 The break Statement ..............................................................................................................................61 The continue Statement..........................................................................................................................63 The retry Statement................................................................................................................................64 The goto Statement................................................................................................................................65 11. SHORT CIRCUIT EVALUATION..............................................................................................67 12. EUPHORIA SEQUENCES.......................................................................................................69 Character String......................................................................................................................................70 String Arrays ...........................................................................................................................................71 Euphoria Structures ................................................................................................................................71 Urinary Operation...................................................................................................................................72
  • 6. Euphoria v Arithmetic Operations ............................................................................................................................72 Command Line Options...........................................................................................................................74 13. EUPHORIA DATE AND TIME.................................................................................................75 The date() Method..................................................................................................................................75 The time() Method..................................................................................................................................77 Date & Time Related Methods................................................................................................................78 14. EUPHORIA PROCEDURES.....................................................................................................79 Procedure Definition...............................................................................................................................79 Calling a Procedure .................................................................................................................................80 Procedure Parameters ............................................................................................................................80 15. EUPHORIA FUNCTIONS .......................................................................................................82 Function Definition .................................................................................................................................82 Calling a Function....................................................................................................................................82 Function Parameters...............................................................................................................................83 The return Statement .............................................................................................................................84 16. EUPHORIA FILE I/O..............................................................................................................85 Displaying on the Screen.........................................................................................................................85 Opening and Closing Files .......................................................................................................................85 The open Method...................................................................................................................................86 The close() Method.................................................................................................................................87 Reading and Writing Files .......................................................................................................................89 The printf() Method................................................................................................................................89 The gets() Method..................................................................................................................................90 File & Directory Related Methods...........................................................................................................92
  • 7. Euphoria 6 Euphoria stands for End-User Programming with Hierarchical Objects for Robust Interpreted Applications. Euphoria's first incarnation was created by Robert Craig on an Atari Mega-ST and it was first released in 1993. It is now maintained by Rapid Deployment Software. It is a free, simple, flexible, easy to learn, and interpreted but extremely fast 32-bit high-level programming language for DOS, Windows, Linux, FreeBSD and more. Euphoria is being used to develop Windows GUI programs, high-speed DOS games, and Linux/FreeBSD X Windows programs. Euphoria can also be used for CGI (Web- based) programming. EuphoriaFeatures Here is the list of major features of Euphoria:  It is a simple, flexible, powerful language definition that is easy to learn and use.   It supports dynamic storage allocation which means variables grow or shrink without the programmer having to worry about allocating and freeing the memory. It takes care of garbage collection automatically.   It is extremely faster than conventional interpreters such as Perl and Python.   Euphoria programs run under Linux, FreeBSD, 32-bit Windows, and any DOS environment.   Euphoria programs are not subject to any 640K memory limitations.   It provides an optimizing Euphoria-To-C translator which you can use to translate your Euphoria program into C and then compile it with a C compiler to get an executable (.exe) file. This can boost your program speed by 2 to 5 times.   Underlying hardware are completely hidden which means programs are not aware of word-lengths, underlying bit-level representation of values, byte- order etc.  1. EUPHORIA OVERVIEW
  • 8. Euphoria 7  Euphoria installation comes along with a full-screen source debugger, an execution profiler, and a full-screen multi-file editor.   It supports run-time error-handling, subscript, and type checking.  It is an open source language and comes completely free of cost. PlatformRequirements Euphoria is available on Windows, Linux, FreeBSD, and OSX. Here is the bare minimum version required with the following platforms −  WIN32 version: You need Windows 95 or any later version of Windows. It runs fine on XP and Vista.   Linux version: You need any reasonably up-to-date Linux distribution, that has libc6 or later. For example, Red Hat 5.2 or later works fine.   FreeBSD version: You need any reasonably up-to-date FreeBSD distribution.   Mac OS X version: You need any reasonably up-to-date Intel based Mac. EuphoriaLimitations  Here are some prominent limitations of Euphoria:   Even though Euphoria is simple, fast, and flexible enough for the programmers; it does not provide call support for many important functionalities. For example, network programming.   Euphoria was invented in 1993, and still you would not find any book written on this language. There is also not much documentation available for the language. But these days, the language is getting popular very fast and you can hope to have nice utilities and books available for the language very soon. EuphoriaLicensing This product is free and open source, and has benefited from the contributions of many people. You have complete royalty-free rights to distribute any Euphoria programs that you develop.
  • 9. Euphoria 8 Icon files, such as euphoria.ico and binaries available in euphoriabin, may be distributed with or without your changes. You can shroud or bind your program and distribute the resulting files royalty-free. Some additional 3rd party legal restrictions might apply when you use the Euphoria- To-C translator. The generous Open Source License allows Euphoria to use for both personal and commercial purposes. Unlike many other open source licenses, your changes do not have to be made open source.
  • 10. Euphoria 9 This chapter describes about the installation of Euphoria on various platforms. You can follow the steps to install Euphoria on Linux, FreeBSD, and 32-bit Windows. So you can choose the steps based on your working environment. Linux,FreeBSDInstallation Official website provides .tar.gz file to install Euphoria on your Linux or BSD OS. You can download your latest version of Euphoria from its official website Download Euphoria. Once you have .tar.gz file, here are three simple steps to be performed to install Euphoria on your Linux or Free BSD machine: Step 1: Installing Files Untar the downloaded file euphoria-4.0b2.tar.gz in a directory where you want to install Euphoria. If you want to install it in /home directory as follows, then: $cp euphoria-4.0b2.tar.gz /home $cd /home $gunzip euphoria-4.0b2.tar.gz $tar -xvf euphoria-4.0b2.tar This creates a directory hierarchy inside /home/euphoria-4.0b2 directory as follows: $ls -l -rw-r--r-- 1 1001 1001 2485 Aug 17 06:15 Jamfile -rw-r--r-- 1 1001 1001 5172 Aug 20 12:37 Jamrules -rw-r--r-- 1 1001 1001 1185 Aug 13 06:21 License.txt drwxr-xr-x 2 1001 1001 4096 Aug 31 10:07 bin drwxr-xr-x 7 1001 1001 4096 Aug 31 10:07 demo 2. EUPHORIA ENVIRONMENT
  • 11. Euphoria 10 -rw-r--r-- 1 1001 1001 366 Mar 18 09:02 file_id.diz drwxr-xr-x 4 1001 1001 4096 Aug 31 10:07 include -rw-r--r-- 1 1001 1001 1161 Mar 18 09:02 installu.doc drwxr-xr-x 4 1001 1001 4096 Aug 31 10:07 source drwxr-xr-x 19 1001 1001 4096 Sep 7 12:09 tests drwxr-xr-x 2 1001 1001 4096 Aug 31 10:07 tutorial Note: File name euphoria-4.0b2.tar.gz depends on latest version available. We are using 4.0b2 version of the language for this tutorial. Step 2: Setting Up the Path After installing Euphoria, you need to set proper paths so that your shell can find required Euphoria binaries and utilities. Before proceeding, there are following three important environment variables you need to set up: 1. Set PATH environment variable to point /home/euphoria-4.0b2/bin directory. 2. Set EUDIR environment variable to point to /home/euphoria-4.0b2. 3. Set EUINC environment variable to point to /home/euphoria-4.0b2/include. These variables can be set as follows − $export PATH=$PATH:/home/euphoria-4.0b2/bin $export EUDIR=/home/euphoria-4.0b2 $export EUINC=/home/euphoria-4.0b2/include Note: The above commands used to set environment variables may differ depending on your Shell. We used bash shell for executing these commands to set the variables. Step 3: Confirming Installation Confirm if you installed Euphoria successfully or not. Execute the following command: $eui -version If you get following result, then it means you have installed Euphoria successfully; otherwise you have to go back and check all the steps again.
  • 12. Euphoria 11 $eui -version Euphoria Interpreter 4.0.0 beta 2 (r2670) for Linux Using System Memory $ That is it, Euphoria Programming Environment is ready on your UNIX machine, and you can start writing complex programs in easy steps. WIN32andDOSInstallation Official website provides .exe file to install Euphoria on your WIN32 or DOS OS. You can download your latest version of Euphoria from its official website Download Euphoria. Once you have .exe file, here are three simple steps to follow for installing Euphoria Programming language on your WIN32 or DOS machine: Step 1: Installing Files Double click on the downloaded .exe setup program to install all the files. We downloaded euphoria-40b2.exe file for installation. The filename euphoria-40b2.exe depends on latest version available. We use version 4 beta 2 of the language. By default Euphoria would be installed in C:euphoria-40b2 directory but you can also select a desired location. Step 2: Rebooting the Machine Re-boot your machine to complete the installation. Step 3: Confirming Installation Confirm if you installed Euphoria successfully or not. Execute the following command: c:>eui -version If you get following result, then it means you have installed Euphoria successfully; otherwise you have to go back and check all the steps again.
  • 13. Euphoria 12 c:>eui -version Euphoria Interpreter 4.0.0 beta 2 (r2670) for Windows Using Managed Memory c:> That is it, Euphoria Programming Environment is ready on your WIN32 machine, and you can start writing complex programs in easy steps. EuphoriaInterpreters  Depending on the platform you are using, Euphoria has multiple interpreters:  The main interpreter is eui.  On windows platforms, you have two choices. If you run eui then a console window is created. If you run euiw then no console is created, making it suitable for GUI applications.   Euphoria does not care about your choice of file extensions. By convention however; the console-based applications come with .ex extension.   GUI-based applications have .exw extension and the include files have .e extension.
  • 14. Euphoria 13 The Euphoria language has many similarities to Perl, C, and Java. However, there are some definite differences between the languages. This chapter is designed to quickly get you up to speed on the syntax that is expected in Euphoria. This tutorial assumes you are working with Linux and all the examples have been written on Linux platform. But it is observed that there is no any prominent difference in program syntax on Linux and WIN32. Hence you can follow the same steps on WIN32. FirstEuphoriaProgram Let us write a simple Euphoria program in a script. Type the following source code in test.ex file and save it. #!/home/euphoria-4.0b2/bin/eui puts(1, "Hello, Euphoria!n") Let us say, Euphoria interpreter is available in /home/euphoria-4.0b2/bin/ directory. Now run this program as follows: $ chmod +x test.ex # This is to make file executable $ ./test.ex This would produce the following result: Hello, Euphoria! This script used a built-in function puts() which takes two arguments. First argument indicates file name or device number, and second argument indicates a string which you want to print. Here 1 indicates STDOUT device. 3. BASIC SYNTAX
  • 15. Euphoria 14 EuphoriaIdentifiers A Euphoria identifier is a name used to identify a variable, function, class, module, or other object. An identifier starts with a letter A to Z or a to z and then followed by letters, digits, or underscores. Euphoria does not allow punctuation characters such as @, $, and % within identifiers. Euphoria is a case sensitive programming language. Thus Manpower and manpower are two different identifiers in Euphoria. For example, the valid identifiers are:  n  color26  ShellSort  quick_sort  a_very_long_indentifier ReservedWords The following list shows the reserved words in Euphoria. These reserved words may not be used as constant or variable or any other identifier names. Euphoria keywords contain lowercase letters only. and exit override as export procedure break fallthru public by for retry case function return constant global routine
  • 16. Euphoria 15 continue goto switch do if then else ifdef to elsedef include type elsif label until elsifdef loop while end namespace with entry not without enum or xor Expressions Euphoria lets you calculate results by forming expressions. However, in Euphoria you can perform calculations on entire sequences of data with one expression. You can handle a sequence much as you would handle a single number. It can be copied, passed to a subroutine, or calculated upon as a unit. For example: {1,2,3} + 5 This is an expression that adds the sequence {1, 2, 3} and the atom 5 to get the resulting sequence {6, 7, 8}. You would learn sequences in subsequent chapters. BlocksofCode One of the first caveats programmers encounter when learning Euphoria is the fact that there are no braces to indicate blocks of code for procedure and function definitions or flow control. Blocks of code are denoted by associated keywords.
  • 17. Euphoria 16 The following example shows if...then...end if block: if condition then code block comes here end if Multi-LineStatements Statements in Euphoria typically end with a new line. Euphoria does however, allow to write a single statement in multiple lines. For example: total = item_one + item_two + item_three EscapeCharacters Escape characters may be entered using a back-slash. For example: The following table is a list of escape or non-printable characters that can be represented with backslash notation. Backslash notation Description n Newline r Carriage return t Tab Backslash " Double quote ' Single quote
  • 18. Euphoria 17 CommentsinEuphoria Any comments are ignored by the compiler and have no effect on execution speed. It is advisable to use more comments in your program to make it more readable. There are three forms of comment text: 1. Comments start by two dashes and extend to the end of the current line. 2. The multi-line format comment is kept inside /*...*/, even if that occurs on a different line. 3. 4. You can use a special comment beginning with the two character sequence “#!” only on the first line of the program. Example #!/home/euphoria-4.0b2/bin/eui -- First comment puts(1, "Hello, Euphoria!n") -- second comment /* This is a comment which extends over a number of text lines and has no impact on the program */ This will produce the following result: Hello, Euphoria! Note: On the first line (only) of your program, you can use a special comment beginning with “#!”. This informs the Linux shell that your file should be executed by the Euphoria interpreter.
  • 19. Euphoria 18 End of ebook preview If you liked what you saw… Buy it from our store @ https://store.tutorialspoint.com