From the syntactical point of view, urbiscript belongs to the C-family of programming languages.
Its prototype-based object-oriented design was influenced by the Self and the Io programming languages.2
It is designed to program, but also interact with robots;3 as such, it is influenced by Unix shells and other languages that provide a read-eval-print loop style interactive toplevel. However, contrary to others, there is no prompt for user input but answers from the system are prefixed by a timestamp (in milliseconds) between square brackets:
urbiscript statements include (among others):4
Actually, contrary to most C-like languages and despite what the syntax suggests, statements "have a value", and therefore are expressions, provided they are embedded in braces:
In urbiscript, some control-flow constructs come in several "flavors": two types of sequential composition, and two types of concurrent composition. Under the hood, concurrency is implemented using coroutines.5
Like in C, the semicolon denotes sequential composition: a;b stands for "run statement a then run statement b. Other tasks may be run between a and b. Another statement separator, pipe, denotes "tight sequential composition": no other task can be run between a and b in a|b.
Similarly urbiscript features two means to compose statements concurrently. With a,b, first a is run, and at some point b will be --- possibly while a is still running. This is very similar to the & operator in Unix shells. Alternatively, with a&b, both a and b are started together; in interactive sessions, this means that a won't be run until b is fully entered and properly followed by either a ; or a ,.
Scopes are boundaries for backgrounded jobs, as demonstrated in the following example:6
Most looping constructs in urbiscript come in several "flavors", which are based on the four statement separators: ;, |, ,, and &.
For instance
displays
i.e., the loop bodies are not executed sequentially, while the for& keyword runs the loop bodies concurrently:
Aiming at the development of portable robotic applications,7 urbiscript relies on specific syntactic constructs to specify reactive behaviors such as "go to the charging dock when the battery is low", "play a friendly sound when a known face is recognized", or "stop when an obstacle is detected".
Event handling goes into three steps. First, define an event
Second, specify event handlers
Third, "emit" this event
Events can have payloads, and event handlers enjoy pattern matching on the payload:
The urbiscript language also allows to monitor expressions:
The following example demonstrates the feature:
Baillie, Jean-Christophe (8 July 2008). "Urbi: a new parallel & event-driven script language for robotics, games and more". YouTube. Retrieved 6 Oct 2011. https://www.youtube.com/watch?v=FFLiIu2PtHQ ↩
Baillie, Jean-Christophe; Demaille, Akim; Nottale, Matthieu; Hocquet, Quentin; Tardieu, Samuel (2008). "The Urbi Universal Platform for Robotics" (PDF). Retrieved 6 October 2011. http://www.rfc1149.net/download/documents/scpr2008-08-Baillie.pdf ↩
"urbiscript Language Reference Manual". Retrieved 2011-09-20. http://gostai.com/downloads/urbi-sdk/2.8/doc/urbi-sdk.htmldir/urbiscript-language-reference-manual.html ↩
Baillie, Jean-Christophe; Demaille, Akim; Nottale, Matthieu; Hocquet, Quentin (2010). "Tag: Job Control in urbiscript" (PDF). Retrieved 6 October 2011. http://car.ensm-douai.fr/CAR2010/Papers/6-baillie-car2010.pdf ↩
Baillie, Jean-Christophe; Demaille, Akim; Nottale, Matthieu; Hocquet, Quentin (2010). "Events! (Reactivity in urbiscript)". arXiv:1010.5694 [cs.PL]. /wiki/ArXiv_(identifier) ↩