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. A token activated programming language operates by sequentially activating text tokens, but not necessarily in one direction only. ETAC is a token activated language that uses 'sequential reverse-flow activation' which activates programmer-determined groups of tokens sequentially from left to right, but the tokens in each group are activated from right to left ('reverse-flow'). This allows the programming language to be written in groups using prefix notation as the programmer desires. It also allows the designer of the programming language to implement high-level block structured syntax, as is usual for traditional programming languages.
[* Function Definitions *]
[* 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);
};
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);