ETAC Website
Contents: Introduction, Features of ETAC, Script Examples, Screenshots.
This is the official website of the ETAC Programming Language. The latest version of the ETAC system was released on 1 August 2020 (Downloads: ETAC_Installers_3-ena.zip).
NOTE: This website is written in Australian English.
►►► INTERACTIVE GRAPHICS SYSTEM FOR ETAC CURRENTLY IN DEVELOPMENT ◄◄◄
See Latest Announcements for details.
Introduction
ETAC™ (pronounced: E-tack) is a syntactically simple but extremely versatile general purpose dictionary and stack based interpreted script programming language fully capable of traditional high-level block structured language style syntax. The ETAC programming language is not based on any other programming language.
An ETAC program is written in a single-byte (Western European Windows® code page 1252) or Unicode® (UTF-8, UTF-16, or UTF-32) text file which is interpreted directly by the Run ETAC Scripts program. The ETAC programming language has basic support for the full Unicode® codespace. ETAC is released only for the Windows® operating system using the x86 (32-bit) architecture (can also run on the x64 (64-bit) architecture) beginning with Windows® XP. Also, ETAC is released only in the (Australian) English language.
ETAC operates by sequentially activating text tokens (“token activated language” or “TAL” for short) from a file in conjunction with three object stacks, one of which contains dictionaries of defined token words. Instead of merely activating tokens from left to right, as is the case for other TALs, ETAC activates programmer-determined groups of tokens sequentially from left to right, but the tokens in each group are activated from right to left (“sequential reverse-flow activation”). An ETAC program, therefore, is not strictly written in postfix notation (unless the programmer wants to), but in groups of tokens with prefix notation activated in reverse. Such a system can be designed to incorporate a high-level syntactic structure without sacrificing the versatility of a TAL. The result of such a design is that an ETAC program could be written using any combinations of high-level syntax (as is typical of traditional high-level block structured languages) and TAL type syntax (as is typical of languages such as PostScript® and FORTH) in a seamless manner.
Features of ETAC
Some of the noteworthy features of ETAC are:
- Operates as a token activated language using sequential reverse-flow activation.
- An operator can be placed in any position within the parenthesis of an operator expression (‘non-fix’ notation).
- ‘if’, ‘choice’, and ‘iterative’ command structures can be modified at run-time. The structure of accessing sequences of multiple depth can also be modified at run-time.
- Any variable can have any type of value at any time (“dynamic typing”), including another variable as value.
- The size of sequences can change dynamically, and the sequences can have any mixture of elements including other sequences.
- Capable of full traditional high-level block structured language style syntax, as well as traditional stack-based language style, or any mixture of both.
- Can construct sequences and procedures at call-time (of a procedure).
- Internally emulates data structures via dictionaries, and uses data structures to emulate object oriented programming via ETAC script.
- Can internally create ETAC text script and execute it in a new ETAC session which shares command and operator definitions with the main ETAC session.
- Can compile ETAC script into binary form for convenience (but is not required) via the ETAC Compiler program.
- Contains an internal interactive debugger for visually tracing the activation of script tokens in ETAC scripts when running in debug mode.
- A C++ computer programmer can extend the native set of commands and operators via external TAC libraries (implemented as dynamic linked libraries).
- An ETAC program can execute C++ application program functions, which allows an application program to use ETAC as a macro language via a special ETAC dynamic linked library.
- Has basic support for the full Unicode codespace (U+0000 to U+10FFFF).
An overview of the ETAC programming language is presented in the document ETACOverview.pdf. The official definition of the ETAC programming language is presented in the document ETACProgLang(Official).pdf.
Script Examples
An ETAC code sample (without explanation) for illustrative purposes is presented below. Notice that the code is in the form of traditional block structured style syntax, but keep in mind that ETAC is a dictionary and stack based language (note the pop and swap commands on the tenth line, which are typical commands of a stack-based programming language). Comments are shown in green, and ignored by the ETAC interpreter.
[* Determines if a sub-string exists in a string sequence. *]
FindString :- fnt:(pStrSeq[*str-seq*] pStr[*str*]) [* => bool *]
{
RtnVal :- false; [*rtn*]
SrcStr :- ?;
do with SrcStr of pStrSeq while not RtnVal
{
RtnVal := (pop swap find_str pStr SrcStr != -1); [* Tenth line. *]
};
RtnVal; [*RETURN*]
};
[* Splits a string sequence at a line number and character offset. *]
SplitLines :- fnt:(pTextLines[*str-seq*] pLineNum[*int*] pCharOff[*int*])
{
ExtrLine :- ?;
ExtrLine := pTextLines%[pLineNum] := extr_str 0 pCharOff pTextLines%[pLineNum];
if (|pTextLines| = pLineNum) then
{pTextLines +:= ExtrLine;}
else
{pTextLines<%[(pLineNum + 1)] := ExtrLine;}
endif;
};
[* Function Calls *]
TextLines :- ["A string here", "Another one", "The final string"];
Found := FindString(TextLines "one");
SplitLines(TextLines 2 7);
The function SplitLines (shown in the example above) can be written as an ETAC procedure in typical stack-based syntax without using variables, as shown below.
SplitLines :- [* str-seq line-num-int char-off-int => - *]
{
copy 2; swap; get_elm; copy_any 4; extr_str 0; copy_any 3; swap; copy_any 5; put_elm;
copy_any 3; copy_any 3; size; swap; pop; eq;
if_else {mk_seq 1; roll -1 3; add2 1; insert;} {swap; add2; roll -1 3; pop;};
pop; pop;
};
[* Function Call *]
TextLines :- ["A string here", "Another one", "The final string"];
SplitLines TextLines 2 7;
To further illustrate the syntactic versatility of the ETAC programming language, consider a function, Factorial, to calculate the factorial of an integer. The function is defined in two ways. The first way uses the recursive method in a traditional block structured style syntax. The code uses a parameter and a local variable. A programmer not familiar with the ETAC programming language would not be able to tell that the code is written in a dictionary and stack based language. Note that the example below is for illustrative purposes only; the function can be written in a more concise way.
Factorial :- fnt:(pNum[*int*]) [* => factorial-int *]
{
Num :- pNum;
if (pNum = 0) then
{pNum := 1;}
endif;
if (pNum > 1) then
{Num := Factorial((Num - 1));}
else
{Num := 1;}
endif;
(pNum * Num); [*RETURN*]
};
The second way to define the Factorial function uses a procedure definition without using any parameters, local variables, or the dictionary stack (other than for storing the actual procedure itself). It uses only the object stack. This code runs the most efficiently; it does not use the recursive method. The factorial factors (1, 2, …, n) are all pushed onto the object stack first, then multiplied together.
Factorial :- [* int => factorial-int *]
{
(* 1 1 do_for {} 1 1 swap); [*RETURN*]
};
Some other ways to write the Factorial function are shown below.
Factorial :- fnt:(pNum[*int*]) [* => factorial-int *]
{
if (pNum = 0) then
{@Return 1;} [*RETURN*]
endif;
(pNum * Factorial((pNum - 1))); [*RETURN*]
};
Factorial :- fnt:(pNum[*int*]) [* => factorial-int *]
{
@IfElse((pNum = 0) 1 {(pNum * Factorial((pNum - 1)));}); [*RETURN*]
};
Factorial :- fnt:(pNum[*int*]) [* => factorial-int *]
{
if_else {mult2 pNum Factorial(sub2 pNum 1);} 1 (pNum = 0); [*RETURN*]
};
As can be seen from the illustrations above, the ETAC programming language is, arguably, the first of an evolutionary step of dictionary and stack based token activated programming languages, capable of full traditional high-level block structured syntax with the versatility and efficiency of a token activated stack-based language. Programmers who are not accustom to thinking on their own may find the versatility of ETAC overhhelming.
Screenshots
The Gallery page contains screen shots and other pictures relating to the ETAC programming language.