(This section may be omitted by beginners)
Procedures come in four types: normal, infix, macros and syntax (including syntactic operators, described below.).
Strictly speaking, it is the identifiers that come in four types - their values are in all cases simple procedure records.
A normal procedure, with a normal identifier, is one which is invoked by writing its name, followed by an opening parenthesis, its arguments (if any) separated by commas and finally a closing parenthesis, for example:
foo(x + 1, y)This applies the procedure which is the value of the variable FOO to the results of evaluating the expressions `X + 1' and `Y'.
Infix operators were defined and discussed above.
An infix procedure is invoked by writing its name between its arguments. (Typically, infix procedures have two arguments). For example `+' is an infix procedure, thus:
3 + 4Some "infix" operators take a single argument. E.g. we could define "root" as an infix operator of precedence 2, taking one argument.
define 2 root x -> result; sqrt(x) -> result; enddefine; root 16 => ** 4.0 root 16 + root 25 => ** 9.0
Macro procedures and syntax procedures can be used to extend the syntax of Pop-11. They are evaluated at compile time (ie when read in by the compiler). They are explained in more detail after further discussion of forms of expression that can be used in defining ordinary procedures.
A syntax word can be identified by applying the procedure identprops to it. If the argument is a syntax word, identprops returns either the word "syntax" or a special kind of word like "'syntax 2'", "'syntax 5'" which includes a number. These are syntactic operators. E.g.
Ordinary syntax words:
identprops("if") => ** syntax identprops("elseif") => ** syntax identprops("endif") => ** syntaxSyntactic operators:
identprops("(") => ** syntax -1 identprops("and") => ** syntax 9 identprops("or") => ** syntax 10
As illustrated above, there are some syntax words, like "and" and "or" and "(" which are not merely syntax words, but also have an associated precedence. This helps the Pop-11 compiler sort out the complex rules for grouping expressions in a text stream.