A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
resolve.cc File Reference
#include "a11/flow/resolve.h"
#include <algorithm>
#include <cstddef>
#include <optional>
#include <ranges>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <absl/container/flat_hash_map.h>
#include <absl/container/flat_hash_set.h>
#include <absl/strings/str_cat.h>
#include <absl/strings/str_join.h>
#include <absl/time/time.h>
#include <absl/types/span.h>
#include "a11/flow/diagnostic.h"
#include "a11/flow/pattern.h"
#include "a11/flow/plan.h"
#include "a11/flow/syntax.h"
#include "a11/flow/vocabulary.h"
#include "absl/strings/match.h"

Namespaces

namespace  a11
 
namespace  a11::flow
 

Functions

std::string_view a11::flow::SymbolKindName (SymbolKind kind)
 The name of a symbol kind, for a message and for the JSON.
 
ResolveResult a11::flow::Resolve (std::string_view source, const ParseResult &parsed, bool build_graph=false)
 Resolve a parsed program: names, ports, scopes, node maps and types.
 

Variable Documentation

◆ carried

bool carried = false

◆ carries

std::string carries

◆ carries_a_value

bool carries_a_value = true

False for a for. What <- checks.

◆ has_carry_name

bool has_carry_name = false

◆ has_front

bool has_front = false

Whether a counted skip may take values off the front of it: only a stream that is genuinely produced somewhere has a front.

◆ kind

Kind kind = Kind::kUnknown

◆ label

std::string label

◆ loop_body

bool loop_body = false

Whether this scope is the body of a for or a repeat.

Only advance asks, and it has to: its offset is fixed when the file is compiled, so advancing a name from outside a loop moves nothing and every pass sees the same value. Knowing whether a lookup crossed a loop is the difference between reporting that and letting it look like it works.

◆ names

std::vector<std::string> names

◆ node

graph::RefId node = graph::kNone

The graph ref this answer corresponds to, when a graph is being built.

One extra field rather than a second resolver: ~25 sites return one of these, and what the runtime needs from them is the identity of the stream they named. [graph::kNone] on the editor path, and wherever the reference did not resolve.

◆ parallel

int parallel = 1

How many passes may run at once, so until can refuse to be written on a loop where "the pass that just finished" names several passes.

◆ parent

const Scope* parent = nullptr

◆ readable

bool readable = true

◆ shape

std::string shape {}

The shape this stream's values are, where the flow said so: a port typed with a struct, or what a map Shape{..} or an as Shape just made.

Not a type system – the language does not have one and is not getting one here. It is one fact carried along a pipeline, and it is carried because it answers a question that is otherwise unanswerable until a value arrives: whether | json has anything to render.

Written {} rather than left bare so that the ~25 sites building one of these with a braced list – every one of which stops before this field – are not each a -Wmissing-field-initializers warning.

◆ step

graph::StepId step = graph::kNone

The graph step it is, so <- and until can fill it in.

◆ stopped

bool stopped = false

◆ subject

std::string subject

What to call it in the message: ‘'Source’, orthe pattern`.

◆ symbol

size_t symbol = kNoSymbol

The symbol this reads through, for the usage counts.

◆ tolerant

bool tolerant = false

For an outcome: whether a bad one is the flow's business or the subject's.

True where the subject is a try call, or a barrier on one.

◆ writable

bool writable = false