aboutsummaryrefslogtreecommitdiff
path: root/language/statements/variables.rst
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-11-02 13:37:32 -0700
committerMelody Horn <melody@boringcactus.com>2020-11-02 13:37:32 -0700
commit8868b5fa2e8b9f40a31035c51519cce40e73f079 (patch)
tree4a91e7d5437f91a7f95358753097a99e2c84cf2e /language/statements/variables.rst
parent83e23b6b449112f4a85d09c57e5601faa87856ca (diff)
downloadspec-8868b5fa2e8b9f40a31035c51519cce40e73f079.tar.gz
spec-8868b5fa2e8b9f40a31035c51519cce40e73f079.zip
define compile-time vs runtime behavior
Diffstat (limited to 'language/statements/variables.rst')
-rw-r--r--language/statements/variables.rst24
1 files changed, 24 insertions, 0 deletions
diff --git a/language/statements/variables.rst b/language/statements/variables.rst
new file mode 100644
index 0000000..6bc1a6f
--- /dev/null
+++ b/language/statements/variables.rst
@@ -0,0 +1,24 @@
+Variables
+^^^^^^^^^
+
+.. crowbar:element:: VariableDeclaration <- Type identifier ';'
+
+ Compile-time Behavior:
+
+ A variable declaration specifies the type and name of a variable but not its initial value.
+ This is only used in :crowbar:ref:`HeaderFile`\ s as part of API boundaries.
+
+ Runtime Behavior:
+
+ A variable declaration has no runtime behavior.
+
+.. crowbar:element:: VariableDefinition <- Type identifier '=' Expression ';'
+
+ Compile-time Behavior:
+
+ A variable definition specifies the type, name, and initial value of a variable.
+ If the expression has a type which is not the type specified for the variable, an error must be emitted.
+
+ Runtime Behavior:
+
+ When a variable definition is executed, the expression is evaluated, and its result is made available with the given name.