Along this document there are several footnotes explaining or clarifying some decisions. Often these footnotes exposes the reason for changes in the language compared to the in-house compiler. These footnotes are purely informative and are not an integral part of this document.
-
Some changes demand more details than a footnote permits. These are marked with the footnote [1] and further details are presented in Appendix E.
+
Some changes demand more details than a footnote permits. These are marked with the footnote [2] and further details are presented in Appendix E.
@@ -562,12 +562,12 @@
4.3. Types5. Elements
-
The lexical grammar of the language is context-sensitive. As such, the lexical elements and the syntactic elements are presented together.[2]
+
The lexical grammar of the language is context-sensitive. As such, the lexical elements and the syntactic elements are presented together.[3]
5.1. Source Code
-
Source code is a stream of printable ASCII characters plus the control codes line feed (\n), horizontal tab (\t) and carriage return (\r).[1]
+
Source code is a stream of printable ASCII characters plus the control codes line feed (\n), horizontal tab (\t) and carriage return (\r).[2]
@@ -577,7 +577,7 @@
5
-
Carriage returns should appear only before a line feed.[3]
+
Carriage returns should appear only before a line feed.[4]
Lowercase letters in the stream shall be interpreted as its uppercase equivalent.
@@ -599,7 +599,7 @@
5
-
Each line should be interpreted as if there is no whitespaces in either ends of the line.[4]
+
Each line should be interpreted as if there is no whitespaces in either ends of the line.[5]
A token character is any character capable of forming a single token.
@@ -646,7 +646,7 @@
5.2. Comm
-
The contents of a comment shall be interpreted as if it is whitespaces in the source code.[4] More specifically:
+
The contents of a comment shall be interpreted as if it is whitespaces in the source code.[5] More specifically:
Once the F characters is found, all characters including and following it shall be ignored. The same shall happen when the character . is found a second time.[7]
The literal can be preceded by a minus sign, which shall negate the floating-point number.
A LVAR_TEXT_LABEL parameter accepts an argument only if it is an identifier referencing a local variable of text label type.
+
+
In case text label variables are not supported, this parameter type is not supported.
+
6.3.15. STRING
A STRING parameter accepts an argument only if it is a string literal.
+
+
In case string literals are not supported, this parameter type is not supported.
+
6.3.16. Optional Parameters
@@ -1046,6 +1061,9 @@
The INPUT_OPT parameter accepts an argument only if it is an integer literal, floating-point literal, or identifier matching a global string constant or referencing a variable of integer or floating-point type (in this order). A variable of text label type may be accepted by an INPUT_OPT parameter.
+
+
In case text label variables are not supported, the VAR_TEXT_LABEL_OPT and LVAR_TEXT_LABEL_OPT parameter types are not supported.
+
@@ -1068,10 +1086,10 @@
7. Command Select
-
An integer literal argument must have a parameter of type INT.
+
An integer literal argument must have a parameter of type INT.
-
A floating-point literal argument must have a parameter of type FLOAT.
+
A floating-point literal argument must have a parameter of type FLOAT.
For identifiers, the following applies (in the given order):
@@ -1081,16 +1099,16 @@
7. Command Select
If the identifier matches a global string constant, the parameter type must be INT and the argument shall behave as if rewritten as an integer literal corresponding to the string constant value.
-
If the identifier references a global variable, the parameter type must be either (depending on the type of the said variable) VAR_INT, VAR_FLOAT or VAR_TEXT_LABEL.
+
If the identifier references a global variable, the parameter type must be either (depending on the type of the said variable) VAR_INT, VAR_FLOAT or VAR_TEXT_LABEL.
-
If the identifier references a local variable, the same rule as above applies, except by using LVAR_INT, LVAR_FLOAT and LVAR_TEXT_LABEL.
+
If the identifier references a local variable, the same rule as above applies, except by using LVAR_INT, LVAR_FLOAT and LVAR_TEXT_LABEL.
-
If the identifier matches any string constant in any enumeration (except the global enumeration), the parameter type must be INPUT_INT and the argument shall behave as if rewritten as an integer literal corresponding to the string constant value.
+
If the identifier matches any string constant in any enumeration (except the global enumeration), the parameter type must be INPUT_INT and the argument shall behave as if rewritten as an integer literal corresponding to the string constant value.
The specified label location must be within a scope. Such scope may begin at the next non-empty embedded statement relative to the label location.[13]
The type of a local variable and its respective input argument must match. For instance, if an input argument is an integer literal or variable of integer type, its corresponding local variable in the target scope must be of integer type.
@@ -3019,40 +3040,43 @@
References
-1. For consistency we have simplified this feature. Please refer to Appendix E for details on how the in-house compiler behaves.
+1. Despite not being used in GTA III, REPEAT seems to be supported since then given its command id is alongside the command id for the other statements.
-2. The in-house compiler is an ad-hoc parser, introducing a lot of contextual problems to the language.
+2. For consistency we have simplified this feature. Please refer to Appendix E for details on how the in-house compiler behaves.
-3. The in-house compiler does not have such a restriction. We introduce it for simplicity.
+3. The in-house compiler is an ad-hoc parser, introducing a lot of contextual problems to the language.
-4. This simplifies the syntactic specification.
+4. The in-house compiler does not have such a restriction. We introduce it for simplicity.
-5. i.e. "This // is a string" is a string literal, not an incomplete string.
+5. This simplifies the syntactic specification.
-6. We have not simplified this misfeature because it is used in one of the GTA III 10th Anniversary scripts.
+6. i.e. "This // is a string" is a string literal, not an incomplete string.
-7. The in-house compiler uses one-based indexing. Its array feature is incomplete and produces problematic bytecode when subscripting variables. Additionally, the GTA Vice City runtime (the target of the in-house compiler) does not support arrays. Thus it’s believed this feature is still incomplete in V413 and was never used. Not until GTA San Andreas, which introduces arrays in the execution environment. Its runtime performs zero-based indexing on variable subscripts, but for literal subscripts we can only guess. The compiled multifile contains debug strings that suggests zero-based indexing for literals.
+7. We have not simplified this misfeature because it is used in one of the GTA III 10th Anniversary scripts.
-8. The in-house compiler uses unsupported command selectors (NEGATE for substraction and ONEOVER for division) to perform this operation.
+8. The in-house compiler uses one-based indexing. Its array feature is incomplete and produces problematic bytecode when subscripting variables. Additionally, the GTA Vice City runtime (the target of the in-house compiler) does not support arrays. Thus it’s believed this feature is still incomplete in V413 and was never used. Not until GTA San Andreas, which introduces arrays in the execution environment. Its runtime performs zero-based indexing on variable subscripts, but for literal subscripts we can only guess. The compiled multifile contains debug strings that suggests zero-based indexing for literals.
-9. In Grand Theft Auto, the memory storage of local variables is not zeroed after leaving a scope (nor while entering one). This means local variables preserve values from previous scopes. Additionally, the Stories chapters share the storage of global variables between mission scripts, having the very same implications (no in-depth research has been conduced though).
+9. The in-house compiler uses unsupported command selectors (NEGATE for substraction and ONEOVER for division) to perform this operation.
-10. The parameter definition of REPEAT in the in-house compiler disallows local variables. Due to being a complex command, however, the compiler ignores this parametric restriction and ends up permiting local variables (which is likely the intended behaviour).
+10. In Grand Theft Auto, the memory storage of local variables is not zeroed after leaving a scope (nor while entering one). This means local variables preserve values from previous scopes. Additionally, the Stories chapters share the storage of global variables between mission scripts, having the very same implications (no in-depth research has been conduced though).
-11. The in-house compiler does not handle the case of text label variables in SCRIPT_NAME, but this does not tell much because it barely supports any text label variable feature. No compiled multi-file contains script names assigned by a variable. Thus, we refrain from defining any semantics for this case.
+11. The parameter definition of REPEAT in the in-house compiler disallows local variables. Due to being a complex command, however, the compiler ignores this parametric restriction and ends up permiting local variables (which is likely the intended behaviour).
-12. For GTA III 10th Anniversary multi-files, all target scopes are a line after its target label, which would emit an error in the in-house compiler (for GTA Vice City).
+12. The in-house compiler does not handle the case of text label variables in SCRIPT_NAME, but this does not tell much because it barely supports any text label variable feature. No compiled multi-file contains script names assigned by a variable. Thus, we refrain from defining any semantics for this case.
+
+
+13. For GTA III 10th Anniversary multi-files, all target scopes are a line after its target label, which would emit an error in the in-house compiler (for GTA Vice City).