prev | next | contents



  Specifications for
OpenEuphoria v1.0


Document version: 1.4

Document date: 12/03/2004


What is OpenEuphoria ?

   OpenEuphoria is a cross-platform programming language. Inspired by Euphoria (© Rapid Ddevelopment Software, 1993-2003), it will maintain almost full compatibility with Euphoria v2.4 Official release, as released on July 3, 2003. There will be no consistent effort to emulate specific features to appear in future versions of Euphoria. At the same time, OpenEuphoria introduces concepts and features of its own.

   The aim of OpenEuphoria designers is to develop a programming tool which retains the main strengths of Euphoria, while being easier to use and fixing what the designers perceive as some misfeatures of that language. The original statement of aims can be read here.

   OpenEuphoria is an interpreted/compiled language. Basically, a plain text source file is read and converted to some internal bytecode which gets executed. The picture is slightly more complicated when dynamically generated statements are encountered.

   OpenEuphoria interpreters will exist at least for 32-bit Windows ™ systems and Linux/FreeBSD systems. They will be fully reentrant so as to support threaded processes.

   Translators from OpenEuphoria to C or C++ will be also available. As its name suggests, OpenEuphoria is developed in an open source manner, and the source of interpreters should be freely available as a consequence.

Table of Contents

  A STRUCTURAL PRESENTATION.
1 Types.
1.1 Atomic types.
1.2 Nonatomic types.
1.3 Added validations and user-defined types.
1.4 Context types.
1.5 Type checking.
1.5.1 The general case.
1.5.2 Forced type checking.
1.6 Type aliasing.
2 Basic tokens.
2.1 Identifiers.
2.2 Quoted characters.
2.3 Text.
2.4 Numerical items.
2.5 The infinity.
2.6 Comments.
3 Operations.
3.1 Supported operators.
3.1.1 Supported operator list.
3.1.2 Precedence hierarchy.
3.2 Extension to nonatomic types.
3.3 Formation of nonatomic objects.
3.4 Accessing elements of nonatomic objects.
3.5 Staticly accessing parts of nonatomic objects.
3.5.1 Nonempty slices.
3.5.2 Empty slices.
3.6 Dynamically accessing parts of non-atoms.
3.7 Manipulating nonatoms.
3.7.1 Getting information about nonatoms.
3.7.2 Adding elements to sequences.
3.7.3 Removing elements from sequences.
3.7.4 Permutations on nonatoms.
3.7.5 Slice transfers.
3.7.6 Other operations on nonatoms.
3.7.7 A further note about slicing.
4 Condition evaluation.
4.1 Truth tables for <logical>s.
4.1.1 The "and" operator.
4.1.2 The "or" operator.
4.1.3 The "not" operator.
4.1.4 The = operator.
4.2 Short-circuit evaluation.
4.3 Example code: finding an name in an address book.
4.4 Side effects.
5 Variables.
5.1 Properties of a variable.
5.2 Scope of a variable.
5.3 Declaring a variable.
5.3.1 Type of a variable.
5.3.2 Type of a nonatom element.
5.3.3 Declarations.
5.3.4 Constants.
5.4 Variable id's.
5.4.1 The id metadata.
5.4.2 Manipulating existing variables.
5.4.3 Creating variables on the fly.
5.4.4 Deleting variables.
5.5 Using a variable.
5.5.1 Variables and values.
5.5.2 Assignments.
5.6 Aliasing (an element of) a variable.
6 Included files and namespaces.
6.1 Namespaces.
6.2 Including and naming a file: a first approach.
6.2.1 The "include" statement.
6.2.2 Namespaces.
6.3 Unnamespaced symbols hierarchy.
6.3.1 Distance between abstract files.
6.3.2 The proximity rule.
6.3.3 The straightness rule.
6.3.4 The ascending rule.
6.4 The "import", "promote" and "demote" statements.
6.4.1 The "import" statement.
6.4.2 The "promote" statement.
6.4.3 The "demote" statement.
7 Scopes.
7.1 Named scopes.
7.2 Unnamed scopes.
7.3 The "use" statement.
8 Routines.
8.1 Defining a routine.
8.1.1 Routine types.
8.1.2 Forward declaration.
8.1.3 Calling a routine.
8.2 The "return" and "resume" statements.
8.2.1 Returning from a routine.
8.2.2 Th yield statement.
8.2.3 Resuming execution.
8.3 Formal parameters of a routine.
8.3.1 Passing mode.
8.3.2 Parameter types.
8.3.3 Example.
8.4 Variables in a routine.
8.5 Calling a routine.
8.5.1 The standard way.
8.5.2 A special use of desequencing.
8.6 Dynamic invocation of routines.
8.7 Routines and namespaces.
8.8 Routine metadata.
8.9 Call chain management.
8.9.1 The call_chain() function.
8.9.2 The extended_return() statement.
9 Code blocks.
9.1 Labelling blocks.
9.2 The "if" block
9.3 The "select" block.
9.3.1 The selector.
9.3.2 The "case" statement.
9.3.3 Instruction flow inside a "select" block.
9.3.4 The "otherwise" statement.
9.3.5 The "stop" statement.
9.4 Loops.
9.4.1 The for loop block.
9.4.2 The while loop.
9.4.3 The wfor loop.
9.5 Exiting blocks.
9.5.1 Exiting keywords.
9.5.2 Optional argument for "exit" and "exif".
9.6 Iteration control for loops.
9.6.1 The "next" statement.
9.6.2 The "retry" statement.
9.7 Scpe blocks.
9.8 Navigating between blocks.
9.8.1 The goto statement.
9.8.2 The come_from() function.
9.8.3 The come_back statement.
9.8.4 The goto_clear function.
9.8.4 5 Deep sea navigation.
10 Built-in debugger.
10.1 Debugger screen.
10.1.1 General description of the debugger screen.
10.1.2 Available keystrokes.
10.1.3 Other commands.
10.2 Debugger commands.
10.2.1 Dynamic reakpoint.
10.2.2 The ? command.
10.2.3 The s command.
10.3 Status report.
11 Event trapping and exception handling.
11.1 Assiging a handler to an exception.
11.2 Events.
11.3 The "error" procedure.
11.4 The "resume_execute()" and "return_execute()" statements.
11.5 Error reporting.
12 Dynamic code execution.
12.1 The eval function.
12.2 The execute procedure.
13 External OOP support.
13.1 Recognised constructs and their translations.
14 Hello, outside World!
14.1 External files and devices.
14.1.1 I/O channels.
14.1.2 The open function.
14.1.3 Sending and receiving.
14.1.3.1 Reading from an I/O channel.
14.1.3.2 Writing from an I/O channel.
14.1.4 Channel access management.
14.1.5 I/O channel pointers.
14.2 RAM management.
14.2.1 Accessing memory.
14.2.2 External types.
14.2.2.1 Predefined external types.
14.2.2.2 General external types.
14.2.3 RAM structures.
14.2.3.1 Use of context values.
14.2.3.2 The optional attribute.
14.2.3.3 Bitwise rotate.
14.2.3.4 Specific meanings of metadata.
14.3 Converting from and to OpenEuphoria types.
14.4 Interfacing with external code.
15 Interaction with the OS.
15.1 File system calls.
15.2 Graphics.
15.3 Other screen related calls.
15.4 Process control.
15.5 Other OS services.
15.6 DOS specific primitives.
16 Mathematical functions.
  B THEMATIC SUMMARY.
1 Arithmetics and maths.
2 Binary operations.
3 Array/sequence building.
4 Sequence/array/record access
5 Assignments.
6 Accessing variables.
7 Relational operators.
8 Declaring variables/types.
9 Including abstract files.
10 Instruction flow control.
11 Nonatomic types manipulations.
12 Dynamic code execution.
13 Defining a routine
14 I/O.
15 Memory managemant.
16 OS calls.
16.1 File system calls.
16.2 Video and graphics.
16.3 Process control.
16.4 Other cross-platfom calls.
16.5 DOS specific calls.
17 Interface.
18 DExternal types and structures.
19 Event and error handling.
20 Miscellaneous.
  C ALPHABETICAL REFERENCE.
Operators. A-C
D-G
H-N
O-R
S-Z

  D GLOSSARY
  E APPENDIX
1 Structure and contents of an OpenEuphoria source file.
1.1 Grammar for OPenEuphoria files.
1.2 Source file layout.
2 List of supported with and without directives.
3 List of warnings issued by OpenEuphoria.
  F THE PREPROCESSOR.
1 Macros.
1.1 Macro definition.
1.2 Macro variables and parameters.
   1.2.1 Scope of a variable.
   1.2.2 Declaring variables.
   1.2.3 Using variables.
  1.3 Flow control.
   1.3.1 The %for loop.
   1.3.2 The %if block.
  1.4 Macro scoping.
2 Macros and files.
2.1 Using a file as a macro.
3 Other typing assistance and eyestrain relievers.
3.1 Shorthands used in nonatom manipulation.
   3.1.1 Referring to a whole (tail of) nonatom.
   3.1.2 Referring to a whole sequence.
   3.1.3 Excluding a slice in a nonatom.
   3.1.4 Referring to the end element of a nonatom.
   3.2 Type repetition.
   3.3 Using underscores in numbers.
   3.4 Argument completion.


prev | next | contents