Values

Types define the representation of information and values the concrete instances. For example, 42 would be an instance of type count and 1.2.3.4 an instance of type addr. Every value is optional and may be nil. For a given type, nil is always a valid value, but it is impossible to deduce a type from the nil literal.

VAST uses a recursive descent approach to parse a value, using an LL(k) grammar for a unique and predictable representation of values.

Parsers

Each type has an associated value with corresponding parser. This section explains valid input for the parser of that type.

bool

The bool type defines exactly two valid input, T for true and F for false.

InputSemantics
Ttrue
Ffalse

int

The int type is 64-bit signed integer. It requires a sign in order to distinguish it from a count.

InputSemantics
-4negative value
+0zero
+7positive value

count

The count type is 64-bit unsigned integer to represent "things that can be counted."

InputSemantics
0zero
42positive value

real

The real type is a IEE754 double-precision floating point value.

InputSemantics
-4.2negative value
0.0zero
3.1415positive value

Scientific notation is not currently supported.

duration

The duration type is a nanosecond-precision time span to represent negative or positive time deltas. The parser accepts input of the form [sign] number unit.

InputSemantics
-3ns3 nanoseconds backward
4 secs4 seconds forward
+10 h10 hours forward

The table lists valid suffixes an their corresponding units.

SuffixUnit
ns, nsec, nsecsnanoseconds
us, usec, usecsmicroseconds
ms, msec, msecsmilliseconds
s, sec, secsseconds
m, min, minsminutes
h, hour, hours, hrshours
d, day, days,days (24 hours)
w, week, weeks,weeks (24 * 7 hours)

time

The time type represents a specific point in time. Unless explicitly specified, all time values are interpreted as UTC timestamps.

InputSemantics
nowThe current system time
in 10snow plus 10 seconds
5m agonow minus 5 minutes
@1588520865UNIX timestamp (seconds since the UNIX epoch)
@1588520865.123fractional UNIX timestamp
2020-03-152020-03-15 at 00:00:00 UTC
2020-03-15+032020-03-15 at 03:00:00 UTC
2020-03-15T13As above, different time divider
2020-03-15+03:242020-03-15 at 03:24:00 UTC
2020-03-15+03:24:592020-03-15 at 03:24:59 UTC
2020-03-15+03:24:59Z2020-03-15 at 03:24:59 UTC
2020-03-15+03:24:59-82020-03-15 at 03:24:59 UTC-8
2020-03-15+03:24:59+32020-03-15 at 03:24:59 UTC+3

string

The string type represents a sequence of characters.

InputSemantics
""The empty string
"foo"The string foo
"\""A string containing an escaped double quote (")
"\x2a"An escaped byte 0x2a in a string
note

VAST currently supports only ASCII strings. Unicode support is on our roadmap.

pattern

The pattern type represents a regular expression.

InputSemantics
/./A regex that matches a single character
/a*b+c/A regex with quantifiers

addr

The addr type represents an IPv4 or IPv6 address. VAST uses the IPv4-mapped IPv6 address representation, where the first 80 bits are zero, followed by 16 one-bits, and then last 32 bits containing the IPv4 address.

InputSemantics
0.0.0.0The non-routable invalid IPv4 address
8.8.8.8The IPv4 address of a well-known DNS server
::1The IPv6 loopback address
2001:db8::A dummy IPv6 address used for documentation

subnet

The subnet type represents a CIDR-style definition of groups of IP addresses. The parser accepts input of the form addr / prefix, where valid prefix are in the range [0,128].

InputSemantics
10.0.0.0/8A private class A network
::1/128IPv6 loopback address with a single address
2001:db8::/322^96 addresses for documentation purposes

port

The port type represents a transport-layer port, consisting of a number and protocol. The syntax is number / proto where proto is either for ? to denote an unknown protocol or one of tcp, udp, icmp, icmp6, sctp.

InputSemantics
53/udp53 UDP (typically DNS)
80/tcp80 TCP (typically HTTP)
8/icmp8 ICMP (typically echo)
1337/?1337 with unknown protocol

Containers

There exist three containers types: vector<T> for an ordered list of elements, set<T> for an unordered list of unique values, and map<T, U> as associative array.

In the following, x, y, and z, are a instances of type T and a, b, and c instances of type U.

TypeValue
vector<T>[x, y, z], []
set<T>{x, y, z}, {}
map<T, U>{x -> a, y -> b, z -> c}, {-}

Type inference for container instances is tricky, because it's impossible to infer the element type from an empty container, or from a container that contains nil elements. Ther

note

The current implementation for container types is not yet complete: map<T, U> is not indexable or queryable, and vector and set only work efficiently for low-cardinality instances.

SI Literals

To simplify expression of large integer values, VAST supports literals with suffixes according to the International System of Units (SI). These suffixes apply to type int and count:

Suffix10^XValue
k31 000
M61 000 000
G91 000 000 000
P121 000 000 000 000
E151 000 000 000 000 000

For example, 42k is equal to 42000, and -9G equal to -9000000000.

In addition to expressing numbers to the power of 10, there exists a parallel array of suffixes for expressing numbers with base 2 to represent bytes:

Suffix2^XValue
Ki101 024
Mi201 048 576
Gi301 073 741 824
Pi401 099 511 627 776
Ei501 125 899 906 842 624

For example, 8Ki is equal to 8192, and 64Mi equal to 67108864.

note

We purposefully chose IEC-style binary suffixes that end in i to avoid ambiguities of frequent abbreviations, such as "64K", which colloquially means "64 kilo bytes" to the power of 2 but resembles more the suffix for a value to the power of 10.