HP 48 SYSEVAL
|
01-07-2021, 03:06 AM
(This post was last modified: 01-08-2021 11:36 AM by Giuseppe Donnini.)
Post: #5
|
|||
|
|||
RE: HP 48 SYSEVAL
(12-27-2020 05:13 PM)MNH Wrote: If I understand you correctly, the command-line parser validates the object (global name) type. Not quite. The command-line parser validates the source text. As long as the command-line is not terminated, there is no object yet, everything is just text. It is at this stage that the safety net comes into effect and where the difference to $>ID lies. $>ID directly creates a binary object of the appropriate type, without first having to parse, that is, analyze, tokenize, and error check, a given text string, which only then is compiled into the corresponding object(s). In other words, if you create an object directly in compiled form, there can be no ambiguity as to how to interpret it, because the prologue address, which introduces each and every object, is a unique type identifier. (12-27-2020 05:13 PM)MNH Wrote: Is the HP 48's inability to store (using the built-in command set) a variable beginning with a number, a throwback to the days of a computer's inability to store a file that began with a number? I think we should for a moment make a distinction between file names and variable names. Almost all operating systems allow file names that start with a digit, even as brain-dead a system as MS-DOS. On the other hand, even the most recent revision of C (2017/18) or the latest craze in programming languages, like Python or R, all prohibit variable names that start with a digit. The difference, again, has to do with parsing. The less work it takes the parser to interpret the source text, the fewer the restrictions. Now, if you compare the contexts in which file names and variable names usually appear, you will find that the room for ambiguity is considerably higher, and hence more restrictions are needed, in the case of variable names. Indeed, the command-line parser of an operating system shell usually has only to distinguish between commands, options, and arguments, where the latter consist almost exclusively of file or directory names, and where the elements' relative positions play a major role in their identification. In contrast, the parser of a full-blown programming language has to deal with all kinds of different tokens: keywords, delimiters, operators, identifiers, variable names, function names, string literals, integer literals, long integer literals, floating-point literals, etc. etc. Now, if we examine the HP-48 in that light, it becomes quite clear that it has a number of atypical features:
Given the complexity of these tasks, it comes as no surprise that the naming conventions for global variables in the HP-48 are at least as restrictive as those for variable names in most high-level programming languages. I even think that the designers went to great lengths to ensure a maximum of user-friendliness. Consider, for instance, the token ABC, without any special delimiters, and observe how the current implementation lets you concentrate on its mathematical or logical meaning, while the parser figures out if it refers to a variable in the current directory, a variable in the parent directory, a variable in the HOME directory, an undefined formal variable, a local variable in a running program, a built-in function, a function from a plug-in library, a user-defined function, etc. etc. And the same holds true for identifiers within algebraic expressions! Just imagine the alternatives:
|
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP 48 SYSEVAL - MNH - 12-27-2020, 12:19 PM
RE: HP 48 SYSEVAL - Giuseppe Donnini - 12-27-2020, 01:28 PM
RE: HP 48 SYSEVAL - Allen - 12-27-2020, 01:32 PM
RE: HP 48 SYSEVAL - MNH - 12-27-2020, 05:13 PM
RE: HP 48 SYSEVAL - Giuseppe Donnini - 01-07-2021 03:06 AM
RE: HP 48 SYSEVAL - MNH - 01-09-2021, 04:16 AM
|
User(s) browsing this thread: 2 Guest(s)