The hprogi (20) is the program running on the remote node, and identified by the name of the program entity. This is the same as the entity name which you use in the command pi(prog,N) to launch the program in the remote node. Clearly this entity name must also appear in the catalogue in the remote node. There is a special case: the single underscore character “_”. This says “take the program name from the program being translated”.
hremote namei ::=hnamei (22)
The hremote namei (22) is the name of a path in a Pint program running on the remote node to which we wish to send some value. See chapter 4 on page 21 for a discussion of names for paths. Note that this path will have type ∧3 which means that it cannot be a template, which would have type ∧o and cannot receive local values, which would require type ∧a. In other words, this path must be dedicated to receiving values from other nodes.
It is often convenient to give short aliases to long URLs using aval declaration.
4.4 Values
The Pint language supports a range of values:
Boolean values The boolean values aretrueandfalse. In practice these values are less useful than one might think, but they were included in Pint for compatibility with Pict. It is usually simpler to represent “true” and “false” with two separate paths.
114 def bool_to_paths {b p-true p-false} = 115 if b then p-true!{} else p-false!{}
Integer values The integer numbers are written in the style ∼1, 25, 8288. Large integers are possible: 4927492515511210043330985984000000. Note the use of ∼ as a negative sign15 rather than -.
Real values Pint presents the emulated hardware’s floating-point numbers as real numbers in the manner of a high level language. This is an abstraction and a simplification of the notion of floating point, and conformance to IEEE Std 754 [IEE90] is lost. For example, there is no notion of NaN in Pint. See [Gol91] for a tutorial, and [Kah96] for a discussion.
The real numbers are written with decimal point and fractional part16in the style 3.14159 or ∼2.718. An exponent may be added, e.g. ∼2.7e11 or 1.3E∼25. Again, note the use of ∼ as a negative sign rather than - for both mantissa and exponent.
Unicode string values Many programming languages provide “strings” which are usually sequences of characters. There is no type “char” in Pint and the equivalent of a string is the typeunicode. Theunicodetype contains lists of integers which are Unicode codes [TUC03]. Since Pint is an ISO Latin 9 language, the integer
15There is no equivalent unary positive sign. It is an error to writeval N = +10.
16ML allows the decimal point and fractional part to be omitted, but Pint, like Erlang, requires that they be present in all real numbers. 1e5 and 1.e5 are not valid Pint reals.
Character Meaning * = white space
\b Backspace
\e Escape
\f Form feed *
\n Line feed (Unix/Linux newline) *
\r Carriage return *
\s Space *
\t Horizontal tabulate *
\v Vertical tabulate *
\\ Backslash
\" Double quote
\c Character c
Table 1: Escape sequences for use in Unicode values.
values found in values of typeunicode are those corresponding to the characters in ISO Latin 9. For example the capital letter E has the integer value 69 and the Euro symbol has the integer value 8364. The effect of integer values other than those of ISO Latin 9 is undefined.
The values of type unicode are enclosed in double quotes. There are several techniques for entering ISO Latin 9 characters which are not available on the keyboard.
• Pint offers the familiar escaped character sequences. The characters marked
* are white space characters.
• Use the techniques offered by your editor, see chapter 2.1.
• Type in the Unicode value in the form U+xyzw: for example Voil`a is typed as "VoilU+00e0". Characters which cannot be typed are expressed by their hexadecimal Unicode numbers.
The characters between the leading " and the trailing " must all be on the same line. You are not allowed to write
116 val msg = "Hello
117 World"
If you need to write a unicodevalue with embedded new lines, either write 118 val msg = "Hello\nWorld"
or
119 val msg = "Hello\n" ...
120 "World"
where the ellipsis on line 119 means “this unicode value is not finished; there is more to come.”
4.4 Values 27
Path values The name of a path may be used as a value. E.g. the “alu.int.+” in val add = alu.int.+. You may add an optional type annotation to the path name; the syntax is hpathi[:htypei]. See chapter 4.2 for a discussion of paths, and chapter 5.3 for types. This annotation is useful for documentation and assertion verification, e.g. p ! v:intasserts that the value v sent on path p is an integer.
Record values Record values are white space separated sequences of fields wrapped in the syntactic markers “{” and “}”, e.g. {0 word="zero"}.
The general form is {
hlabeli=hvaluei hvaluei
∗
} where hlabeli is a name, and the square brackets denote a choice. Examples are {}, {{{}}}, {count = 0 "zero"}, {am="Good morning" pm="Good afternoon"} and {"hello" "world"}.
The fields must all be present in all uses of the record and be presented in the same order. For example, {0 "zero"} and {"zero" 0} are not the same record.
Records may be nested, for example: {{} a_path {return_path}}.
Lists of values A value may be a list of values, all of the same type, separated by commas and wrapped in brackets. For example: [], [1,2,3] and [{a},{b},{a}].
The list [[a],{},{0}] is not a valid Pint list since the three values have three different types.
Local values A local value restricts the scope of declarations used to construct the value. Such a value is writtenlethdeci1hdeci2. . . hdecinouthvalueiend, n ≥ 0 and means that the declarations hdeci1. . . hdecin apply only to hvaluei. The keyword
“out” is used rather than the usual “in” to emphasize that scope extrusion is probably occuring.
An example islet val z=0 val zz={z z} out {zz zz} end.
Abstractions as values In the π-calculus input process x(y), the “y” may be con-sidered separately from the path x. y is then known as an abstraction. Input processes are discussed in chapter 4.7 on page 31 and abstractions in chapter 4.5.
An anonymous abstraction is an input process, without its path, which may be passed around as a value. Such a value is writtenanonhabstractioni. For example
121 anon {v p} = p!v
provides an abstraction in which the pattern expects to be matched with a record containing a value v and a path p. The associated process sends the value v on path p.
Element values An element is a named, “tagged ” record wrapped in syntactic markers known as stago “start-tag open” and tagc “tag close”. These are represented either by the characters<and >familiar in markup languages such as HTML, or by the characters and.
An example is<Img src=img.n26 alt="logo">.
The general form is
must match. As with records, the “hlabeli=” may be omitted and the sequence of fields may be empty. For exampleFourWords "have" "a" "nice" "day"
and <Br>.
The structure of an element is defined by an element and attribute declaration elatt· · · . The fields defined by the elatt· · · must all be present in all uses of the element and be presented in the same order. For example, given the decla-ration elatt z = Z of int * unicode, the element should have the form <Z 0
"zero">, not<Z "zero" 0>.
Elements may be nested, for example: <Appl Lambda f <Appl f f>
Lambda f <Appl f f>>. Note the alternating<> and pairs.
There is no such notion as XML’s “well formed” in Pint. All elements used in a program must be specified by an element type declaration, see chapter 4.8 on page 37, and must conform to that declaration.