Skip to main content

EBNF

Constant EBNF 

Source
pub const EBNF: &str = "(* vibe-0.1 \u{2014} copy of vibescript-core.md \u{a7}3. Normative source is that document. *)\nProgram        ::= LocaleDecl* ModuleDecl? ImportDecl* PrefixDecl* (UsingDecl | RequiresDecl)* Item* ;\nLocaleDecl     ::= \'locale\' Identifier \';\' ;\nModuleDecl     ::= \'module\' (IRI | Identifier) \';\' ;\nImportDecl     ::= \'import\' StringLiteral (\'as\' Identifier)? \';\' ;\nPrefixDecl     ::= \'prefix\' Identifier \':\' IRI \';\' ;\nUsingDecl      ::= \'using\' UsingSpec (\',\' UsingSpec)* \';\' ;\nUsingSpec      ::= Identifier ( \'.\' \'{\' Identifier (\',\' Identifier)* \'}\' )? ;\nRequiresDecl   ::= \'requires\' \'[\' CapList? \']\' \';\' ;\nCapList        ::= CapSpec (\',\' CapSpec)* ;\nCapSpec        ::= \'capability\' \'(\' StringLiteral (\',\' NamedArg)* \')\' ;\n\nItem           ::= FunctionDecl | HookDecl | ConstDecl | CellDecl | PresentDecl\n                 | BindDecl | EnumDecl | FieldDecl | MaterialDecl | LawDecl | Statement ;\nBindDecl       ::= \'bind\' Expression \'<->\' Expression\n                   (\'using\' Identifier \'[\' Expression \',\' Expression \']\')?\n                   (\'resolve\' Identifier)? \';\' ;\nCellDecl       ::= EffectClass? \'cell\' Identifier ParamList? (\'when\' Expression)? (\':=\' | \'=\') Expression \';\' ;\nPresentDecl    ::= \'present\' Identifier \'{\' PresentProp* \'}\' ;\nConstDecl      ::= \'const\' Identifier (\':\' Type)? \'=\' Expression \';\' ;\nFunctionDecl   ::= EffectClass? \'async\'? \'fn\' Identifier \'(\' Params? \')\'\n                   BudgetClause? (\'->\' Type)? Block ;\nHookDecl       ::= \'on\' EventPath \'(\' Params? \')\' BudgetClause? (\'->\' Type)? Block ;\nEventPath      ::= Identifier (\':\' Identifier)* ;\nEffectClass    ::= \'pure\' | \'hot\' | \'cold\' | \'async\' | \'effect\' ;\nBudgetClause   ::= \'budget\' \'(\' NamedArg (\',\' NamedArg)* \')\' ;\n\nParams         ::= Param (\',\' Param)* ;\nParam          ::= Identifier \':\' Type ;\nNamedArg       ::= Identifier \':\' Expression ;\n\nStatement      ::= LetStmt | AssignStmt | IfStmt | ForStmt | WhileStmt\n                 | MatchStmt | ReturnStmt | YieldStmt | TransactionStmt\n                 | EffectStmt | Expression \';\' ;\nLetStmt        ::= \'let\' \'mut\'? Identifier (\':\' Type)? (\'=\' Expression)? \';\' ;\nAssignStmt     ::= PostfixExpr \'=\' Expression \';\' ;\nIfStmt         ::= \'if\' Expression Block (\'else\' (IfStmt | Block))? ;\nForStmt        ::= \'for\' Identifier \'in\' Expression Block ;\nWhileStmt      ::= \'while\' Expression Block ;\nMatchStmt      ::= \'match\' Expression \'{\' MatchArm* \'}\' ;\nMatchArm       ::= Pattern \'=>\' (Block | (Expression \',\')) ;\nReturnStmt     ::= \'return\' Expression? \';\' ;\nYieldStmt      ::= \'yield\' Expression? \';\' ;\nTransactionStmt::= \'transaction\' (\'(\' NamedArg (\',\' NamedArg)* \')\')? Block ;\nEffectStmt     ::= \'effect\' Expression \';\' ;\nBlock          ::= \'{\' Statement* \'}\' ;\n\n(* Cell host only \u{2014} not part of Program *)\nCellBody       ::= \'=\' Expression ;\n\nExpression     ::= Pipeline ;\nPipeline       ::= TweenExpr (\'|>\' TweenExpr)* ;\nTweenExpr      ::= LogicalOr (\'~\' LogicalOr \'over\' LogicalOr\n                   ((\'ease\' Identifier) | (\'spring\' \'(\' NamedArg* \')\'))? )? ;\nLogicalOr      ::= LogicalAnd (\'||\' LogicalAnd)* ;\nLogicalAnd     ::= Equality (\'&&\' Equality)* ;\nEquality       ::= Relational ((\'==\' | \'!=\') Relational)* ;\nRelational     ::= Additive ((\'<\' | \'<=\' | \'>\' | \'>=\') Additive)* ;\nAdditive       ::= Multiplicative ((\'+\' | \'-\') Multiplicative)* ;\nMultiplicative ::= Unary ((\'*\' | \'/\' | \'%\') Unary)* ;\nUnary          ::= (\'!\' | \'-\' | \'+\' | \'await\')? PostfixExpr ;\nPostfixExpr    ::= Primary (\'.\' Identifier | \'(\' Args? \')\' | \'[\' Expression \']\' | \'?\')* ;\nArgs           ::= Arg (\',\' Arg)* ;\nArg            ::= (Identifier \':\')? Expression ;\n\nPrimary        ::= Literal | Identifier | QueryVar | IRI | PrefixedName\n                 | BlankNode | TripleTerm | ReifiedTerm\n                 | ListLiteral | RecordLiteral | LambdaExpr | IfExpr | GraphQuery | Modal\n                 | ColorLit | QuantityLit | \'(\' Expression \')\' ;\n\nIfExpr         ::= \'if\' Expression \'{\' Expression \'}\' \'else\' (IfExpr | (\'{\' Expression \'}\')) ;\nLambdaExpr     ::= \'|\' (Identifier (\',\' Identifier)*)? \'|\' Expression ;\nGraphQuery     ::= \'graph?\' \'ask\'? \'{\' Expression* \'}\' ;\nModal          ::= (\'obligate\' | \'permit\' | \'forbid\' | \'knows\' | \'believes\'\n                 | \'always\' | \'eventually\') \'{\' Expression \'}\' ;\nPrefixedName   ::= Identifier \':\' (Identifier | IntegerLiteral) ;\nColorLit       ::= \'#\' HexDigits ;\nQuantityLit    ::= (IntegerLiteral | FloatLiteral) UnitSuffix ;\n\nLiteral        ::= StringLiteral | IntegerLiteral | FloatLiteral\n                 | \'true\' | \'false\' | \'null\' ;\nListLiteral    ::= \'[\' (Expression (\',\' Expression)*)? \']\' ;\nRecordLiteral  ::= \'{\' (NamedArg (\',\' NamedArg)*)? \'}\' ;\n\nTripleTerm     ::= \'<<(\' Subject Predicate Object \')>>\' ;\nReifiedTerm    ::= \'<<\' Subject Predicate Object \'~\' Reifier \'>>\' ;\nSubject        ::= IRI | PrefixedName | BlankNode | TripleTerm | Identifier | QueryVar ;\nPredicate      ::= IRI | PrefixedName | Identifier ;\nObject         ::= Subject | Literal ;\nReifier        ::= IRI | PrefixedName | BlankNode | Identifier ;\n\nType           ::= TypeName (\'<\' Type (\',\' Type)* \'>\')? ;\nTypeName       ::= \'i32\' | \'u32\' | \'i64\' | \'u64\' | \'f32\' | \'f64\'\n                 | \'bool\' | \'string\' | \'bytes\'\n                 | \'Iri\' | \'BlankNode\' | \'Did\' | \'Hash\' | \'Var\'\n                 | \'Literal\' | \'TripleTerm\' | \'Reifier\' | \'Quin\' | \'QuinRef\'\n                 | \'AssetRef\' | \'TensorRef\' | \'GeometryRef\'\n                 | \'Option\' | \'Result\' | \'List\' | \'Record\'\n                 | \'Receipt\' | \'Stream\' | \'Future\' | Identifier ;\n\nPattern        ::= \'_\' | Identifier | Literal | \'Ok\' \'(\' Pattern \')\'\n                 | \'Err\' \'(\' Pattern \')\' | \'Some\' \'(\' Pattern \')\' | \'None\' ;\n";