3. File structure
EBNF
file = { include | action | selector | plan | query | sifting_pattern | trope } EOF .A Viv source file (.viv) is a sequence of zero or more include statements and construct definitions, a catch-all term for action definitions, selector definitions, plan definitions, query definitions, sifting-pattern definitions, and trope definitions.
Empty files
Section titled “Empty files”In Viv, empty files, including files containing only whitespace or comments, are valid code:
// Empty files are validInterleaving
Section titled “Interleaving”The various constructs may appear in any order, and interleaving is allowed. As such, a structure like this is syntactically valid:
include ...
action ...
trope ...
query ...
action ...
include ...
plan ...Source units are orderless
Section titled “Source units are orderless”Despite being written in a certain order, the constructs in a source file are conceptually orderless. An action may inherit from another action that is defined below it within the same file. Likewise, it may target such an action in a reaction. The file-importing process, implemented via includes, also treats these concerns as orderless.