root ::=
{ Block } end-of-script
Block ::=
| 'keep' FilterHeader
| FilterBlock
| IfElseBlock
| AssignBlock
| KeepBlock
| ExprBlock
| ImportBlock
| LoopBlock
| FailBlock
| TableBlock
| ShowBlock
| ReadBlock
| ReturnBlock
| YieldBlock
| ExpectBlock
| DeleteBlock
| UserFunction
| EnumDefBlock
| StyleBlock
| AutoDiffBlock
| MonteCarloBlock
| MatchBlock
| SchemaDefinition
| SchemaClone
| WriteStmt
| ShowRegionBlock
FilterHeader ::=
FilterKind ConditionKind end-of-line
FilterKind ::=
| 'where'
| 'span'
ConditionKind ::=
| Expr,0,0,1,0,0,2,0,1,3,0,2,4,0,3,5,0,4,6,0,5,0,8,0,8,0,7,8,0,0
| Identifier '=' Expr
| Identifier '=' '[' Expr '..' Expr ']'
Expr ::=
|0
|0
|0
|0
|0 operator Expr
|1 Expr operator Expr
|2 Expr operator Expr
|3 Expr operator Expr
|4 Expr operator Expr
|5 Expr operator Expr
|6 Expr operator Expr
|7 'if' Expr 'then' Expr 'else' Expr
|8 Expr 'into' Identifier
Identifier ::=
identifier { '.' identifier }
FilterBlock ::=
FilterHeader ChainedFilterBody
ChainedFilterBody ::=
| FilterBlock
| indent { Block } dedent
IfElseBlock ::=
'if' Expr end-of-line indent { Block } dedent ElseTail
ElseTail ::=
|
| ElseBlock
| 'else' IfElseBlock
ElseBlock ::=
'else' end-of-line indent { Block } dedent
AssignBlock ::=
AssignPrefix AssignedValue
AssignPrefix ::=
{ AssignFlag } IdentifierOrUnderscore { ',' IdentifierOrUnderscore } '='
AssignFlag ::=
| 'export'
| 'const'
| 'sample'
| 'dash'
| 'mutable'
IdentifierOrUnderscore ::=
| Identifier
| '_'
AssignedValue ::=
| LineExpr
| Expr TailFilter end-of-line
| SchemaPath end-of-line
LineExpr ::=
| Expr end-of-line
| IfThenLineExpr
| IfThenElseLineExpr
IfThenLineExpr ::=
'if' Expr 'then' end-of-line IfThenLineExprBody
IfThenLineExprBody ::=
| indent LineExpr dedent 'else' ElseOrElif
| indent indent LineExpr dedent 'else' ElseOrElif dedent
ElseOrElif ::=
| end-of-line indent LineExpr dedent
| IfThenLineExpr
IfThenElseLineExpr ::=
IfThenElseLine indent MoreIfThenElseLine end-of-line dedent
IfThenElseLine ::=
'if' Expr 'then' Expr 'else' end-of-line
MoreIfThenElseLine ::=
| IfThenElseLine MoreIfThenElseLine
| Expr
TailFilter ::=
'where' Expr
SchemaPath ::=
schema path enter { SchemaPathContent } schema path leave
SchemaPathContent ::=
| format
| '\{' SchemaPathParam '}'
SchemaPathParam ::=
| Expr { ',' Expr }
| '..'
| Expr '..' Expr
| '..' Expr
| Expr '..'
KeepBlock ::=
| 'keep' Identifier end-of-line
| 'keep' Identifier 'as' Identifier end-of-line
| 'keep' Identifier '=' Expr end-of-line
| 'keep' 'process' identifier '=' KeepSig end-of-line
KeepSig ::=
Identifier '(' TypeIdentifier { ',' TypeIdentifier } [ ';' Expr { ',' Expr } ] ')'
TypeIdentifier ::=
identifier
ExprBlock ::=
ExprBlockLeft ExprBlockPrelude indent { Block } dedent
ExprBlockLeft ::=
|
| AssignPrefix
| 'return'
ExprBlockPrelude ::=
| 'with' end-of-line
| IterTarget [ EachWhen ] end-of-line
| IterTarget 'scan' WithDesc`1 [ EachWhen ] end-of-line
| IterTarget 'scan' '[' ExprTuple ']' [ EachWhen ] end-of-line
| IterTarget 'scan' 'auto' [ EachWhen ] end-of-line
IterTarget ::=
| 'each' Identifier
| 'for' Identifier 'in' ExprAtom { ',' Identifier 'in' ExprAtom }
| 'for' Identifier '=' ExprAtom [ '..' ExprAtom ]
ExprAtom ::=
| '(' ExprTuple ')'
| Identifier
| LiteralAtom`1
| LiteralAtom`1
| LiteralAtom`1
| text interpolation { FormatCell } ..."
| markdown template start { FormatCell } markdown template end
| StarLiteral
| SchemaVarAtom
ExprTuple ::=
ExprTupleElem [ ExprTupleSep ExprTuple ]
ExprTupleElem ::=
| Expr
| '...' Expr
| identifier ':' Expr
| Expr 'desc'
ExprTupleSep ::=
| ','
| ';'
LiteralAtom`1 ::=
{ identifier '.' } number
LiteralAtom`1 ::=
{ identifier '.' } boolean
LiteralAtom`1 ::=
{ identifier '.' } text
FormatCell ::=
| format
| '\{' Expr '}'
| '\{' IdBeforeColon ':' format '}'
IdBeforeColon ::=
| identifier
| identifier '.' IdBeforeColon
StarLiteral ::=
identifier { '.' identifier } '.*'
SchemaVarAtom ::=
'schema' '.' identifier
EachWhen ::=
'when' Expr
WithDesc`1 ::=
| ExprAtom
| ExprAtom 'desc'
ImportBlock ::=
'import' [ 'shared' ] text 'as' identifier ImportTail
ImportTail ::=
| end-of-line
| NamedImports
NamedImports ::=
'with' end-of-line indent { ImportColumn end-of-line } dedent
ImportColumn ::=
| identifier
| identifier ':' TypeIdentifier
LoopBlock ::=
'loop' LoopKind end-of-line indent { Block } dedent
LoopKind ::=
| ExprAtom 'in' Expr '..' Expr
| ExprAtom
| ExprAtom 'unsafe'
| ExprAtom 'in' Expr
| ExprAtom 'partitioned' 'table' Identifier
FailBlock ::=
'fail' LineExpr
TableBlock ::=
TableDecl TableDef
TableDecl ::=
[ 'export' ] 'table' identifier [ TablePrimary ] { TableSize } '='
TablePrimary ::=
'[' identifier ']'
TableSize ::=
| 'max' TableSizeLimit
| 'small' TableSizeLimit
| 'small'
| 'min' number
TableSizeLimit ::=
| number
| number '..' number
TableDef ::=
| TableValue
| 'with' end-of-line indent { Block } dedent
| AutoDiffBlock
TableValue ::=
| Identifier '(' [ ExprTuple ] ')' [ 'schema' Identifier ] end-of-line
| [ Identifier ] 'by' Expr { Label ':' Expr } end-of-line
| [ Identifier ] 'by' '[' ExprTuple ']' { Label ':' Expr } end-of-line
| 'where' Expr end-of-line
| 'draw' Expr end-of-line
| 'cross' '(' Identifier ',' Identifier ')' CallOption end-of-line
Label ::=
| identifier
| 'write'
CallOption ::=
|
| 'default' CallOptionExpr CallOption
| 'default' ExprAtomOrCall
| 'default' 'fail' CallOption
| 'when' CallOptionExpr CallOption
| 'when' ExprAtomOrCall
| 'at' CallOptionExpr CallOption
| 'at' ExprAtomOrCall
| 'at' '[' [ ExprTuple ] ']' CallOption
| 'by' CallOptionExpr CallOption
| 'by' ExprAtomOrCall
| 'by' '[' [ ExprTuple ] ']' CallOption
| 'scan' CallOptionExpr CallOption
| 'scan' ExprAtomOrCall
| 'scan' 'auto' CallOption
| 'scan' '[' [ ExprTuple ] ']' CallOption
| 'sort' CallOptionExpr CallOption
| 'sort' ExprAtomOrCall
| 'sort' '[' [ ExprTuple ] ']' CallOption
| CallOptionOver CallOption
| CallOptionCross CallOption
CallOptionExpr ::=
| ExprAtom
| operator CallOptionExpr
ExprAtomOrCall ::=
| ExprAtom
| ExprCall
| EnumCall
| operator ExprAtomOrCall
ExprCall ::=
Identifier '(' [ ExprTuple ] ')' CallOption
EnumCall ::=
'enum' '<<' Identifier '>>' '(' Expr ')'
CallOptionOver ::=
'over' [ Identifier '=' ] '[' [ Expr ] '..' Expr ']'
CallOptionCross ::=
'cross' '(' Identifier ',' Identifier [ 'as' identifier ] ')'
AutoDiffBlock ::=
'autodiff' Identifier { Label ':' Expr } 'with' end-of-line indent { ParamsStmt } { Block } dedent
ParamsStmt ::=
'params' Identifier [ ParamsRange ] [ 'abstract' ] ParamsInit end-of-line
ParamsRange ::=
'in' '[' [ Expr ] '..' [ Expr ] ']'
ParamsInit ::=
|
| '=' Expr
| 'auto' '(' Expr ',' Expr ')'
| 'auto'
ShowBlock ::=
| ShowBlock`2
| ShowBlock`2
| ShowBlock`2
ShowBlock`2 ::=
AssignOrStyleCode 'show' TileTypeWithColumns Expr ShowOptions [ ScScope ] end-of-line
AssignOrStyleCode ::=
| AssignPrefix
| { ScScope end-of-line }
ScScope ::=
| '{' [ ScEntry { ';' ScEntry } ] '}'
ScEntry ::=
| ScCoord ',' ScCoord [ 'card' or 'nocard' ] [ 'in' ScRegion ]
| property-name ':' ScValue
| ScSelector ScScope
ScCoord ::=
| number '..' number
| '..' number
| number '..'
| number
| '..'
ScRegion ::=
| 'dash'
| identifier
ScValue ::=
| text
| boolean
| identifier
| [ '-' ] number
| '#' ScColor
| '#' '(' Expr ')'
| '#' '[' Expr ']'
| text interpolation { FormatCell } ..."
ScColor ::=
| color
| colorId
| colornum
ScSelector ::=
| identifier
| '.' identifier
| '>' identifier
| '>' '.' identifier
| '&' identifier
| '&' '.' identifier
TileTypeWithColumns ::=
| tile-type
| 'table'
| 'upload'
ShowOptions ::=
| identifier ShowColor { Label ':' Expr }
| identifier { Label ':' Expr }
| { Label ':' Expr }
ShowColor ::=
| identifier
| colorId
| colornum
| number
ShowBlock`2 ::=
AssignOrStyleCode 'show' TileTypeWithColumns Expr ShowOptions [ ScScope ] ShowWithColumns
ShowWithColumns ::=
| ShowWithColumnsInline
| ShowWithColumnsMultiLine
ShowWithColumnsInline ::=
'with' ShowColumn { ',' ShowColumn } { ShowGroupOrder } end-of-line
ShowColumn ::=
[ 'mutable' ] Expr [ 'as' Expr ] { Label ':' Expr } [ ScScope ]
ShowGroupOrder ::=
| ShowGrouping
| ShowOrdering
ShowGrouping ::=
| 'group' 'by' GroupColumns
| 'group' 'into' Identifier
GroupColumns ::=
| '[' ExprTuple ']'
| Expr { ',' Expr }
ShowOrdering ::=
| 'order' 'by' OrderColumns
OrderColumns ::=
| '[' ExprTuple ']' [ 'desc' ]
| WithDesc`1 { ',' WithDesc`1 }
WithDesc`1 ::=
| Expr
| Expr 'desc'
ShowWithColumnsMultiLine ::=
'with' end-of-line indent { ShowColumn end-of-line } { ShowGroupOrder end-of-line } dedent
ShowBlock`2 ::=
AssignOrStyleCode 'show' 'chart' Expr ShowOptions [ ScScope ] ShowWithBlocks
ShowWithBlocks ::=
'with' end-of-line indent { ShowSubBlock } dedent
ShowSubBlock ::=
| ShowSubBlockLeaf
| ShowSubBlockNode
ShowSubBlockLeaf ::=
TileBlockType [ ShowSubBlockPrelude ] end-of-line [ ShowSubBlockIndentedBody ]
TileBlockType ::=
| identifier
ShowSubBlockPrelude ::=
| ShowColumn
| 'by' SubBlockGroupColumns { Label ':' Expr }
| 'into' Identifier { Label ':' Expr }
SubBlockGroupColumns ::=
| '[' ExprTuple ']'
| Expr
ShowSubBlockIndentedBody ::=
indent { ShowColumn end-of-line } [ ShowOrdering end-of-line ] dedent
ShowSubBlockNode ::=
TileBlockModifier end-of-line indent { ShowSubBlock } dedent
TileBlockModifier ::=
| FilterKind ConditionKind
ReadBlock ::=
'read' ReadSource
ReadSource ::=
| [ ReadAggregatorType [ number ] ] ReadPattern ReadNamingAndDescriptor
| 'upload' text ReadNamingAndDescriptor
| 'form' ReadAsWith
| [ ReadAggregatorType [ number ] ] SchemaPath ReadAs ReadTail
| ReadAs ReadAsWith
ReadAggregatorType ::=
| 'min'
| 'max'
| 'latest'
ReadPattern ::=
| text
| text interpolation { FormatCell } ..."
| '(' Expr ')'
ReadNamingAndDescriptor ::=
{ identifier ':' AnyLiteral } [ 'unsafe' ] ReadAs ReadTail
AnyLiteral ::=
| text
| number
| boolean
ReadAs ::=
'as' IdentifierOrUnderscore [ ReadTablePrimary ] { TableSize } [ 'expect' Tuple`4 ]
ReadTablePrimary ::=
'[' TablePrimaryName TablePrimaryFlag`1 ']'
TablePrimaryName ::=
| identifier
| identifier 'as' identifier
| '(' identifier { ',' identifier } ')' 'as' identifier
| identifier 'as' '_'
| '(' identifier { ',' identifier } ')' 'as' '_'
TablePrimaryFlag`1 ::=
| 'unsafe'
|
Tuple`4 ::=
'[' [ ExpectColumn { ',' ExpectColumn } ] ']'
ExpectColumn ::=
| identifier
| identifier 'unsafe'
ReadTail ::=
| end-of-line
| ReadAsWith
ReadAsWith ::=
'with' ReadWithSpec
ReadWithSpec ::=
| ColumnBlock
| InlineSchema
ColumnBlock ::=
end-of-line indent { ReadColumn } dedent
ReadColumn ::=
| 'schema' ReadSchemaInclude
| ReadColumnBind
| identifier ':' ReadType end-of-line
| identifier ':' AnyLiteral { identifier ':' AnyLiteral } 'as' identifier ':' ReadType end-of-line
| text { identifier ':' AnyLiteral } 'as' identifier end-of-line
| text { identifier ':' AnyLiteral } 'as' identifier ':' ReadType end-of-line
| 'const' '(' number ')' 'as' identifier end-of-line
| 'const' '(' '-' number ')' 'as' identifier end-of-line
| 'const' '(' boolean ')' 'as' identifier end-of-line
| 'const' '(' number ',' number ',' number ')' 'as' identifier end-of-line
| 'const' '(' text ')' 'as' identifier end-of-line
| 'const' '(' text ')' 'as' identifier ':' ReadType end-of-line
ReadSchemaInclude ::=
Identifier SchemaTailOrEnd
SchemaTailOrEnd ::=
| ReadSchemaTail
| end-of-line
ReadSchemaTail ::=
'with' end-of-line indent { SchemaSpecialization end-of-line } dedent
SchemaSpecialization ::=
identifier '=' SchemaBinding
SchemaBinding ::=
| 'read' '(' AnyLiteral ')' { identifier ':' AnyLiteral }
| Expr
ReadColumnBind ::=
identifier [ ':' TypeIdentifier ] '=' ReadBindExprOrTranspose end-of-line
ReadBindExprOrTranspose ::=
| Expr
| 'read' '(' AnyLiteral { ',' AnyLiteral } ')' { identifier ':' AnyLiteral }
ReadType ::=
| TypeIdentifier
| 'enum' Identifier
| 'table' 'enum' [ identifier [ '[' identifier ']' ] ]
InlineSchema ::=
'schema' Identifier end-of-line
ReturnBlock ::=
'return' LineExpr
YieldBlock ::=
| '[|' 'as' identifier { ',' 'as' identifier } '|]' end-of-line
| '[|' Expr [ 'as' identifier ] { ',' Expr [ 'as' identifier ] } '|]' end-of-line
ExpectBlock ::=
'expect' ExpectDecl end-of-line
ExpectDecl ::=
| 'table' Identifier { TableSize }
| Identifier '=' Expr
DeleteBlock ::=
'delete' Identifier end-of-line
UserFunction ::=
[ 'export' ] 'def' FunctionFlags Identifier UserFunctionSig UserFunctionBody dedent
FunctionFlags ::=
| FunctionKind
| 'assoc' FunctionFlags
| 'autodiff' FunctionFlags
| 'const' FunctionFlags
| 'random' FunctionFlags
FunctionKind ::=
| 'pure'
| 'process'
UserFunctionSig ::=
| UserFunctionOneLineSig
| UserFunctionMultiLineSig
UserFunctionOneLineSig ::=
'(' [ UserFunctionArgument { ',' UserFunctionArgument } ] [ ';' UserFunctionArgument { ',' UserFunctionArgument } ] ')' TagAndDefaultWith end-of-line indent
UserFunctionArgument ::=
identifier ':' TypeIdentifier
TagAndDefaultWith ::=
[ 'as' text ] [ 'default' Expr ] 'with'
UserFunctionMultiLineSig ::=
'(' end-of-line indent indent UserFunctionArgument { UserFunctionMoreLineArg } ')' TagAndDefaultWith end-of-line dedent
UserFunctionMoreLineArg ::=
',' end-of-line UserFunctionArgument
UserFunctionBody ::=
{ Block }
EnumDefBlock ::=
[ 'export' ] 'table' 'enum' identifier [ TablePrimary ] '=' EnumDefList
EnumDefList ::=
| Expr { ',' Expr } end-of-line
| Expr { ',' Expr } end-of-line indent { Expr { ',' Expr } end-of-line } dedent
StyleBlock ::=
'@' [ identifier ] ScScope end-of-line
MonteCarloBlock ::=
'montecarlo' Expr 'with' end-of-line indent { Block } dedent
MatchBlock ::=
AssignPrefix MatchExpression
MatchExpression ::=
'match' Expr 'with' end-of-line indent { MatchLine } dedent
MatchLine ::=
MatchPattern '->' LineExpr
MatchPattern ::=
| Expr
| Expr '..' [ Expr ]
| '..' [ Expr ]
| 'like' Expr
SchemaDefinition ::=
[ 'export' ] 'schema' SchemaDefName { TableSize } 'with' end-of-line indent { SchemaColumn } dedent
SchemaDefName ::=
| identifier
| SchemaPath
SchemaColumn ::=
| SchemaColumnDef
| 'schema' Identifier end-of-line
SchemaColumnDef ::=
identifier [ ':' SchemaType ] SchemaValue [ ScScope ] end-of-line
SchemaType ::=
| TypeIdentifier
| 'enum' Identifier
SchemaValue ::=
| { identifier ':' AnyLiteral }
| SchemaReadMapping { identifier ':' AnyLiteral }
| '=' Expr
SchemaReadMapping ::=
'=' 'read' '(' text { ',' text } ')'
SchemaClone ::=
'schema' SchemaDefName { TableSize } '=' SchemaPath end-of-line
WriteStmt ::=
'write' Identifier [ 'partitioned' ] 'as' WritePath { Label ':' Expr } WriteWith
WritePath ::=
| Expr
| SchemaPath
WriteWith ::=
| [ ShowOrdering ] end-of-line
| 'with' 'schema' Identifier [ ShowOrdering ] end-of-line
| 'with' end-of-line indent { WriteColumn } [ ShowOrdering end-of-line ] dedent
WriteColumn ::=
| WriteColumnData
| 'schema' Identifier WriteSchemaTail
WriteColumnData ::=
identifier '=' Expr end-of-line
WriteSchemaTail ::=
| end-of-line
| WriteSchemaSpecialization
WriteSchemaSpecialization ::=
'with' end-of-line indent { WriteColumnData } dedent
ShowRegionBlock ::=
AssignOrStyleCode 'show' 'region' [ ScScope ] ShowRegionTail
ShowRegionTail ::=
| end-of-line
| 'with' end-of-line indent { Block } dedent