HP Forums

Full Version: Mystery Prime commands
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When you type a nonexistent command word by itself in CAS, it just gets returned as-is, like "bananna" in the screenshot below. When you type an existing command by itself in CAS, it either gets returned with single-quotes around it, like 'factor' below, or it returns an error string, like "Mod" below, or it pops up a "Syntax Error" box, like "esac" below.

[Image: mystery_commands.png]

Since typing all of the following commands by themselves in CAS pops up a syntax error, I assume that they are either undocumented CAS commands, or undocumented Prime commands of some sort, possibly program structure commands. Anybody know what these mystery commands are, and what their syntax is? The first three are clearly normal commands spelled backwards. How many more undocumented commands are hidden in Prime?

esac
fi
elif
localbloc
proc
otherwise
try_catch
stack
default
They mostly look like flow control keywords.

Probably "esac" ends a case statement and "fi" ends an if statement, and "elif" may be shorthand for else if. I think "localbloc" and "proc" sound like ways of defining functions/procedures. Usually "default" is a keyword in case statements. Both "try_catch" and "stack" are probably useful for exception handling and reporting. No idea on "otherwise".
(09-22-2018 11:56 PM)Eric Rechlin Wrote: [ -> ]They mostly look like flow control keywords.

Probably "esac" ends a case statement and "fi" ends an if statement, and "elif" may be shorthand for else if. I think "localbloc" and "proc" sound like ways of defining functions/procedures. Usually "default" is a keyword in case statements. Both "try_catch" and "stack" are probably useful for exception handling and reporting. No idea on "otherwise".

"otherwise" is used in some language (that I can't recall) for the 'otherwise' condition in a case statement, similar to how 'default' is used.

Given the logical and clearly related uses Eric has suggested, it sure looks like they are indeed reserved, but not-yet implemented, control keywords.

@Joe - how did you encounter these, ROM-walking?
(09-23-2018 01:22 AM)rprosperi Wrote: [ -> ]@Joe - how did you encounter these, ROM-walking?

Yep! Big Grin
(09-23-2018 01:38 AM)Joe Horn Wrote: [ -> ]
(09-23-2018 01:22 AM)rprosperi Wrote: [ -> ]@Joe - how did you encounter these, ROM-walking?

Yep! Big Grin

A trusted tool of every Couch-Hacker...
These are indeed control words. fi is like end for a if, esac like end for case, etc.
otherwise is a default statement in a case structure.
(09-23-2018 06:22 AM)parisse Wrote: [ -> ]These are indeed control words. fi is like end for a if, esac like end for case, etc.
otherwise is a default statement in a case structure.

Looks like some Unix shell scripting heritage creeping in Smile
(09-23-2018 03:37 PM)grsbanks Wrote: [ -> ]
(09-23-2018 06:22 AM)parisse Wrote: [ -> ]These are indeed control words. fi is like end for a if, esac like end for case, etc.
otherwise is a default statement in a case structure.

Looks like some Unix shell scripting heritage creeping in Smile

I first encountered 'elif', 'fi', and 'esac' in the Algol 68 language, so they predate the Bourne shell by about a decade.
try... catch is likely similar to the Java equivalent for error handling and recovery.
Reference URL's