Difference between revisions of "Extensible Object Script"
(→Examples) |
|||
(17 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
<td colspan="2" style="padding-bottom:.5em; padding-top:.5em; text-align:center; border-bottom:1px solid #a2a9b1;"> | <td colspan="2" style="padding-bottom:.5em; padding-top:.5em; text-align:center; border-bottom:1px solid #a2a9b1;"> | ||
− | [[File:Eos.png| | + | [[File:Eos.png|250px|frameless|border|EOS Logo]] |
</td></tr> | </td></tr> | ||
<tr> | <tr> | ||
− | <td style="width: 130px;vertical-align: top;">''' | + | <td style="width: 130px;vertical-align: top;">'''Designer''' |
</td> | </td> | ||
− | <td> | + | <td>R. Clark, A. Zeneli et. al. |
</td> | </td> | ||
</tr> | </tr> | ||
Line 46: | Line 46: | ||
<tr> | <tr> | ||
<td style="width: 130px;vertical-align: top;">'''Platform'''</td> | <td style="width: 130px;vertical-align: top;">'''Platform'''</td> | ||
− | <td>EOSRuntime (Java / Platform Independent) | + | <td>[[EOSRuntime]] (Java / Platform Independent) |
</td></tr> | </td></tr> | ||
Line 77: | Line 77: | ||
</td> | </td> | ||
<td>Java, ActionScript, JavaScript | <td>Java, ActionScript, JavaScript | ||
+ | </td></tr> | ||
+ | |||
+ | <tr> | ||
+ | <td style="width: 130px;vertical-align: top;">'''Filename Extension''' | ||
+ | </td> | ||
+ | <td>.eos | ||
</td></tr> | </td></tr> | ||
Line 83: | Line 89: | ||
'''Extensible Object Script''' (short "EOS") is the Scripting language used for Systems Based on the [[Extensible Services / Server]] for Automation family. Extensible Object Script features Object mixing, caching, lambda expressions and dynamic typing. | '''Extensible Object Script''' (short "EOS") is the Scripting language used for Systems Based on the [[Extensible Services / Server]] for Automation family. Extensible Object Script features Object mixing, caching, lambda expressions and dynamic typing. | ||
− | Extensible Object Script runs inside the ES/S-A Enviroment (Java-Based) | + | Extensible Object Script runs inside the ES/S-A Enviroment (Java-Based) using the he portable script engine [[EOSRuntime]]. It is compatble with Java Objects (Objects extending java.lang.Object). As Java-based Language (Heavily dependent on Java-API's and processed by JCC and [https://commons.apache.org/proper/commons-bcel/ Apache BCEL]) it is theoretically plattform independent, as the runtime can be executed on any Java-capable platform. |
== Background == | == Background == | ||
− | ExtensibleObjectScript is a general purpose object-oriented programming and scripting language. It is designed to be simple to learn, easy to use, yet still powerful | + | ExtensibleObjectScript is a general purpose object-oriented programming and scripting language. It is designed to be simple to learn, easy to use, yet still powerful enough to master complex automation processes. The main goals was combining the convenience of a just-in-time interpreter with the features and reliability of the surrounding Java virtual machine. Its origins trace to ObjectScript developed originally by R. Clark at Texas Instrument until the mid 2000s. Efforts were taken by Netroda Technolgies and A. Zeneli to modernize the language, optimize and modernize the runtime and to introduce new features like headless lambda functions, anonymous JSON deserialization and bundled application loading. |
== Introduction == | == Introduction == | ||
− | Extensible Object Script is a full featured object oriented scripting language, which combines the powerful features of a full | + | Extensible Object Script is a full featured object oriented scripting language, which combines the powerful features of a full featured programming language such as Java with the ease of use of a scripting language. It supports functions (which can be closures), classes, inheritance, synchronization (for multi-threaded programs) and garbage collection. Also, an ObjectScript program can take advantage of exising Java APIs by creating instances of Java classes, calling methods of Java objects, and even implementing Java interfaces or extending Java classes. As the Core of Extensible Services / Server for Automation is java based, Extensible Object Script integrates seamlessly. |
== Uses == | == Uses == | ||
Line 104: | Line 110: | ||
! Information | ! Information | ||
|- | |- | ||
− | | ''' | + | | '''DiscreteNumber''' |
| 25 | | 25 | ||
| A signed integer number up to 64 bits precision | | A signed integer number up to 64 bits precision | ||
| Stores discrete numbers with exact precision and no decimal point, ranges from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (inclusive) | | Stores discrete numbers with exact precision and no decimal point, ranges from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (inclusive) | ||
|- | |- | ||
− | | ''' | + | | '''FloatNumber''' |
| 4512.25 | | 4512.25 | ||
| A signed floating point number up to 64 bits precision | | A signed floating point number up to 64 bits precision | ||
Line 140: | Line 146: | ||
Arrays can be accessed using the [] or [..] operators, such as arr[0] which will evaluate to the first element in the array, | Arrays can be accessed using the [] or [..] operators, such as arr[0] which will evaluate to the first element in the array, | ||
or arr[0..5] which will return the sub-array containing the 0'th throughout 5'th (inclusive) elements of the array. | or arr[0..5] which will return the sub-array containing the 0'th throughout 5'th (inclusive) elements of the array. | ||
+ | |||
+ | [[File:InexactNumber.png|350px|thumb|Sign, exponent and mantissa of InexactNumber]] | ||
== Examples == | == Examples == |
Latest revision as of 02:58, 20 August 2023
Extensible Object Script | |
---|---|
Designer | R. Clark, A. Zeneli et. al. |
Type | Programming Language |
Licenses | LGPL |
Initial release |
2002 |
Current Version | 2.10.2 (06/2021) |
Platform | EOSRuntime (Java / Platform Independent) |
Origin |
|
Paradigm | Imperative Procedural |
Typing | Dynamic, Weak |
Influences | Java, ActionScript, JavaScript |
Filename Extension | .eos |
Extensible Object Script (short "EOS") is the Scripting language used for Systems Based on the Extensible Services / Server for Automation family. Extensible Object Script features Object mixing, caching, lambda expressions and dynamic typing.
Extensible Object Script runs inside the ES/S-A Enviroment (Java-Based) using the he portable script engine EOSRuntime. It is compatble with Java Objects (Objects extending java.lang.Object). As Java-based Language (Heavily dependent on Java-API's and processed by JCC and Apache BCEL) it is theoretically plattform independent, as the runtime can be executed on any Java-capable platform.
Contents
[hide]Background
ExtensibleObjectScript is a general purpose object-oriented programming and scripting language. It is designed to be simple to learn, easy to use, yet still powerful enough to master complex automation processes. The main goals was combining the convenience of a just-in-time interpreter with the features and reliability of the surrounding Java virtual machine. Its origins trace to ObjectScript developed originally by R. Clark at Texas Instrument until the mid 2000s. Efforts were taken by Netroda Technolgies and A. Zeneli to modernize the language, optimize and modernize the runtime and to introduce new features like headless lambda functions, anonymous JSON deserialization and bundled application loading.
Introduction
Extensible Object Script is a full featured object oriented scripting language, which combines the powerful features of a full featured programming language such as Java with the ease of use of a scripting language. It supports functions (which can be closures), classes, inheritance, synchronization (for multi-threaded programs) and garbage collection. Also, an ObjectScript program can take advantage of exising Java APIs by creating instances of Java classes, calling methods of Java objects, and even implementing Java interfaces or extending Java classes. As the Core of Extensible Services / Server for Automation is java based, Extensible Object Script integrates seamlessly.
Uses
Scripts utilizing EOS are used to create Complex Typed System Assets (CTSA), Create and modify Area Service Controllers (ASXC) and to create user programs, like recurring tasks, automation routines and similar.
Integrated Types
Name | Example | Description | Information |
---|---|---|---|
DiscreteNumber | 25 | A signed integer number up to 64 bits precision | Stores discrete numbers with exact precision and no decimal point, ranges from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (inclusive) |
FloatNumber | 4512.25 | A signed floating point number up to 64 bits precision | Stores floating decimal numbers with variable inexact precision, on most platforms also known as "Double" (double precision floating point). Ranges from -1.797693134862315E+308 to -2.225073858507201E-308 |
Boolean | true | A boolean type, ie. true or false | Stores the two boolean states true and false |
String | "Hello World" | A string of arbitrary length as set of chars combined creating text | Stores a String of arbitrary length. A string is immutable, but supports read-only array like access using the [] and [..] operators. The length() method returns the length of the string. |
Array | ["Test",4,65.3,false] | An array of arbitrary length, whose members can be of arbitrary type | Stores Arrays of arbitrary type (and don't have to be of the same type). The length() method returns the current length of the array. An array will automatically grow to accomodate the n'th element. indices start at 0. |
Object | new PersonDetail() | A Object of any type | In Object Script, everything (event the primitive types) are Objects. |
It is worth noting that, everything is just an object. The literal number 1 is an object, the statement (3 + "c") evaluates to an object. All objects define a getType() method, which returns the type of the object (which itself is an enumerative object.)
Arrays can be declared with the Array constructor, or with the more compact square bracket syntax: [1,2,3]. Arrays can be accessed using the [] or [..] operators, such as arr[0] which will evaluate to the first element in the array, or arr[0..5] which will return the sub-array containing the 0'th throughout 5'th (inclusive) elements of the array.
Examples
// A Simple While-Loop var a = 0; while(true) { a++; if( a > 5 ) break; else continue; a = 10; // this line is never evaluated }1234567891011
// Two For-Loops var arr = []; for( var i=0; i<10; i++ ) arr[i] = i; var sum = 0; for( var item : arr ) sum += item;12345678910
// Simple Recursion function fib(n) { if( n == 0 ) throw new Exception("Invalid Input"); else if( n == 1 ) return 1; else if( n == 2 ) return 1; else return fib(n-1) + fib(n-2); }12345678910111213
Object-Oriented Examples
Expand
A Example complex program shown below, this snippets creates a Lighting theme for a residential or public building utilizing a Extensible Services / Server for Automation based system.
Expand