I'm now figuring out the list of plipp's built-in functions, and I
realize I need to determine the appropriate data structures the preprocessor needs.
In particular, IBM supports arbitrary PL/I arrays, but I think it may be enough to support just one-dimensional arrays, or arrays with a fixed
lower bound of 1, or both. None of the other PL/I manuals I have access
to talks about arrays at all. Anyone have feedback on how useful the
richer arrays are when preprocessing? It's not a matter of
implementation difficulty, but of featuritis, particularly documentation complications.
Anyhow, here's the tentative built-in function list:
ABS(n) - absolute value of n
CHAR(n) - character with codepoint n
COMMENT(s) - format s as a comment
COMPILEDATE() - yyyymmddhhmmssttt
COPY(s,n) - n copies of s
COUNTER() - string of next integer value
DIMENSION(a,n) - extent of array a in the nth dimension
DIV(x,y) - x div y
FIXED(n) - fixed integer represented by n
HBOUND(a,n) - high bound of array a in the nth dimension INDEX(needle,haystack[,index]) - returns 0 if not found
LBOUND(a,n) - low bound of array a in the nth dimension
LENGTH(s) - string length
LOWERCASE(s) - lowercase of s
LTRIM(s) - remove whitespace from left end
MAX(x,y) - maximum of x and y
MIN(x,y) - minimum of x and y
MOD(x,y) - x modulo y
QUOTE(s) - format s as a quoted string
RANK(a) - rank of array
REPEAT(s,n) - COPY(s,n+1)
RTRIM(s) - remove whitespace from right end
SEARCH(x,y,[n]) - position in x of char in y, starting at n
SIGN(n) - signum of n
STRING(n) - string representing n
SUBSTR(s,x[,y]) - substring (default y = length)
TRANSLATE(s,to,from) - translate chars in from -> to
TRIM(s) - remove whitespace from both ends
UPPERCASE(s) - uppercase of s
VERIFY(x,y,[,n] - position in x of char not in y, starting at n
John Cowan <cowan@ccil.org> wrote:
I'm now figuring out the list of plipp's built-in functions, and I
realize I need to determine the appropriate data structures the preprocessor needs.
LOWERCASE and UPPERCASE seem redundant with TRANSLATE,
Is SEARCH there?
POS would align better with the base
language, it’s also redundant with INDEX. of course, implementing redundant
builtins is not more trouble than implementing one, and all builtins used
in open code have to be declared.
I'm now figuring out the list of plipp's built-in functions, and I realize I need to determine the appropriate data structures the preprocessor needs. Neither the full nor the subset ANSI standard has anything to say about preprocessing other than %INCLUDE, so I have no guidance for this.
In particular, IBM supports arbitrary PL/I arrays, but I think it may be enough to support just one-dimensional arrays, or arrays with a fixed lower bound of 1, or both. None of the other PL/I manuals I have access to talks about arrays at all.Anyone have feedback on how useful the richer arrays are when preprocessing? It's not a matter of implementation difficulty, but of featuritis, particularly documentation complications.
Anyhow, here's the tentative built-in function list:
ABS(n) - absolute value of n
CHAR(n) - character with codepoint n
COMMENT(s) - format s as a comment
COMPILEDATE() - yyyymmddhhmmssttt
COPY(s,n) - n copies of s
COUNTER() - string of next integer value
DIMENSION(a,n) - extent of array a in the nth dimension
DIV(x,y) - x div y
FIXED(n) - fixed integer represented by n
HBOUND(a,n) - high bound of array a in the nth dimension INDEX(needle,haystack[,index]) - returns 0 if not found
LBOUND(a,n) - low bound of array a in the nth dimension
LENGTH(s) - string length
LOWERCASE(s) - lowercase of s
LTRIM(s) - remove whitespace from left end
MAX(x,y) - maximum of x and y
MIN(x,y) - minimum of x and y
MOD(x,y) - x modulo y
QUOTE(s) - format s as a quoted string
RANK(a) - rank of array
REPEAT(s,n) - COPY(s,n+1)
RTRIM(s) - remove whitespace from right end
SEARCH(x,y,[n]) - position in x of char in y, starting at n
SIGN(n) - signum of n
STRING(n) - string representing n
SUBSTR(s,x[,y]) - substring (default y = length)
TRANSLATE(s,to,from) - translate chars in from -> to
TRIM(s) - remove whitespace from both ends
UPPERCASE(s) - uppercase of s
VERIFY(x,y,[,n] - position in x of char not in y, starting at n
Peter Flass <peter_flass@yahoo.com> wrote:
John Cowan <cowan@ccil.org> wrote:
I'm now figuring out the list of plipp's built-in functions, and I
realize I need to determine the appropriate data structures the preprocessor needs.
Forgot to mention I “compile” all the preprocessor statements to pseudocode
in pass 1.
On Saturday, September 17, 2022 at 10:13:38 PM UTC-4, bearlyabus...@gmail.com wrote:
LOWERCASE and UPPERCASE seem redundant with TRANSLATE,
Technically. But in a Unicode implementation, which is what I'm writing
in both plic and plipp, there are thousands of upper/lowercase pairs.
Is SEARCH there?
It isn't.
POS would align better with the base
language, it’s also redundant with INDEX. of course, implementing redundant
builtins is not more trouble than implementing one, and all builtins used
in open code have to be declared.
Do they? I thought you only had to declare them if you need access to them within a scope in which the names are declared as variables or constants.
On 9/17/22 10:30 PM, Peter Flass wrote:
Peter Flass <peter_flass@yahoo.com> wrote:
John Cowan <cowan@ccil.org> wrote:
I'm now figuring out the list of plipp's built-in functions, and I
realize I need to determine the appropriate data structures the preprocessor needs.
Forgot to mention I “compile” all the preprocessor statements to pseudocode
in pass 1.
But don’t forget that the macro language is based on the main language,
and includes some rules that are not expressly documented. For example,
a major application I wrote all the way back in the 60s was dependent on
the fact that, although the macro language didn’t include BIT variables, the following worked:
% DECLARE OPTION_STRING CHARACTER;
% OPTION_STRING = '110101001010';
% IF OPTION_STRING & '101100011010' % THEN % DO;
...
% END;
works by implicitly converting OPTION_STRING and the constant
"101100011010" from CHARACTER to BIT ('110101001010'B and
'101100011010'B) and then ANDing them (result '100100001010'B).
On Saturday, September 17, 2022 at 10:13:38 PM UTC-4, bearlyabus...@gmail.com wrote:
LOWERCASE and UPPERCASE seem redundant with TRANSLATE,
Technically. But in a Unicode implementation, which is what I'm writing
in both plic and plipp, there are thousands of upper/lowercase pairs.
Is SEARCH there?
It isn't.
POS would align better with the base
language, it’s also redundant with INDEX. of course, implementing redundant
builtins is not more trouble than implementing one, and all builtins used
in open code have to be declared.
Do they? I thought you only had to declare them if you need access to them within a scope in which the names are declared as variables or constants.
There's also "COMPILETIME"
You might add a third format to allow detection of your version!
On Sunday, September 18, 2022 at 7:08:41 AM UTC-4, Robert Prins wrote:
There's also "COMPILETIME"
I saw that, but it would drag in localization architecture for the short name of the month, which seemed like an excessive burden.
You might add a third format to allow detection of your version!
I've added SYSPARM, which will return "PLIC".
I've decided, at least for the moment, to restrict arrays to a single dimension
with a lower bound of 1. This lets me remove the built-in functions DIMENSION, HBOUND, LBOUND, and RANK, and overload LENGTH
to mean either a char length or an array length.
I'm now figuring out the list of plipp's built-in functions, and I realize I need to determine the appropriate data structures the preprocessor needs. Neither the full nor the subset ANSI standard has anything to say about preprocessing other than %INCLUDE, so I have no guidance for this.
In particular, IBM supports arbitrary PL/I arrays, but I think it may be enough to support just one-dimensional arrays, or arrays with a fixed lower bound of 1, or both. None of the other PL/I manuals I have access to talks about arrays at all. Anyonehave feedback on how useful the richer arrays are when preprocessing? It's not a matter of implementation difficulty, but of featuritis, particularly documentation complications.
Anyhow, here's the tentative built-in function list:.
ABS(n) - absolute value of n
CHAR(n) - character with codepoint n
COMMENT(s) - format s as a comment
COMPILEDATE() - yyyymmddhhmmssttt
COPY(s,n) - n copies of s
COUNTER() - string of next integer value
DIMENSION(a,n) - extent of array a in the nth dimension
DIV(x,y) - x div y
FIXED(n) - fixed integer represented by n
HBOUND(a,n) - high bound of array a in the nth dimension INDEX(needle,haystack[,index]) - returns 0 if not found
LBOUND(a,n) - low bound of array a in the nth dimension
LENGTH(s) - string length
LOWERCASE(s) - lowercase of s
LTRIM(s) - remove whitespace from left end
MAX(x,y) - maximum of x and y.
MIN(x,y) - minimum of x and y
MOD(x,y) - x modulo y
QUOTE(s) - format s as a quoted string
RANK(a) - rank of array
REPEAT(s,n) - COPY(s,n+1).
RTRIM(s) - remove whitespace from right end
SEARCH(x,y,[n]) - position in x of char in y, starting at n
SIGN(n) - signum of n
STRING(n) - string representing n
SUBSTR(s,x[,y]) - substring (default y = length)
TRANSLATE(s,to,from) - translate chars in from -> to
TRIM(s) - remove whitespace from both ends
UPPERCASE(s) - uppercase of s
VERIFY(x,y,[,n] - position in x of char not in y, starting at n
On Sunday, September 18, 2022 at 7:08:41 AM UTC-4, Robert Prins wrote:.
There's also "COMPILETIME"
I saw that, but it would drag in localization architecture for the short name of the month, which seemed like an excessive burden.
You might add a third format to allow detection of your version!I've added SYSPARM, which will return "PLIC".
I've decided, at least for the moment, to restrict arrays to a single dimension
with a lower bound of 1. This lets me remove the built-in functions DIMENSION, HBOUND,
LBOUND, and RANK, and overload LENGTH
to mean either a char length or an array length.
On Sunday, September 18, 2022 at 10:19:43 AM UTC+10, co...@ccil.org wrote:
I'm now figuring out the list of plipp's built-in functions, and I.
realize I need to determine the appropriate data structures the
preprocessor needs. Neither the full nor the subset ANSI standard has
anything to say about preprocessing other than %INCLUDE, so I have no guidance for this.
In particular, IBM supports arbitrary PL/I arrays, but I think it may be
enough to support just one-dimensional arrays, or arrays with a fixed
lower bound of 1, or both. None of the other PL/I manuals I have access
to talks about arrays at all. Anyone have feedback on how useful the
richer arrays are when preprocessing? It's not a matter of
implementation difficulty, but of featuritis, particularly documentation complications.
Anyhow, here's the tentative built-in function list:
ABS(n) - absolute value of n
CHAR(n) - character with codepoint n
COMMENT(s) - format s as a comment
COMPILEDATE() - yyyymmddhhmmssttt
COPY(s,n) - n copies of s
COUNTER() - string of next integer value
DIMENSION(a,n) - extent of array a in the nth dimension
DIV(x,y) - x div y
FIXED(n) - fixed integer represented by n
HBOUND(a,n) - high bound of array a in the nth dimension
INDEX(needle,haystack[,index]) - returns 0 if not found
LBOUND(a,n) - low bound of array a in the nth dimension
LENGTH(s) - string length
LOWERCASE(s) - lowercase of s
LTRIM(s) - remove whitespace from left end
Usually, macro built-ins use the same name as compiler builtins.
It's for consistency.
The Enterprise compiler uses TRIM as a preprocessor name,
not LTRIM and RTRIM.
TRIM removes from either end, or from both ends,
just as does the compiler version.
.
There's no DIV function, nor FIXED, nor MOD.
.
MAX(x,y) - maximum of x and y.
MIN(x,y) - minimum of x and y
MOD(x,y) - x modulo y
QUOTE(s) - format s as a quoted string
RANK(a) - rank of array
There's no RANK.
.
REPEAT(s,n) - COPY(s,n+1).
RTRIM(s) - remove whitespace from right end
SEARCH(x,y,[n]) - position in x of char in y, starting at n
There's no SEARCH nor SIGN nor STRING.
.
SIGN(n) - signum of n
STRING(n) - string representing n
SUBSTR(s,x[,y]) - substring (default y = length)
TRANSLATE(s,to,from) - translate chars in from -> to
TRIM(s) - remove whitespace from both ends
UPPERCASE(s) - uppercase of s
VERIFY(x,y,[,n] - position in x of char not in y, starting at n
HBOUND returns the upper bound of an array.
The Enterprise compiler uses TRIM as a preprocessor name,
not LTRIM and RTRIM.
TRIM removes from either end, or from both ends,
just as does the compiler version.
There's no DIV function, nor FIXED, nor MOD. ]
There's no RANK.
There's no SEARCH nor SIGN nor STRING.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 405 |
Nodes: | 16 (3 / 13) |
Uptime: | 53:51:37 |
Calls: | 8,499 |
Files: | 13,203 |
Messages: | 5,917,105 |