2016-03-19 17:01:14 +00:00
|
|
|
// -*- javascript -*-
|
2016-03-18 21:00:51 +00:00
|
|
|
// Syntactic extensions to ES5 for Syndicate/js. See compiler.js for
|
|
|
|
// the rest of the translator.
|
|
|
|
|
|
|
|
Syndicate <: ES5 {
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Extensions to expressions.
|
|
|
|
|
|
|
|
Statement
|
|
|
|
+= ActorStatement
|
2016-04-07 07:42:54 +00:00
|
|
|
| DataspaceStatement
|
2016-03-18 21:00:51 +00:00
|
|
|
| ActorFacetStatement
|
2016-08-25 12:12:32 +00:00
|
|
|
| ActorEndpointStatement
|
2016-03-18 21:00:51 +00:00
|
|
|
| AssertionTypeDeclarationStatement
|
2016-08-07 19:33:09 +00:00
|
|
|
| FieldDeclarationStatement
|
2016-03-18 21:00:51 +00:00
|
|
|
| SendMessageStatement
|
|
|
|
|
2016-05-12 04:01:09 +00:00
|
|
|
FunctionBodyBlock = "{" FunctionBody "}" // odd that this isn't in es5.ohm somewhere
|
|
|
|
|
2016-03-18 21:00:51 +00:00
|
|
|
ActorStatement
|
2017-02-16 19:38:56 +00:00
|
|
|
= spawnStar (named Expression<withIn>)? FunctionBodyBlock -- noReact
|
|
|
|
| spawn (named Expression<withIn>)? FunctionBodyBlock -- withReact
|
2016-03-18 21:00:51 +00:00
|
|
|
|
2016-04-07 07:42:54 +00:00
|
|
|
DataspaceStatement
|
2016-05-12 04:01:09 +00:00
|
|
|
= ground dataspace identifier? FunctionBodyBlock -- ground
|
|
|
|
| dataspace FunctionBodyBlock -- normal
|
2016-03-18 21:00:51 +00:00
|
|
|
|
|
|
|
ActorFacetStatement
|
2016-08-25 12:12:32 +00:00
|
|
|
= react FunctionBodyBlock
|
|
|
|
|
|
|
|
ActorEndpointStatement
|
|
|
|
= on start FunctionBodyBlock -- start
|
|
|
|
| on stop FunctionBodyBlock -- stop
|
|
|
|
| assert FacetPattern AssertWhenClause? #(sc) -- assert
|
|
|
|
| on FacetEventPattern FunctionBodyBlock -- event
|
|
|
|
| on event identifier FunctionBodyBlock -- onEvent
|
|
|
|
| stop on FacetTransitionEventPattern FunctionBodyBlock -- stopOnWithCont
|
|
|
|
| stop on FacetTransitionEventPattern #(sc) -- stopOnNoCont
|
|
|
|
| dataflow FunctionBodyBlock -- dataflow
|
|
|
|
| during FacetPattern FunctionBodyBlock -- during
|
2017-02-16 19:38:56 +00:00
|
|
|
| during FacetPattern spawn (named Expression<withIn>)? FunctionBodyBlock -- duringSpawn
|
2016-08-25 12:12:32 +00:00
|
|
|
|
|
|
|
AssertWhenClause = when "(" Expression<withIn> ")"
|
2016-03-18 21:00:51 +00:00
|
|
|
|
|
|
|
AssertionTypeDeclarationStatement
|
2016-05-11 14:59:27 +00:00
|
|
|
= (assertion | message) type identifier "(" FormalParameterList ")" ("=" stringLiteral)? #(sc)
|
2016-03-18 21:00:51 +00:00
|
|
|
|
2016-08-07 21:34:19 +00:00
|
|
|
FieldDeclarationStatement = field MemberExpression ("=" AssignmentExpression<withIn>)? #(sc)
|
2016-08-07 19:33:09 +00:00
|
|
|
MemberExpression += field MemberExpression -- fieldRefExp
|
|
|
|
UnaryExpression += delete field MemberExpression -- fieldDelExp
|
|
|
|
|
2016-03-18 21:00:51 +00:00
|
|
|
SendMessageStatement = "::" Expression<withIn> #(sc)
|
|
|
|
|
|
|
|
FacetEventPattern
|
|
|
|
= message FacetPattern -- messageEvent
|
|
|
|
| asserted FacetPattern -- assertedEvent
|
|
|
|
| retracted FacetPattern -- retractedEvent
|
|
|
|
|
2016-03-19 17:48:49 +00:00
|
|
|
FacetTransitionEventPattern
|
2016-03-19 18:50:08 +00:00
|
|
|
= FacetEventPattern -- facetEvent
|
|
|
|
| "(" Expression<withIn> ")" -- risingEdge
|
2016-03-19 17:48:49 +00:00
|
|
|
|
2016-03-18 21:00:51 +00:00
|
|
|
FacetPattern
|
|
|
|
= LeftHandSideExpression metalevel decimalIntegerLiteral -- withMetalevel
|
|
|
|
| LeftHandSideExpression -- noMetalevel
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Keywords. We don't add them to the "keyword" production because
|
|
|
|
// we don't want to make them unavailable to programs as
|
|
|
|
// identifiers.
|
|
|
|
|
2017-02-16 19:38:56 +00:00
|
|
|
spawnStar = "spawn*" ~identifierPart
|
|
|
|
spawn = "spawn" ~("*" | identifierPart)
|
2016-03-18 21:00:51 +00:00
|
|
|
assert = "assert" ~identifierPart
|
|
|
|
asserted = "asserted" ~identifierPart
|
|
|
|
assertion = "assertion" ~identifierPart
|
2016-08-07 19:33:09 +00:00
|
|
|
dataflow = "dataflow" ~identifierPart
|
2016-04-07 07:42:54 +00:00
|
|
|
dataspace = "dataspace" ~identifierPart
|
2016-03-18 21:00:51 +00:00
|
|
|
during = "during" ~identifierPart
|
2016-05-14 23:06:00 +00:00
|
|
|
event = "event" ~identifierPart
|
2016-08-07 19:33:09 +00:00
|
|
|
field = "field" ~identifierPart
|
2016-03-18 21:00:51 +00:00
|
|
|
ground = "ground" ~identifierPart
|
|
|
|
message = "message" ~identifierPart
|
|
|
|
metalevel = "metalevel" ~identifierPart
|
2016-05-18 20:51:51 +00:00
|
|
|
named = "named" ~identifierPart
|
2016-03-18 21:00:51 +00:00
|
|
|
on = "on" ~identifierPart
|
2016-05-10 22:49:12 +00:00
|
|
|
react = "react" ~identifierPart
|
2016-03-18 21:00:51 +00:00
|
|
|
retracted = "retracted" ~identifierPart
|
2016-08-25 12:12:32 +00:00
|
|
|
start = "start" ~identifierPart
|
|
|
|
stop = "stop" ~identifierPart
|
2016-03-18 21:00:51 +00:00
|
|
|
type = "type" ~identifierPart
|
2016-05-08 16:19:40 +00:00
|
|
|
when = "when" ~identifierPart
|
2016-03-18 21:00:51 +00:00
|
|
|
}
|