${ var doc = require( "hopdoc" ) } ${ var path = require( "path" ) } ${ var ROOT = path.dirname( module.filename ) } HipHop Syntax ============= HipHop is a DSL embedded in the HopScript language. HipHop module _must_ contain the following header declaration: ```hopscript "use hiphop" ``` The HipHop syntax extends the JavaScript syntax with one single expression rule: ```ebnf hiphop ``` Its complete formal syntax is given in Section [Formal Syntax](./00-syntax.html#formal-syntax). ### Example ### ${ abro.js } ```hiphop ${ doc.include( ROOT + "/../tests/abro.hh.js" ) } ``` HipHop Module ============= ```ebnf --> module [ ] ( ) { } ``` ### module [ident]( ... ) ### [:@glyphicon glyphicon-tag syntax] ### Example using simple signals ### A module with one input signal `I`, and one input/output signal `O`. ${ every1.js } ```hiphop ${ doc.include( ROOT + "/../tests/every1.hh.js" ) } ``` ### Example using combined signals ### A module with an input/output signal `O` with default value `5` and a combine function. ${ value1.js } ```hiphop ${ doc.include( ROOT + "/../tests/value1.hh.js" ) } ``` HipHop Expressions ================== HipHop expressions are used to emit signal with values or to express a condition that should be meet for an action to be executed. HipHop expressions extend the JavaScript syntax with the following constructs. ```ebnf --> | now( ) | pre( ) | nowval( ) | preval( ) ``` HipHop expressions can only be used in the syntactic context of a HipHop instructions. Example: ${ await-valued.hh.js } ```hiphop ${ doc.include( ROOT + "/../tests/await-valued.hh.js" ) } ``` Async ===== Async forms implement long lasting background Hop actions. They are defined as: ```ebnf --> async [ ] HHBLock --> | kill --> | suspend --> | resume ``` Example: ${ exec2.hh.js } ```hiphop ${ doc.include( ROOT + "/../tests/exec2.hh.js" ) } ``` An `async` block using a JavaScript promise to resume the HipHop computation. ${ exec3.hh.js } ```hiphop ${ doc.include( ROOT + "/../tests/exec3.hh.js" ) } ``` Async blocks with `kill` handlers: ${ local-kill.hh.js } ```hiphop ${ doc.include( ROOT + "/../tests/local-kill.hh.js" ) } ``` Formal Syntax ============= ${ } ```ebnf ${ doc.include( ROOT + "/hiphop.bnf" ) } ```