EDT:EGL Language

From Eclipsepedia

Jump to: navigation, search

Contents

General Notes

  • This document is not finished yet! It's being populated from the design meetings. Design meeting notes are at EDT:Discussion topics from the language meetings.
  • "N/S" means Not Supported.
  • Anything that exists in RBD but isn't mentioned here is not included in EDT. Or maybe we forgot about it. Nobody's perfect.
  • The work in the Core category includes the parser, model, and validation.
  • The work in the JavaScript, Java, and Debug categories includes both the generator and runtime.
  • Text with an orange background shows differences in features supported by both EDT and RBD.
  • Developers: include a link to Bugzilla for features not done yet, and mark items "Done" when you're finished.

Table 1: Part Types

Part Types Core JavaScript Java Debug
DataItem1



Function2, 5



Top-level function2, 5



Delegate2



Record




Structured Record

N/S N/S N/S
ExternalType




Handler




Library




Service




Interface3




Enumeration




Program4

N/S


Array




Nullability6




DataTable

N/S N/S N/S
Form

N/S N/S N/S

Notes on Table 1

  1. In RBD a DataItem can only be used for primitive types. In EDT it can be used for any type.
  2. See also Table 2: Function Parameters.
  3. Interfaces can be implemented by services and handlers (every kind of "logic part" which can be instantiated).
  4. There are no called programs in EDT. Use libraries for "local calls" and services for "remote calls".
  5. We intend to support function overloading in all implementations, even JavaScript.
  6. Nullability means that a variable may really be null. It's not an "I'm null" flag like in RBD. A NullValueException will be thrown if you try to access a field or function of a null variable, even a record. A NullValueException will be thrown if a null variable is an operand to a math operator, an array access, a substring access, a comparison, or a bitwise operator. The string concatenation operators will work the same as in RBD with respect to nulls.  :: treats null as the empty string, and ?: results in null if either operand is null. A question mark won't be allowed on the second operand of the AS and ISA operators (the name of the type).

Table 2: Function Parameters

Function Parameters Core JavaScript Java Debug
In1



Out



Inout1



Ellipsis



Const



Field

N/S N/S N/S
SqlNullable

N/S N/S N/S

Notes on Table 2

  1. The default parameter modifier is In for references and Inout for values.

Table 3: Primitive Types

Primitive Types Core JavaScript Java Debug
Any



Boolean



Dictionary



String(N)1



String2



Timestamp3



Blob
N/S


Clob
N/S


Smallint



Int



Bigint



Decimal(N,M)



Decimal(N)



Decimal4



Float



Smallfloat



Number5



Bytes(N)6



Bytes7



Arraydictionary

N/S N/S N/S
Char

N/S N/S N/S
Dbchar

N/S N/S N/S
Mbchar

N/S N/S N/S
Unicode

N/S N/S N/S
Hex6

N/S N/S N/S
Date3

N/S N/S N/S
Time3

N/S N/S N/S
Interval3

N/S N/S N/S
Bin

N/S N/S N/S
Num

N/S N/S N/S
Numc

N/S N/S N/S
Pacf

N/S N/S N/S
Money

N/S N/S N/S

Notes on Table 3

  1. String(N) is a reference type in EDT.
  2. String is a reference type in EDT.
  3. Timestamp is the only supported date/time type. Use it in place of RBD's date, time, and interval.
  4. Decimal with no length or decimals is a reference type with an immutable value.
  5. Number is a reference type with an immutable value. Unlike in RBD, number variables can be declared anywhere a variable declaration is allowed.
  6. Bytes(N) is a value type similar to RBD's hex. N indicates the number of bytes in the value. (In RBD, the length of a hex is the number of nibbles not the nubmer of bytes.)
  7. Bytes with no length is a reference type with an immutable value of any length.

Table 4: Statements

Statements Core JavaScript Java Debug
Variable declaration5



Const declaration



Assignment



Move1



Return



Function invocation



Call2



Label



Transfer
N/S


Throw



Try



Case



If



While



For



Foreach3



Exit



Continue



Empty statement (a semicolon)



Add
N/S


Close
N/S


Delete
N/S


Get
N/S


Replace
N/S


Execute4
N/S


Prepare4
N/S


Open4
N/S


FreeSQL4
N/S


Goto

N/S N/S N/S
Set

N/S N/S N/S
Converse

N/S N/S N/S
Display

N/S N/S N/S
Print

N/S N/S N/S
Forward

N/S N/S N/S
Show

N/S N/S N/S
OpenUI

N/S N/S N/S

Notes on Table 4

  1. EDT won't support every variation of RBD's move statement. There will be support for move byName, move for, and move for all. A move statement without one of the additional keywords is only allowed between two references, and it results in the target being assigned a copy of the source's value. If/when we support structured records, we might not support move byName on them because of the complex (unclean) design.
  2. EDT doesn't have called programs, but services and native programs can be called.
  3. EDT's foreach statement will support iterating over an array.
  4. Support for these statements is tentative, pending the design for JPA in EDT.
  5. New syntax will allow setting annotations on declarations without the use of curly braces. In RBD we usually do x int {myAnnotation = 3}; but another way to do the same thing is x int {@myAnnotation{3}};. In EDT we will allow that to be outside of curly braces and before the declaration, for example @myAnnotation{3} x int;.


Table 5: Literals

Literals Core JavaScript Java Debug
null



boolean1



integer2



fixed-decimal3



floating point



string4



bytes5



array



char
N/S N/S N/S
mbchar
N/S N/S N/S
dbchar
N/S N/S N/S
hex
N/S N/S N/S

Notes on Table 5

  1. As in RBD, there are four boolean literals: true false yes no
  2. Integer literals have 1-32 digits, an optional leading sign, and no decimal point. The type of the literal depends on the value. If the value fits in a smallint, then the type is smallint. If the value doesn't fit in a smallint but it does fit in an int, then the type is int. Similarly for bigint. If the value is too large for a bigint, then the type is decimal(X), where X is the number of digits in the value.
  3. Fixed-decimal literals have 1-32 digits, an optional leading sign, and a decimal point. At least one digit must follow the decimal point, but it's permissible to have no digits before the decimal point. The type of a fixed-decimal literal is decimal(X,Y), where X is the total number of digits and Y is the number of digits to the right of the decimal point.
  4. String literals are enclosed in double quotes. An optional ux prefix may appear before the opening double quote. The ux prefix means the string is defined as Unicode codepoints in hexadecimal. For example "012" and ux"003000310032" have the same value. The letters u and x may be in any case.
  5. A bytes literal is written as 0x or 0X followed by an even number of hexadecimal digits. For example 0x03AB is a literal whose type is bytes(2).

Table 6: Operators and expressions

Operators and expressions1 Core JavaScript Java Debug
. (member access)



=



function invocation



new



{ } (set-values block)



@



[ ] (array access)



[ ] (dynamic access)



[ ] (substring)2



isa3



as3



unary (+ - ! ~)4, 5



math (+ - * / % **)9



assigning math (+= -= *= /= %= **=)9



::



?:



logical (And Or && ||)



comparison (< > <= >= == !=)



bitwise (& | Xor << >> >>>)4, 5



assigning bitwise (&= |= Xor= <<= >>= >>>=)4, 5



if-then-else (condition ? val1 : val2)6



in7
N/S N/S N/S
like matches8
N/S N/S N/S

Notes on Table 6

  1. We'll document error conditions of operators and expressions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.
  2. Substrings are immutable, so they can't be the target of an assignment or the argument to an inout parameter.
  3. The type cannot be a nullable type. Nullability is not part of a type signature.
  4. There are new bitwise operators in EDT. ~ is a bitwise NOT (also called the compliment), << is a left shift, >> is a right shift where the leftmost bits become zero, >>> is a right shift where the sign is copied into the leftmost bits.
  5. Bitwise operators are only supported on int, bigint, and smallint.
  6. The if-then-else operator is borrowed from languages like C and Java. The condition's type must be boolean. The two values must have the same type.
  7. We'll have functions in the array type to provide similar behavior.
  8. We'll have functions in the string type to provide similar behavior.
  9. Date/time math is not supported in EDT. Functions on the timestamp type provide similar behavior.

Table 7: Conversions Between Primitive Types

Conversions Between Primitive Types1 Core JavaScript Java Debug
Any to everything



Everything to any



Conversion Matrix 2



Conversion Matrix 3



Conversion Matrix 4



Conversion Matrix 5



Conversion Matrix 6



Conversion Matrix 7



Notes on Table 7

  1. We'll document error conditions of conversions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.
  2. Booleans convert to strings as "true" or "false" (lowercase).
  3. Strings convert to/from timestamps: the string is parsed, fields come from the timestamp's declaration, we'll pick a format...no conversion to timestamp w/o pattern allowed because it's ambiguous.
  4. Strings convert to/from numbers using our literal syntax for numbers.
  5. Strings convert to bytes using the bit pattern of the Unicode characters in the string.
  6. All numeric types are compatible with each other, but some conversions can result in overflow or truncation.
  7. Numeric types convert to/from bytes using the number's bit pattern.  When the bytes type includes a size (i.e. "bytes(4)" not just "bytes") the conversion is legal only if the size of the number in bytes equals the length of the bytes type.


Conversion Matrix (rows = from type, columns = to type)

bigint
boolean
bytes
decimal
float
int
number
smallfloat
smallint
string
timestamp
bigint
-

7
6
6
6
6
6
6
4

boolean

-







2

bytes
7

-
7
7
7
7
7
7


decimal
6

7
-
6
6
6
6
6
4

float
6

7
6
-
6
6
6
6
4

int
6

7
6
6
-
6
6
6
4

number
6

7
6
6
6
-
6
6
4

smallfloat
6

7
6
6
6
6
-
6
4

smallint
6

7
6
6
6
6
6
-
4

string
4

5
4
4
4
4
4
4
-
3
timestamp









3
-



What's left...

  • Stereotypes
    • program stereotypes
      • BasicProgram
      • UIProgram
      • TextUIProgram
      • VGWebTransaction
    • library stereotypes
      • BasicLibrary
      • NativeLibrary
      • RUIPropertiesLibrary
    • record stereotypes
      • BasicRecord
      • Exception
      • SQLRecord
      • CSVRecord
      • DLISegment
      • PSBRecord
      • IndexedRecord
      • RelativeRecord
      • SerialRecord
      • MQRecord
      • ConsoleForm
      • VGUIRecord
    • handler stereotypes
      • BasicHandler
      • RUIHandler
      • RUIWidget
      • BirtHandler
      • JasperReport
      • JSFHandler
    • externaltype stereotypes
      • NativeType
      • JavaObject
      • JavaScriptObject
      • HostProgram
    • datatable stereotypes...form stereotypes...
  • Annotations (details TBD)
  • Our libraries and functions within our types (details TBD)
  • Language compliance test (details TBD)