diff --git a/Variable-Definition-and-Type-Notation.md b/Variable-Definition-and-Type-Notation.md new file mode 100644 index 0000000..135f73a --- /dev/null +++ b/Variable-Definition-and-Type-Notation.md @@ -0,0 +1,13 @@ +In ARF, variables are defined using the syntax `name:Type:qualifier`, where name +is a name token and type is either just a name token describing what type it is, +or a pointer to a value of that type or an array to a value of that type. The +only supported qualifier is `:mut`, which marks the variable's data as mutable. +Variables are immutable by default. + +Pointers are defined like `name:{Type}` and arrays are defined like +`name:{Type length}` where length is an unsigned integer literal or an ellipsis +token (..). If an integer token is given, the length of the array is static, and +if an ellipsis is given, the length is dynamic and can be changed at runtime. + +Variables can be defined wherever they are used. For example, `set x:Int 5` +defines a variable of type Int and sets it to 5. \ No newline at end of file