StructOp Handbook
Contents Examples Commands
Handbook / Application language

Language overview

A StructOp application is a collection of declarations. Its intent selects the target, while the application files describe data and behaviour. Start with your first program for a complete build, or use the topic directory below to look up a declaration.

On this page

Files and blocks#

Put the structop target block in intent.st. All .st files in the project folder are read together in name order; files whose names begin with a dot are ignored. You can split application declarations across vars.st, main.st, and other files. Values for variables may come from variables.stvars.

BlockPurpose
structop { ... }what to build (type_app), which providers (lib_provider), and exports
variable "name" { ... }a read-only input, set by its default or a .stvars file
constant "name" { ... }a value fixed at build time
parameter "name" { ... }a command-line argument
ability "kind" "Name" { ... }one piece of behaviour or one type, from a provider; ability "value" holds data that changes
data "kind" "Name" { ... }reads information, such as a value's contents or a widget's text
module "name" { ... }another folder of .st files used as a unit
output "name" { ... }a value a module hands back

Comments start with #. Names may contain - (Named-Prompt, x-1), so subtract from a name with spaces: n - 1. After a number, - is the minus operator: 5-3 is 2, 0x10-1 is 15 and 6/2-1 is 2. A name still takes its hyphens, so x-1 is one name, and 5-n is 5 - n. A number that carries on with letters or an exponent sign, such as 1e-3 or 5a-3, is an invalid number.

Find a language topic#

TopicWhen to use it
Variables and constantsSet build-time inputs and defaults
ParametersPass command-line arguments
Values and dataRead and change program data
TypesChoose a type for a value
ExpressionsCompute results and write conditions
AbilitiesDeclare behaviour and dependencies
FunctionsDefine and call reusable behaviour
ModulesReuse files and expose outputs
EnvironmentsSelect environment-specific settings
ErrorsLocate a validation error

For the attributes of a particular provider ability, use the reference index. To change the build target, see C and Rust targets.