The HipHop Language
HipHop is a Domain Specific Language embedded into Hop. HipHop programs are Abstract Syntax Trees that are executed by an HipHop Machine on demand. The HipHop Machine is only Hop code.
We choose to embed HipHop as a DSL in order to not change the Hop interpreter [1], and thus to not affect the efficiency of programs not using HipHop.
We wanted to reuse as much as Hop into HipHop to have a smooth deep embedding of HipHop in Hop.
[1] | The Hop Interpreter was the subject of an article presented a year ago at the Dynamic Language Symposium. The paper is available here. |
HipHop Basics
HipHop uses the same parenthesized, prefix syntax as Hop, (originating from Scheme and Lisp). HipHop is dynamically typed. We choose to suffix each HipHop syntax element with the ampersand symbol: '&', e.g. emit&, pause&, await&..., in order to distinguish them from Hop primitives.
HipHop programs manipulate events (called HipHop events, to distinguish them with others Hop/Web events) and Hop expressions. HipHop expressions are Hop values, thus Hop can generate them.
The HipHop language is compoundable, as Scheme. We distinguish the Core Language, containing the basic elements that have well-known semantics inherited from Esterel, and the Derived Forms, which aggregate the Core Expressions into high-level forms, for expressing common patterns, such as waiting for an event to occur.
HipHop expressions become executable programs when they are put in a HipHop machine. The Machine is responsible of linking HipHop Events with Hop events, and ensuring the synchronous hypothesis described below.
HipHop Model of Execution
HipHop is a synchronous reactive programming language. The term "Reactive system" characterizes a system that responds to events. A Web application is a typical reactive system, as it has to react to various events that may come from the user (mouse and keyboard), from the web browser (page loaded, window resized), or from the server (push events).
The synchronous hypothesis splits the continuous time where events occur into slices, called instants in which the continuous time is suspended. During an instant, a synchronous program computes its outputs according to its inputs and some internal state. The synchronous hypothesis ensures that the inputs won't vary while the outputs are computed. Instead of dealing with a real, continuous time, HipHop executions handle instants, a discrete, logical, time. The term reaction expresses the same idea as instant.
As a consequence, HipHop expressions speak about instants. For instance, the pause& expression suspends the execution until the next instant.
Return to Top
Page last modified Sat May 25 09:56:47 2013.