IndexNextUpPreviousUrbi SDK 3.0.0

Chapter 28
Notations

This chapter defines the notations used in this document.

 28.1 Words
 28.2 Frames
  28.2.1 C++ Code
  28.2.2 Grammar Excerpts
  28.2.3 Java Code
  28.2.4 Shell Sessions
  28.2.5 urbiscript Sessions
  28.2.6 urbiscript Assertions

28.1 Words

28.2 Frames

28.2.1 C++ Code

C++ source code is presented in frames as follows.

 
class Int 

public
  Foo(int v = 0) 
    : val_(v) 
  {} 
 
  void operator(int v) 
  { 
    std::swap(v, val_); 
    return v; 
  } 
 
  int operator() const 
  { 
    return val_; 
  } 
 
private
  int val_; 
};  

28.2.2 Grammar Excerpts

The grammar fragments are written in EBNF (Extended Backus-Naur Form). The symbol ::= separates the left-hand symbol from the right-hand side part of the rule. Infix | denotes alternation, postfix-* 0-or-more repetition, postfix-+ 1-or-more repetition, and postfix-? denotes optional parts. Terminal symbols are written in double-quotes, and non-terminals in angle-brackets. Parentheses group.

The following frame defines the grammar syntax expressed in the same grammar syntax.

 
grammar ::= rule+ 
 
rule ::= symbol "::=" rhs 
 
rhs ::= rhs 
         rhs "|" rhs 
         rhs ("?"  "*"  "+") 
         "(" rhs ")" 
         symbol 
 
symbol ::= "<" identifier ">" 
            ’"’ escaped-character ’"’ 
            "’" escaped-character "’"  

Listing 29 provides the grammar of urbiscript.

28.2.3 Java Code

Java source code is presented in frames as follows.

 
import liburbi.main.*; 
public class Main 

    /// Load urbijava library. 
    static 
    { 
        System.loadLibrary("urbijava"); 
    } 
 
    public static void main(String argv[]) 
    { 
      // Does nothing for now. 
    } 
}  

28.2.4 Shell Sessions

Interactive sessions with a (Unix) shell are represented as follows.

 
echo toto 
toto  

The user entered ‘echo toto’, and the system answered ‘toto’. ‘$’ is the prompt: it starts the lines where the system invites the user to enter her commands.

28.2.5 urbiscript Sessions

Interactive sessions with Urbi are represented as follows.

 
echo("toto"); 
[00000001] *** toto  

Contrary to shell interaction (see Section 28.2.4), there is no prompt that marks the user-entered lines (here echo("toto");, but, on the contrary, answers from the Urbi server start with a label that includes a timestamp (here ‘00000001’), and possibly a channel name, ‘output’ in the following example.

 
cout << "toto"
[00000002:output] "toto"  

28.2.6 urbiscript Assertions

The following assertion frame:

 
true; 
1 < 2; 
1 + 2 * 3 == 7; 
"foobar"[0, 3] == "foo"
[1, 2, 3].map (function (a) { a * a }) == [1, 4, 9]; 
[ => ].empty;  

denotes the following assertion-block (see Section 20.9) in an urbiscript-session frame:

 
assert 

  true; 
  1 < 2; 
  1 + 2 * 3 == 7; 
  "foobar"[0, 3] == "foo"
  [1, 2, 3].map (function (a) { a * a }) == [1, 4, 9]; 
  [ => ].empty; 
};