Flavors Technology, Inc. |
Paracell Users' Guide |
|
As in English, the elements of Paracell language consist of letters, numbers, words, and punctuation. Letters and numbers form a set of characters, and a group of characters form a word. A word can be a noun, a verb, a conjunction or any other grammatical parts of the language.
Nouns and pronouns are used to name things. In Paracell, a name usually denotes a variable, a reference to a memory location in the PIM. Unlike English, words in Paracell can have only one definition. Words defined by Paracell are called keywords, and form the vocabulary of Paracell. Keywords cannot be redefined by the user.
A verb states an action. The action can either be performed on the workstation, or executed on the PIM. Some of the verbs and their usages are inherited from other computer languages and mathematics.
The usage of punctuation have the characteristics of both English and other computer languages. For example, a period signifies the end of a sentence -- the English characteristic. A pair of periods is used to specify a range of array index.
This chapter provides detailed information about these elements of Paracell.
A character is the smallest component of the Paracell language.
As in English, characters are put together to construct a word
-- the fundamental building block of the language. Note that a
single character can be a word. Sometimes a character denotes
an operation (e.g., +
for addition), or punctuation
(e.g., a period).
The set of characters available in Paracell consist of all the letters in the Alphabet, Arabic numbers, and a set of Special characters listed below. Special characters usually denote operations. Upper and lower case characters are equivalent in Paracell. The complete set of available characters is listed below.
Alphabet: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
Numbers: 1234567890
Special Characters: ( ) [ ] + - * / . , ; < = >
± < >
If your browser is font challenged, the last four character glyphs above are "=" with a slash through it, "+" and "-" in one glyph, "<" and "=" in one glyph, and ">" and "=" in one glyph.
A name is a word chosen by you to represent a variable or a constant number. A variable is a reference to a value stored in the PIM. For more information on variables, refer to Elements of Variables. A constant is a name assigned to a number.
A name can consist of a single character, or as many as 255 characters. However, long variable names can hinder readability of the code. Here are some examples of variable names.
X
radius
Robot[10]
Sync [4,6,12]
Variable names in Paracell may consist of multiple words, separated by underscores.
bath_water_temp
tube_water_temp
You cannot embed other special characters in a variable name. For example,
bath,water/temp
will be interpreted as three separate variable names. This is because the comma is punctuation, and the slash is an operator with predefined meaning. For more information on comma see the Comma section. More information on the slash can be found in Operator section on page 7. For a complete listing of special characters predefined by Paracell, please refer to Special Characters.
A keyword is a word predefined by Paracell; together, the keywords make up the vocabulary available to the user to write Paracell code. In Paracell, a word can either name a variable (name) or be a keyword. Names can only have one meaning. However, keywords can have multiple meanings. For example, the keyword "and" has two meanings; it is a logical AND operator, and it is also a conjunction that connects parts of a Paracell sentence. Since keywords have meaning assigned in Paracell, they cannot be used as variable names. For example, you cannot have a variable named "add" because it is already has a meaning given in Paracell.
Here are some examples of keywords.
add
set
equals
if
then
or
a
Note that the letter "a" is a keyword.
A complete list of keywords can be found in Keywords Listing.
When we speak, we "punctuate" our speech with pauses, stress, tempo, pitch of our voices, and gestures to mark the beginning and end of units thought. In writing, the we use punctuation for this purpose. Punctuation is a set of special characters used as markers that separate words into sentences, clauses, and phrases to clarify meaning. For example, a space separates words, and a period separates sentences.
In Paracell, punctuations serves one of the following three functions.
End Punctuation: Periods indicate sentence endings
Internal Punctuation: Commas, semicolons, and parentheses within sentences show the relationship of each word or group of words to the rest of the sentence.
Mathematical Punctuation: Periods, ellipses, parenthesis, and brackets are used within mathematical equations or other computer science like sentences. This is similar to internal punctuation, but does not follow conventional English grammar.
Note that due to Paracell's dual heritage, some punctuations have more than one function. Below is a complete list of punctuation available in Paracell.
Note that some conventional punctuation marks, such as quotation mark and question marks, are not available in Paracell. A dash is a keyword defined to denote subtraction operation, and is not available as punctuation. The following sections describe the details of these punctuations.
Spacing is the most basic of all punctuating devices. A word can be identified as a word by setting it off from its neighbors. Tabs and carriage returns are treated as spaces. In Paracell, multiple spaces are treated as a single space.
Here is an example of a sentence containing four words:
Add 5 to x.
This is equivalent to:
Add 5 to x.
which is same as:
Add
5
to
x.
Period as a sentence End Punctuation
A period indicates the end of a sentence. Since there are no interrogative or exclamatory sentences in Paracell, a period is the only way the terminate a sentence. This is exactly the same as the English usage.
Here is an example of a sentence.
Add 5 to x.
For more information on sentences, please refer to Structure of the Language.
Period as a Mathematical Punctuation - Paracell Numbers
A period is used to denote a decimal point, also. For example,
x = 56.0987.
Note that in this example, there are two periods each with different meaning. The first period marks a decimal point, the second marks the end of a sentence.
Period as a Mathematical Punctuation - Arrays
A pair of periods is used to denote the range of array indexes. For example,
Sync is an array[1..10] of Paracell Numbers.
This declares an array of 10 Paracell Number with indices 1 through 10.
This is different from
Sync is an array[10] of Paracell Numbers.
which declares a Paracell Number array of 10 elements with indices 0 through 9.
For more information on Paracell numbers and arrays, please refer to Elements of Variables.
Comma is an internal punctuation, with one of the two following functions:
1. To separate clauses
2. To separate three or more words in a list
As in English, a clause is a group of words containing a subject and a predicate (usually a verb). Commas are usually used to separate two or more clauses. Here is an example of a sentence with two clauses.
Assign 1 to X, and assign 2 to Y.
The comma separates the two clauses "Assign 1 to X" and "and assign 2 to Y." Such independent clauses can also be broken into separate sentences.
Assign 1 to X.
Assign 2 to Y.
Commas are frequently used in writing conditional sentences (see Sentences for more detail on conditional sentences in Structures of the Language chapter).
If X = 0
then increment y by 3,
assign 10 to z.
Note that the second clause, "assign 10 to z," depends on the "if X = 0 then" part of the first clause. In this case, the second clause is called a dependent clause because it depends on the condition of the first clause.
Another way of writing this would be,
If X = 0
then increment y by 3.
If X = 0
then assign 10 to z.
Commas are used to separate three or more words in a series.
X, Y, and Z are Paracell Numbers.
Here, commas separate three items, X, Y, Z, in the series "X,
Y, and Z."
This is equivalent to the following three sentences,
X is a Paracell Number.
Y is a Paracell Number.
Z is a Paracell Number.
A semicolon is an internal punctuation used to separate independent clauses. As in English, a clause is a group of words containing a subject and a predicate (usually a verb). A clause is said to be independent if it can stand alone without relying on other clauses.
Here is an example of a sentence with two independent clauses.
Set X to 0; increment Y by 1.
The second clause, "increment Y by 1" does not depend on the first clause. This is the same as
Set X to 0.
Increment Y by 1.
Note that the function of a semicolon is similar to that of a comma. Commas can replace semicolons, but a semicolon cannot always replace a comma. Only when commas are used to separate clauses can semicolons be used in their place. The above example can also be written as
Set X to 0, and increment Y by 1.
Note when using comma you must include a conjuction, which in this case is the word "and."
A set of open and close parentheses isolates a part of the sentence. The open parenthesis "(" marks the beginning, and the close parenthesis ")" marks the end of the part.
As mathematical punctuation, parentheses are used to specify the order of operation.
Set generator to (9 + 8) * 10.
This is different from
Set generator to 9 + 8 * 10.
which is the same as,
Set generator to 9 + (8 * 10).
To see why, please refer to the section on Operator Precedence. Here is another example.
If (valve_1_status is not 0) and (Line_1_Used is 1)
then set valve_1_volume to Line_1_Volume.
The set of conditions in the above example can be abbreviated as,
If valve_1_status isn't 0 and Line_1_Used
because the value of true is encoded as 1. Hence, one would hope this abbreviated form (valve_1_status isn't 0 and Line_1_Used) is true, when valve_1_status 0 and Line_1_Used = 1. However, without the parentheses, the meaning of this abbreviated form is ambiguous. There are two possible interpretations:
valve_1_status isn't (0 and Line_1_Used)
or
(valve_1_status isn't 0) and Line_1_Used
The first interpretation always evaluates to false (or 0) because 0 AND x is always false. Therefore, this is the same as
valve_1_status isn't 0
nullifying the contribution of Line_1_Used. Since this is not what we want, parentheses are necessary for this code to work as intended.
If (valve_1_status isn't 0) and Line_1_Used
then set valve_1_volume to Line_1_Volume.
Here is another example that requires parentheses to clarify your intention.
If Motor is On
then set valve_1 to ON
else
if oil_line_1 is open
then
if oil_line_1_flow > 0
then set motor to open,
set oil_line_1_flow to oil_valve_10_flow
else set oil_line_1 to open.
The indentation above denotes the intended grouping. However, the last clause,
else set oil_line_1 to open.
is grouped with
if oil_line_1_flow > 0
then set motor to open,
set oil_line_1_flow to oil_valve_10_flow
because the "else" part is preceded by the another "if" expression. The intention was to group the "else" part with the
if oil_line_1 is open
Therefore, a set of parentheses is required for proper grouping.
If Motor is On
then set valve_1 to open
else
if oil_line_1 is open
then
(if oil_line_1_flow > 0
then set motor to open,
set oil_line_1_flow to oil_valve_10_flow)
else set oil_line_1 to open.
The parentheses separate the inner most if expression from the enclosing if expression. This sentence will open oil_line_1 if it is not open and the Motor is not on.
A bracket is a mathemtaical punctuation. A set of open and close brackets isolates a part of the sentence. The open bracket "[" marks the beginning, and the close bracket "]" marks the end of an array subscript expression.
Here is an example of brackets used for specifying an array element.
Increment generator[1] by 2.
The element 1 of the array, generator, is incremented by 2.
Next: Structure
of the Language, Top: Table of Contents
Flavors Technology, Inc. |
Copyright© 1993-6 by Flavors Technology, Inc. All rights Reserved.