HipHop Expressions Syntax
Definitions
HipHop is inspired by Esterel and Hop programming languages, as such, it borrows terms and syntax from both languages.
This document follows the classical Backus–Naur Form, with the following extensions borrowed from the Extended BNF:
* (star) denotes a possibly empty repetition of the preceding term.
+ (plus) denotes a non-empty repetition of the preceding term.
? (interrogation mark) denotes an optional occurrence of the preceding term.
As parentheses are part of the HipHop syntax, the square brackets [,] delimit a group of term and not an optional sequence.
Syntax
Hop non-terminals
As HipHop is very tighed to Hop, it re-uses all its syntax, and extends it. Here are the Hop types reused in the HipHop syntax:
- <identifier>
- A Hop non-quoted symbol
- <bool>
- A Hop Boolean value
- <event>
- A HipHop Event object
- <host-expression>
- A Hop+HipHop expression, i.e. any hop expression which may use the HipHop events accessors.
HipHop non-terminals
Some type builders accepts both a plain expression or a list of expressions. The expression/list non-terminal has been introduced for this purpose:
<expression/list> ::= <expression> | (<expression/list>+)
HipHop dynamic forms use variable declaration and bindings. The syntax is similar as that of Hop's let.
<binding> ::= (<identifier> <host-expression>)
HipHop uses clause-based syntax in await-case& and cond& syntaxes. These clauses follows the Hop's cond clause syntax:
<clause> ::= (<host-expression> <expression>+) <await-clause> ::= (<await-host-expression> <expression>+)
HipHop preemption expressions accepts handlers, which are triggered when expression is preemtped:
<handler> ::= (handler& <expression>)
Host expression may accept a times& enclosing expression in await&-like forms. See Host expressions for usage and semantics of the times& pseudo-operator:
<await-host-expression> ::= <host-expression> | (times& <host-expression> <host-expression>)
The local& form accepts a mixed list of both <event> values and hop binding (as using a plain let form, not a let*). Bound identifiers are accessible within the whole local& form, hiding any previous bindings.
<local-arg> ::= <event> | (<ident> <event>)
Expressions
HipHop expressions can be divided in two parts: core expressions and derived (compound) expressions:
<expression> ::= <core-expression> | <compound-expression>
Here are the core expressions, their semantics are described in Page Core expressions, except for genpar& and dyngenpar& which are described in Page Dynamic expressions:
<core-expression> ::= (nothing&) | (emit& <event> <host-expression>*) | (pause&) | (if& <host-expression> <expression> <expression>?) | (suspend& [:immediate? <bool>]? <await-host-expression> <expression>+) | (seq& <expression/list>+) | (loop& <expression>+) | (par& <expression/list>+) | (trap& <identifier> <expression>+) | (exit& <identifier>) | (local& (<local-arg>+) <expression>+) | (atom& <host-expression>) | (genpar& (<binding>+) <expression>+) | (dyngenpar& (<binding>+) :when <host-expression> <expression>+)
Compound expressions can be defined in terms of core expressions. Example definitions may be found in Page Compound expressions. Here are the provided compound expressions:
<compound-expression> ::= (halt&) | (sustain& <event> <host-expression>*) | (cond& <clause>* (else <expression>+)]?) | (await-case& <await-clause>+) | (await& [:immediate? <bool>]? <await-host-expression> <expression>*) | (abort& [:immediate? <bool>]? <await-host-expression> <handler>? <expression>+) | (until& [:immediate? <bool>]? <await-host-expression> <handler>? <expression>+) | (every& [:immediate? <bool>]? <await-host-expression> <expression>+) | (loop-each& [:immediate? <bool>]? <await-host-expression> <expression>+)
Return to Top
Page last modified Sat May 25 09:56:47 2013.