-- Sakura.bnf Sakura BNF productions statement ::= WHEN event : statement statement ::= CHOICE { guardcomlist } statement ::= ON event -> statement WITHIN statement statement ::= PAR { parlist } guardcomlist ::= guardcomlist "||" guardcom guardcom ::= WHEN event -> statement guardcomlist ::= guardcom parlist ::= parlist // statement parlist ::= statement transferseries ::= transferseries ; transferexp transferseries ::= transferexp transferseries ::= transferexp ::= lhs _ exp transfermode ::= DEVICE block ::= { IN pairlist OUT pairlist GUARDIAN statement STATE pairlist DATAFLOW transferseries CONTROL statement } event ::= updownsignal event ::= updownsignal AND exp updownsignal ::= lhs UP updownsignal ::= lhs DOWN updownsignal ::= lhs CHANGE Sakura parse tree nodes definitions statement: When[Event, statement] Connector.GetNewUp[lhs]; statement OR DO Connector.GetNewUp[lhs]; IF cond THEN EXIT ENDLOOP; statement statement: Choice[List(Guardedcommand)] DO Connector.PutNewUp[lhs1,u1]; Connector.PutNewUp[lhs2,u2] u_connector.Wait[]; IF u=u1 THEN s1 ELSE IF u=u2 THEN s2 ELSE LOOP ENDLOOP; statement: On[Event, statement, statement] {ENABLE ABORTED => CONTINUE; ons2: PROC = {s2; Process.Abort[p2]}; cond: PROC = {WAIT Event; Process.Abort[p1]; s1}; p1 _ FORK ons2[]; p2 _ FORK cond[]; [] _ JOIN p1; [] _ JOIN p2}; statement: Parallel[List(statement)] p1 _ FORK s1[]; p2 _ FORK s2[]; [] _ JOIN p1; [] _ JOIN p2; Guardedcommand[Event, statement] st body: Deviceblock[List(Decl), List(Decl), statement, List(Decl), List(Transfer), statement] -- used in the context Decl[names, deviceTC, Deviceblock] Decl[names: List(Id), type: DeviceTC[args: List(Decl), rtns: List(Decl)], init: Deviceblock[in: List(Decl), out: List(Decl), guardian: statement, state: List(Decl), body: statement] ] Decl[names: List(Id), type: ProcTC[args: oldDecl.type.args@oldDecl.init.in@oldDecl.init.out, rtns: List(Decl)], init: Guardianblock[guardian: renameports(oldDecl.init.guardian, newDecl.type.args), block: Block[decls: oldDecl.init.state, stmts: renameports(oldDecl.init.body, newDecl.type.args)] Guardianblock[guardian: statement, block: block] Body[opens: NIL, decls: List(Decl[names: FooGuardian, type: ProcTC[args: NIL, rtns: NIL], init: Body[opens: NIL, decls: NIL, stmts: Guardianblock.guardian, locks: NIL], Decl[names: FooBlock, type: ProcTC[args: NIL, rtns: NIL], init: Body[opens: NIL, decls: NIL, stmts: Guardianblock.block, locks: NIL]), stmts: "p1 _ FORK FooGuardian[]; p2 _ FORK FooBlock[]; [] _ JOIN p1; [] _ JOIN p2", locks: NIL] Event[updownsignal, exp] updownsignal: Upsignal[lhs] updownsignal: Downsignal[lhs] updownsignal: Changesignal[lhs]