Grammar and types

This guide discusses Tableau's basic grammar, variable declarations, and data types.

Overview

Tableau borrows most of its syntax and types from Protocol Buffers (proto3) and Golang.

Scalar types

Details disccused at Protocol Buffers Proto3 Scalar.

KindTypesDefault
Numbersint32, uint32
int64, uint64
float, double
0
0
0.0
Booleansboolfalse
Stringsstring""
Bytesbytes""

Composite types

TypeDescription
structA struct is mapped to a protobuf message.
listA list is mapped to a protobuf repeated field.
mapA map is mapped to a protobuf map field.

struct

FeatureDescription
Horizontal layoutEach scalar field located in one cell.
Simple incell structEach field must be scalar type.
It is a comma-separated list of fields. E.g.: 1,test,3.0.
If the data list’s size is not same as struct’s fields, then fields will be filled in order. Fields not configured will be filled with default values due to its scalar type.

list

FeatureDescription
Horizontal layoutThis is list’s default layout.
Element type can be struct or scalar.
Vertical layoutList’s element type should be struct.
Simple incell listElement type must be scalar.
It is a comma-separated list of elements. E.g.: 1,2,3.
ScalableScalable or dynamic list size.
Ignore empty elementSmart recognition of empty element at any position.

map

FeatureDescription
Horizontal layout
Vertical layoutThis is map’s default layout.
Hash mapImplemented as unordered map or hash map.
Ordered mapSupported by tableauio/loader.
- C++
Simple incell mapBoth key and value must be scalar type.
It is a comma-separated list of key:value pairs.
E.g.: 1:10,2:20,3:30.
ScalableScalable or dynamic map size.
Ignore empty itemSmart recognition of empty item at any position.

Enumeration

FeatureDescription
Three forms of enum value1. Enum value number.
2. Enum value name.
3. Enum value alias name (with EnumValueOptions specified).
ValidationAuto-check legality of enum values.

Empty value

TypeDescription
scalarEmpty scalar will be emplaced with scalar type’s default value.
structEmpty struct will not be spawned if all fields are empty.
listEmpty list will not be spawned if list’s size is 0.
Empty struct will not be appended if list’s element(struct type) is empty.
mapEmpty map will not be spawned if map’s size is 0. Empty struct will not be inserted if map’s value(struct type) is empty.
nestingRecursively empty.