From b42e6a677aafbb820ff8aa0e1678fa694c4011fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denilson=20das=20Merc=C3=AAs=20Amorim?= Date: Sun, 2 Dec 2018 00:23:55 -0300 Subject: [PATCH] Deploy --- core.html | 241 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 203 insertions(+), 38 deletions(-) diff --git a/core.html b/core.html index 9ac8e83..15f64f0 100644 --- a/core.html +++ b/core.html @@ -52,7 +52,7 @@
@@ -75,11 +75,11 @@

GTA3script Specification

-
  • 10. Script File Structure +
  • 10. Script File Structure
  • 11. Supporting Commands @@ -210,14 +210,14 @@

    GTA3script Specification

  • Appendix A: Grammar Summary
  • -
  • Appendix B: Regular Lexical Grammar
  • +
  • Appendix B: Regular Lexical Grammar
  • Appendix C: Ambiguity
  • -
  • Appendix D: How to MISS2
  • +
  • Appendix D: How to MISS2
  • References
  • @@ -236,7 +236,7 @@

    IntroductionThe DMA Design compiler is very basic and contains a huge amount of bugs. These bugs introduce a lot of inconsistencies and quirks to the language. This document attempts to resolve these issues and set a coherent language.

    -

    The language specified by this document is thus a subset of the language accepted by the in-house compiler. Any source code translated by an implementation of this should be able to be translated by the original compiler. The reverse is not true. A known list of differences is presented in Appendix D.

    +

    The language specified by this document is thus a subset of the language accepted by the in-house compiler. Any source code translated by an implementation of this should be able to be translated by the original compiler. The reverse is not true. A known list of differences is presented in Appendix D.

    @@ -255,7 +255,7 @@

    1. Scope

    -

    2. Terms and Definitions

    +

    2. Terms and Definitions

    For the purposes of this document, the terms and definitions given in [ISO/IEC 2382:2015] and the following apply.

    @@ -380,10 +380,10 @@

    <

    -

    3. General Principles

    +

    3. General Principles

    -

    3.1. Implementation Conformance

    +

    3.1. Implementation Conformance

    A conforming implementation must be able to translate and correctly execute, within its resource limits, any program which does not violate the rules in this document.

    @@ -401,27 +401,27 @@

    -

    3.2. Structure of this Document

    +

    3.2. Structure of this Document

    -

    Section 4 through 10 describes the GTA3script programming language. That description includes detailed syntactic specifications in a form detailed in 3.3. For convenience, Appendix A repeats all such syntactic specifications.

    +

    Section 4 through 10 describes the GTA3script programming language. That description includes detailed syntactic specifications in a form detailed in 3.3. For convenience, Appendix A repeats all such syntactic specifications.

    Sections 11 and 12 describes a minimal set of commands to perform computations using the language.

    -

    Appendix B describes a regular grammar suitable for scanning the language.

    +

    Appendix B describes a regular grammar suitable for scanning the language.

    Appendix C describes ambiguities present in the language grammar and resolutions for them.

    -

    Appendix D describes problematic elements in the in-house compiler that this specification choose not to follow.

    +

    Appendix D describes problematic elements in the in-house compiler that this specification choose not to follow.

    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 D.

    +

    Some changes demand more details than a footnote permits. These are marked with the footnote [1] and further details are presented in Appendix D.

    @@ -1788,10 +1788,10 @@

    -

    10. Script File Structure

    +

    10. Script File Structure

    -

    10.1. Main Script Files

    +

    10.1. Main Script Files

    main_script_file := {statement} ;
    @@ -1814,7 +1814,7 @@

    -

    10.2. Main Extension Files

    +

    10.2. Main Extension Files

    main_extension_file := {statement} ;
    @@ -1831,7 +1831,7 @@

    -

    10.3. Subscript Files

    +

    10.3. Subscript Files

    subscript_file := 'MISSION_START' eol
    @@ -1860,7 +1860,7 @@ 

    -

    10.4. Mission Script Files

    +

    10.4. Mission Script Files

    mission_script_file := subscript_file ;
    @@ -2437,13 +2437,179 @@

    Appendix A: Grammar Summary

    -
    -

    TODO

    +
    +
    +
    # The GTA3script Grammar (informative)
    +
    +ascii_char := ascii_printable | ascii_control ;
    +ascii_printable := /* printable ASCII characters */ ;
    +ascii_control := '\n' | '\t' | '\r' ;
    +
    +whitespace := ' ' | '\t' | '(' | ')' | ',' ;
    +
    +newline := ['\r'] `\n` ;
    +
    +graph_char := ascii_printable - (whitespace | '"') ;
    +token_char := graph_char - ('+' | '-' | '*' | '/' | '=' | '<' | '>') ;
    +
    +sep := whitespace {whitespace} ;
    +eol := newline | EOF ;
    +
    +comment := line_comment | block_comment ;
    +line_comment := '//' {ascii_char} eol ;
    +block_comment := '/*' {block_comment | ascii_char} '*/' ;
    +
    +command_name := token_char {token_char} ;
    +command := command_name { sep argument } ;
    +
    +argument := integer
    +          | floating
    +          | identifier
    +          | string_literal ;
    +
    +digit := '0'..'9' ;
    +integer := ['-'] digit {digit} ;
    +
    +floating_form1 := '.' digit { digit | '.' | 'F' } ;
    +floating_form2 := digit { digit } ('.' | 'F') { digit | '.' | 'F' } ;
    +floating := ['-'] (floating_form1 | floating_form2) ;
    +
    +identifier := ('$' | 'A'..'Z') {token_char} ;
    +
    +string_literal := '"' { ascii_char - (newline | '"') } '"' ;
    +
    +variable_char := token_char - ('[' | ']') ;
    +variable_name := ('$' | 'A'..'Z') {variable_char} ;
    +
    +subscript := '[' (variable_name | integer) ']' ;
    +variable := variable_name [ subscript ] ;
    +
    +binop := '+' | '-' | '*' | '/' | '+@' | '-@' ;
    +asop := '=' | '=#' | '+=' | '-=' | '*=' | '/=' | '+=@' | '-=@' ;
    +unop := '--' | '++' ;
    +
    +expr_assign_abs := identifier {whitespace} '=' {whitespace} 'ABS' {whitespace} argument ;
    +expr_assign_binary := identifier {whitespace} asop {whitespace} argument ;
    +expr_assign_ternary := identifier {whitespace} '=' {whitespace} argument {whitespace} binop {whitespace} argument ;
    +expr_assign_unary := (unop {whitespace} identifier)
    +                   | (identifier {whitespace} unop) ;
    +
    +assignment_expression := expr_assign_unary
    +                       | expr_assign_binary
    +                       | expr_assign_ternary
    +                       | expr_assign_abs ;
    +
    +relop := '=' | '<' | '>' | '>=' | '<=' ;
    +conditional_expression := argument {whitespace} relop {whitespace} argument ;
    +
    +statement := labeled_statement
    +           | embedded_statement ;
    +
    +label_def := identifier ':' ;
    +label_prefix := label_def sep ;
    +
    +labeled_statement := label_prefix embedded_statement
    +                   | label_def empty_statement ;
    +
    +empty_statement := eol ;
    +
    +embedded_statement := empty_statement
    +                     | command_statement
    +                     | expression_statement
    +                     | scope_statement
    +                     | var_statement
    +                     | if_statement
    +                     | ifnot_statement
    +                     | if_goto_statement
    +                     | ifnot_goto_statement
    +                     | while_statement
    +                     | whilenot_statement
    +                     | repeat_statement
    +                     | require_statement ;
    +
    +command_statement := command eol ;
    +
    +expression_statement := assignment_expression eol
    +                      | conditional_expression eol ;
    +
    +scope_statement := '{' eol
    +                   {statement}
    +                   [label_prefix] '}' eol ;
    +
    +command_var_name := 'VAR_INT'
    +                    | 'LVAR_INT'
    +                    | 'VAR_FLOAT'
    +                    | 'LVAR_FLOAT'
    +                    | 'VAR_TEXT_LABEL'
    +                    | 'LVAR_TEXT_LABEL' ;
    +command_var_param := sep variable ;
    +
    +var_statement := command_var_name command_var_param {command_var_param} eol ;
    +
    +conditional_element := ['NOT' sep] (command | conditional_expression) ;
    +
    +and_conditional_stmt := 'AND' sep conditional_element eol ;
    +or_conditional_stmt := 'OR' sep conditional_element eol ;
    +
    +conditional_list := conditional_element eol
    +                    ({and_conditional_stmt} | {or_conditional_stmt}) ;
    +
    +if_statement := 'IF' sep conditional_list
    +                {statement}
    +                [[label_prefix] 'ELSE' eol
    +                {statement}]
    +                [label_prefix] 'ENDIF' eol ;
    +
    +ifnot_statement := 'IFNOT' sep conditional_list
    +                   {statement}
    +                   [[label_prefix] 'ELSE' eol
    +                   {statement}]
    +                   [label_prefix] 'ENDIF' eol ;
    +
    +if_goto_statement := 'IF' sep conditional_element sep 'GOTO' sep identifier eol ;
    +
    +ifnot_goto_statement := 'IFNOT' sep conditional_element sep 'GOTO' sep identifier eol ;
    +
    +while_statement := 'WHILE' sep conditional_list
    +                   {statement}
    +                   [label_prefix] 'ENDWHILE' eol ;
    +
    +whilenot_statement := 'WHILENOT' sep conditional_list
    +                      {statement}
    +                      [label_prefix] 'ENDWHILE' eol ;
    +
    +repeat_statement := 'REPEAT' sep integer sep identifier eol
    +                    {statement}
    +                    [label_prefix] 'ENDREPEAT' eol ;
    +
    +filename := {graph_char} '.SC' ;
    +
    +require_statement := command_gosub_file
    +                   | command_launch_mission
    +                   | command_load_and_launch_mission ;
    +
    +command_gosub_file := 'GOSUB_FILE' sep identifier sep filename eol ;
    +
    +command_launch_mission := 'LAUNCH_MISSION' sep filename eol ;
    +
    +command_load_and_launch_mission := 'LOAD_AND_LAUNCH_MISSION' sep filename eol ;
    +
    +main_script_file := {statement} ;
    +
    +main_extension_file := {statement} ;
    +
    +subscript_file := 'MISSION_START' eol
    +                  {statement}
    +                  [label_prefix] 'MISSION_END' eol
    +                  {statement} ;
    +
    +mission_script_file := subscript_file ;
    +
    -

    Appendix B: Regular Lexical Grammar

    +

    Appendix B: Regular Lexical Grammar

    @@ -2532,7 +2698,7 @@

    Appendix C: Ambiguity

    Not only the language, but the grammar presented in this document is ambiguous. Here are all the instances of ambiguity, which is the correct derivation, and suggestions to avoid users getting trapped in them.

    -

    C.1. IF GOTO

    +

    C.1. IF GOTO

    IF COMMAND goto other
    @@ -2550,7 +2716,7 @@ 

    C.1. IF GOTO

    -

    C.2. Ternary Minus One

    +

    C.2. Ternary Minus One

    x = 1-1
    @@ -2576,13 +2742,13 @@ 

    C.2.

    The fifth line is not ambiguous.

    -

    The token stream produced by the regular lexical grammar in Appendix B should solve this issue naturally.

    +

    The token stream produced by the regular lexical grammar in Appendix B should solve this issue naturally.

    -

    Appendix D: How to MISS2

    +

    Appendix D: How to MISS2

    The leaked script compiler is full of bugs. It was written for in-house use, so it’s meant to work and recognize at least the intended language. The problem is, the language is too inconsistent in this buggy superset. After constantly trying to make those bugs part of this specification, I strongly believe we shouldn’t. For the conservative, the following is a list of known things miss2 accepts that this specification does not.

    @@ -2864,8 +3030,7 @@

    References

    -

    TODO should we fix the floating point literals (e.g. '1.9.2')? I think there are DMA scripts that need this. -TODO list of special command names (user cannot write these, include AND/OR/NOT) +

    TODO list of special command names (user cannot write these, include AND/OR/NOT) TODO label semantics of start new script (GTA3 allows label: {}) TODO SAN ANDREAS ALLOWS IDENTIFIERS TO BEGIN WITH UNDERSCORES TODO remember GTASA INPUT_OPT does not accept text label vars at all (not at runtime level) @@ -2893,7 +3058,7 @@

    References


    -1. For consistency we have simplified this feature. Please refer to Appendix D for details on how the in-house compiler behaves. +1. For consistency we have simplified this feature. Please refer to Appendix D for details on how the in-house compiler behaves.