Programs for HP35s resemble assembly programs. Like assembly
programs, they may benefit from symbolic label resolution, named constants and
more advanced macro features. Machine code generation is not required,
since "machine code" is not directly available. What is required is a nicely
formatted, ready for entry output with all lines numbered, all labels and names
resolved.
Programmer's comments in "ready for entry" may be supressed for brevity, on the
other hand, sometimes it may be beneficial to have "full listing" of source
code and formatted/generated output.
Since HP35s does not have very large programs, performance is not
an issue and perl is used as an implementation language. Perl is also a
language of arithmetic macro expressions whenever they appear in the code.
Each calculator command occupies one line in the source text. It is referred to
as "target command". Target command must not start at first character of the
line. Target command is written using ASCII/unicode character approximation of
the HP35s commands as they are written in calculator user manual.
Comments
';' and '#' outside of meaningful expressions start the comment which lasts
till end of line. Comments are completely discarded from the output.
Labels
Non-whitespace character in the first position of a line represents a label.
Entire sequence of non-whitespace characters up-to the first colon (':') or
whitespace is considered the label for the current line (or the first line
starting from the current that contains target command).
Symbols 1H .. 9H have special meaning. They can be referred from target
commands as <1F> .. <9F> as forward references and <1B> .. <9B> as backward
references (H stands for "here").
In another words <2B> means "closest previous label 2H" and <2F> means "closest
following label 2H".
This implements "local symbols" as described in 1.3.2'
Labels can be used in the target commands in a form of