A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
syntax.h File Reference
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <absl/time/time.h>
#include "a11/flow/token.h"
#include "a11/flow/vocabulary.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::flow::syntax::Location
 Where a piece of syntax starts, reduced to what every reader of it needs. More...
 
struct  a11::flow::syntax::Word
 A name as written, and where it was written. More...
 
struct  a11::flow::syntax::Constant
 A value the language can write out in full: what a literal is, and what folding a literal expression gives. More...
 
struct  a11::flow::syntax::TypeExpression
 The type of a port, or of a value being made one: string, list[a11.NodeFragment], "audio/wav". More...
 
struct  a11::flow::syntax::Node
 Base of every syntax node: what it is, and where it started. More...
 
struct  a11::flow::syntax::NodeOf< K >
 Gives each construct its kind without every constructor restating it. More...
 
struct  a11::flow::syntax::ErrorNode
 A place the parser wanted a value and did not find one. More...
 
struct  a11::flow::syntax::Literal
 A number, string, boolean, null or duration written out. More...
 
struct  a11::flow::syntax::Spread
 ...expr – everything expr holds, in the literal being written. More...
 
struct  a11::flow::syntax::ListLiteral
 [a, ...rest, c]. An item may be a [Spread]. More...
 
struct  a11::flow::syntax::ObjectLiteral
 { "key": expr, ...rest }. More...
 
struct  a11::flow::syntax::It
 it – the value a where/map/group stage is looking at. More...
 
struct  a11::flow::syntax::Discard
 _ – the destination that keeps nothing. More...
 
struct  a11::flow::syntax::Name
 A bare name: a port, a call, a loop variable, a header alias. More...
 
struct  a11::flow::syntax::Attr
 base.name – a call's port, or a key of a value. More...
 
struct  a11::flow::syntax::Index
 base[i] – an element of a list, or a key of an object. More...
 
struct  a11::flow::syntax::Builtin
 name(arg, ...) – one of the language's fixed functions. More...
 
struct  a11::flow::syntax::Zip
 Several streams read as one: zip(a, b, c), interleave(a, b, c). More...
 
struct  a11::flow::syntax::TypedValue
 Tag{...} or expr as Tag – a value made into a type's value. More...
 
struct  a11::flow::syntax::Unary
 not operand. More...
 
struct  a11::flow::syntax::Binary
 left op right for and or == != < <= > >= in + -. More...
 
struct  a11::flow::syntax::LogTail
 What a log or logf was written with, wherever it was written. More...
 
struct  a11::flow::syntax::Stage
 One | name arg stage of a pipeline. More...
 
struct  a11::flow::syntax::Pipeline
 A source expression and the stages its values pass through. More...
 
struct  a11::flow::syntax::Outcome
 status subject – the status of a call, a node, or a barrier. More...
 
struct  a11::flow::syntax::PipelineValue
 (stream | stage ...) used where a value is expected. More...
 
struct  a11::flow::syntax::CallModifiers
 The tee/via/timeout/after/with/id/forward tail of a call. More...
 
struct  a11::flow::syntax::CallExpression
 run/call action(port: pipeline, ...) and its modifiers. More...
 
struct  a11::flow::syntax::CallExpression::Argument
 One argument: the port named, where it was named, and what feeds it. More...
 
struct  a11::flow::syntax::Bind
 name = ... – a step the rest of the flow can refer to. More...
 
struct  a11::flow::syntax::Let
 let name = pipeline – one value, read from a stream and given a name. More...
 
struct  a11::flow::syntax::Block
 [try] { ... } – a block of statements that runs as one thing. More...
 
struct  a11::flow::syntax::Advance
 advance name – rebind a let value to the next value of its stream. More...
 
struct  a11::flow::syntax::CallStatement
 A call whose outputs nobody names (they are drained for it). More...
 
struct  a11::flow::syntax::Pipe
 pipeline -> target, target – write a stream into one or more nodes. More...
 
struct  a11::flow::syntax::SkipTarget
 The one reference changed by a counted skip. More...
 
struct  a11::flow::syntax::Skip
 skip n reference – discard the first n values for every reader. More...
 
struct  a11::flow::syntax::Wait
 wait subject – hold until a call, or a node this flow writes, is finished. More...
 
struct  a11::flow::syntax::Drain
 drain target – hold until a node's writers are done and its buffer has landed. More...
 
struct  a11::flow::syntax::Cancel
 cancel name – ask a called action to stop, cooperatively. More...
 
struct  a11::flow::syntax::Abort
 abort node [code] [message] – end a node with a failure. More...
 
struct  a11::flow::syntax::Fail
 fail [code] [message] – end the flow with a status. More...
 
struct  a11::flow::syntax::Log
 log [level] [what] / logf [level] "format" [args] – write to the flow's own log. More...
 
struct  a11::flow::syntax::ForEach
 for name[, name...] in pipeline [parallel n] { ... }. More...
 
struct  a11::flow::syntax::Repeat
 repeat [name = expr] [max n] { ... }. More...
 
struct  a11::flow::syntax::Carry
 name <- pipeline – what the next pass of a repeat carries. More...
 
struct  a11::flow::syntax::Until
 until expr / while expr – when a repeat stops. More...
 
struct  a11::flow::syntax::If
 if expr { ... } else { ... }. More...
 
struct  a11::flow::syntax::Nodes
 nodes name [{ ... }] – declare a temporary node map. More...
 
struct  a11::flow::syntax::NodeExpression
 node(id) [in map] – a node of this flow's own. More...
 
struct  a11::flow::syntax::PortDeclaration
 in/out name: type [stream] [required]. More...
 
struct  a11::flow::syntax::HeaderDeclaration
 header "x-name" [as alias] [default value]. More...
 
struct  a11::flow::syntax::FlowDeclaration
 One flow name { ... } declaration, or the one flow { ... } entry point. More...
 
struct  a11::flow::syntax::FieldRange
 A bound on a field: 1..200, 1.., ..200. More...
 
struct  a11::flow::syntax::FieldDeclaration
 One name: type [modifiers] ["description"] field of a struct. More...
 
struct  a11::flow::syntax::DtoDeclaration
 One struct name { ... } declaration: a shape a port may be typed with. More...
 

Namespaces

namespace  a11
 
namespace  a11::flow
 
namespace  a11::flow::syntax
 

Typedefs

using a11::flow::syntax::NodePtr = std::unique_ptr< Node >
 
using a11::flow::syntax::StagePtr = std::unique_ptr< Stage >
 
using a11::flow::syntax::PipelinePtr = std::unique_ptr< Pipeline >
 
using a11::flow::syntax::CallModifiersPtr = std::unique_ptr< CallModifiers >
 
using a11::flow::syntax::CallExpressionPtr = std::unique_ptr< CallExpression >
 
using a11::flow::syntax::PortDeclarationPtr = std::unique_ptr< PortDeclaration >
 
using a11::flow::syntax::HeaderDeclarationPtr = std::unique_ptr< HeaderDeclaration >
 
using a11::flow::syntax::FlowDeclarationPtr = std::unique_ptr< FlowDeclaration >
 
using a11::flow::syntax::FieldDeclarationPtr = std::unique_ptr< FieldDeclaration >
 
using a11::flow::syntax::DtoDeclarationPtr = std::unique_ptr< DtoDeclaration >
 

Enumerations

enum class  a11::flow::syntax::NodeKind {
  a11::flow::syntax::kError , a11::flow::syntax::kLiteral , a11::flow::syntax::kListLiteral , a11::flow::syntax::kObjectLiteral ,
  a11::flow::syntax::kSpread , a11::flow::syntax::kIt , a11::flow::syntax::kDiscard , a11::flow::syntax::kName ,
  a11::flow::syntax::kAttr , a11::flow::syntax::kIndex , a11::flow::syntax::kBuiltin , a11::flow::syntax::kZip ,
  a11::flow::syntax::kTypedValue , a11::flow::syntax::kUnary , a11::flow::syntax::kBinary , a11::flow::syntax::kStage ,
  a11::flow::syntax::kPipeline , a11::flow::syntax::kOutcome , a11::flow::syntax::kPipelineValue , a11::flow::syntax::kCallModifiers ,
  a11::flow::syntax::kCallExpression , a11::flow::syntax::kBind , a11::flow::syntax::kLet , a11::flow::syntax::kAdvance ,
  a11::flow::syntax::kBlock , a11::flow::syntax::kCallStatement , a11::flow::syntax::kPipe , a11::flow::syntax::kSkip ,
  a11::flow::syntax::kWait , a11::flow::syntax::kDrain , a11::flow::syntax::kCancel , a11::flow::syntax::kAbort ,
  a11::flow::syntax::kFail , a11::flow::syntax::kLog , a11::flow::syntax::kForEach , a11::flow::syntax::kRepeat ,
  a11::flow::syntax::kCarry , a11::flow::syntax::kUntil , a11::flow::syntax::kIf , a11::flow::syntax::kNodes ,
  a11::flow::syntax::kNodeExpression , a11::flow::syntax::kPortDeclaration , a11::flow::syntax::kHeaderDeclaration , a11::flow::syntax::kFlowDeclaration ,
  a11::flow::syntax::kFieldDeclaration , a11::flow::syntax::kDtoDeclaration
}
 What a node is. One per construct, mirroring a11/flow/syntax.py. More...
 
enum class  a11::flow::syntax::PortDirection { a11::flow::syntax::kInput , a11::flow::syntax::kOutput }
 Which side of the descriptor a port lands on, spelled as the plan spells it. More...
 

Functions

Location a11::flow::syntax::LocationOf (const Token &token)
 The location a token occupies.
 
std::string_view a11::flow::syntax::ConstantKindName (Constant::Kind kind)
 The spelling of a constant's kind in the output formats.
 
std::string_view a11::flow::syntax::NodeKindName (NodeKind kind)
 The name of a node kind in the output formats, in kebab case.
 
template<typename T >
const T * a11::flow::syntax::As (const Node *node)
 node as a T, or nullptr if it is something else.
 
template<typename T >
T * a11::flow::syntax::As (Node *node)
 
bool a11::flow::syntax::IsAnyOf (const Node *node, std::initializer_list< NodeKind > kinds)
 Whether a node is one of the kinds given.
 
std::string_view a11::flow::syntax::PortDirectionName (PortDirection direction)
 "inputs" or "outputs".
 
std::optional< Constant > a11::flow::syntax::ConstantValue (const Node *node)
 The constant node folds to, or nullopt where it is not one all the way down.
 
void a11::flow::syntax::VisitChildren (const Node &node, const std::function< void(const Node &)> &visit)
 Every node node directly holds, in the order they were written.
 
void a11::flow::syntax::VisitSubtree (const Node &node, const std::function< void(const Node &)> &visit)
 Every node of the subtree rooted at node, node itself included.
 
std::optional< std::string > a11::flow::syntax::DottedName (const Node *node)
 a11.sdk.AudioBuffer for a chain of plain names, or nullopt.