From 51cde76891558d572a44dd6f240f275482140ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denilson=20das=20Merc=C3=AAs=20Amorim?= Date: Fri, 30 Nov 2018 19:55:55 -0300 Subject: [PATCH] Deploy --- asciidoctor.css | 420 ++++++++ core.html | 2638 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 2492 insertions(+), 566 deletions(-) create mode 100644 asciidoctor.css diff --git a/asciidoctor.css b/asciidoctor.css new file mode 100644 index 0000000..916bea6 --- /dev/null +++ b/asciidoctor.css @@ -0,0 +1,420 @@ +/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */ +/* Uncomment @import statement below to use as custom stylesheet */ +/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/ +article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block} +audio,canvas,video{display:inline-block} +audio:not([controls]){display:none;height:0} +script{display:none!important} +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%} +a{background:transparent} +a:focus{outline:thin dotted} +a:active,a:hover{outline:0} +h1{font-size:2em;margin:.67em 0} +abbr[title]{border-bottom:1px dotted} +b,strong{font-weight:bold} +dfn{font-style:italic} +hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0} +mark{background:#ff0;color:#000} +code,kbd,pre,samp{font-family:monospace;font-size:1em} +pre{white-space:pre-wrap} +q{quotes:"\201C" "\201D" "\2018" "\2019"} +small{font-size:80%} +sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} +sup{top:-.5em} +sub{bottom:-.25em} +img{border:0} +svg:not(:root){overflow:hidden} +figure{margin:0} +fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em} +legend{border:0;padding:0} +button,input,select,textarea{font-family:inherit;font-size:100%;margin:0} +button,input{line-height:normal} +button,select{text-transform:none} +button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer} +button[disabled],html input[disabled]{cursor:default} +input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0} +button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0} +textarea{overflow:auto;vertical-align:top} +table{border-collapse:collapse;border-spacing:0} +*,*::before,*::after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box} +html,body{font-size:100%} +body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto;tab-size:4;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased} +a:hover{cursor:pointer} +img,object,embed{max-width:100%;height:auto} +object,embed{height:100%} +img{-ms-interpolation-mode:bicubic} +.left{float:left!important} +.right{float:right!important} +.text-left{text-align:left!important} +.text-right{text-align:right!important} +.text-center{text-align:center!important} +.text-justify{text-align:justify!important} +.hide{display:none} +img,object,svg{display:inline-block;vertical-align:middle} +textarea{height:auto;min-height:50px} +select{width:100%} +.center{margin-left:auto;margin-right:auto} +.stretch{width:100%} +.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em} +div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr} +a{color:#2156a5;text-decoration:underline;line-height:inherit} +a:hover,a:focus{color:#1d4b8f} +a img{border:none} +p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility} +p aside{font-size:.875em;line-height:1.35;font-style:italic} +h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em} +h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0} +h1{font-size:2.125em} +h2{font-size:1.6875em} +h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em} +h4,h5{font-size:1.125em} +h6{font-size:1em} +hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0} +em,i{font-style:italic;line-height:inherit} +strong,b{font-weight:bold;line-height:inherit} +small{font-size:60%;line-height:inherit} +code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} +ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} +ul,ol{margin-left:1.5em} +ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em} +ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit} +ul.square{list-style-type:square} +ul.circle{list-style-type:circle} +ul.disc{list-style-type:disc} +ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} +dl dt{margin-bottom:.3125em;font-weight:bold} +dl dd{margin-bottom:1.25em} +abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help} +abbr{text-transform:none} +blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd} +blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)} +blockquote cite::before{content:"\2014 \0020"} +blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)} +blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)} +@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2} +h1{font-size:2.75em} +h2{font-size:2.3125em} +h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em} +h4{font-size:1.4375em}} +table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede} +table thead,table tfoot{background:#f7f8f7} +table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left} +table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)} +table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7} +table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6} +h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em} +h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400} +.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table} +.clearfix::after,.float-group::after{clear:both} +*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed;word-wrap:break-word} +*:not(pre)>code.nobreak{word-wrap:normal} +*:not(pre)>code.nowrap{white-space:nowrap} +pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed} +em em{font-style:normal} +strong strong{font-weight:400} +.keyseq{color:rgba(51,51,51,.8)} +kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap} +.keyseq kbd:first-child{margin-left:0} +.keyseq kbd:last-child{margin-right:0} +.menuseq,.menuref{color:#000} +.menuseq b:not(.caret),.menuref{font-weight:inherit} +.menuseq{word-spacing:-.02em} +.menuseq b.caret{font-size:1.25em;line-height:.8} +.menuseq i.caret{font-weight:bold;text-align:center;width:.45em} +b.button::before,b.button::after{position:relative;top:-1px;font-weight:400} +b.button::before{content:"[";padding:0 3px 0 2px} +b.button::after{content:"]";padding:0 2px 0 3px} +p a>code:hover{color:rgba(0,0,0,.9)} +#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em} +#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table} +#header::after,#content::after,#footnotes::after,#footer::after{clear:both} +#content{margin-top:1.25em} +#content::before{content:none} +#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0} +#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #ddddd8} +#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px} +#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap} +#header .details span:first-child{margin-left:-.125em} +#header .details span.email a{color:rgba(0,0,0,.85)} +#header .details br{display:none} +#header .details br+span::before{content:"\00a0\2013\00a0"} +#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)} +#header .details br+span#revremark::before{content:"\00a0|\00a0"} +#header #revnumber{text-transform:capitalize} +#header #revnumber::after{content:"\00a0"} +#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem} +#toc{border-bottom:1px solid #efefed;padding-bottom:.5em} +#toc>ul{margin-left:.125em} +#toc ul.sectlevel0>li>a{font-style:italic} +#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0} +#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none} +#toc li{line-height:1.3334;margin-top:.3334em} +#toc a{text-decoration:none} +#toc a:active{text-decoration:underline} +#toctitle{color:#7a2518;font-size:1.2em} +@media screen and (min-width:768px){#toctitle{font-size:1.375em} +body.toc2{padding-left:15em;padding-right:0} +#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto} +#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em} +#toc.toc2>ul{font-size:.9em;margin-bottom:0} +#toc.toc2 ul ul{margin-left:0;padding-left:1em} +#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em} +body.toc2.toc-right{padding-left:0;padding-right:15em} +body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #efefed;left:auto;right:0}} +@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0} +#toc.toc2{width:20em} +#toc.toc2 #toctitle{font-size:1.375em} +#toc.toc2>ul{font-size:.95em} +#toc.toc2 ul ul{padding-left:1.25em} +body.toc2.toc-right{padding-left:0;padding-right:20em}} +#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} +#content #toc>:first-child{margin-top:0} +#content #toc>:last-child{margin-bottom:0} +#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em} +#footer-text{color:rgba(255,255,255,.8);line-height:1.44} +#content{margin-bottom:.625em} +.sect1{padding-bottom:.625em} +@media screen and (min-width:768px){#content{margin-bottom:1.25em} +.sect1{padding-bottom:1.25em}} +.sect1:last-child{padding-bottom:0} +.sect1+.sect1{border-top:1px solid #efefed} +#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400} +#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em} +#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible} +#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none} +#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221} +.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em} +.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic} +table.tableblock.fit-content>caption.title{white-space:nowrap;width:0} +.paragraph.lead>p,#preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)} +table.tableblock #preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:inherit} +.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%} +.admonitionblock>table td.icon{text-align:center;width:80px} +.admonitionblock>table td.icon img{max-width:none} +.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase} +.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)} +.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0} +.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px} +.exampleblock>.content>:first-child{margin-top:0} +.exampleblock>.content>:last-child{margin-bottom:0} +.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} +.sidebarblock>:first-child{margin-top:0} +.sidebarblock>:last-child{margin-bottom:0} +.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center} +.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0} +.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8} +.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1} +.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em} +.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal} +@media screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}} +@media screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}} +.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)} +.listingblock pre.highlightjs{padding:0} +.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px} +.listingblock pre.prettyprint{border-width:0} +.listingblock>.content{position:relative} +.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999} +.listingblock:hover code[data-lang]::before{display:block} +.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:#999} +.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"} +table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none} +table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45} +table.pyhltable td.code{padding-left:.75em;padding-right:0} +pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8} +pre.pygments .lineno{display:inline-block;margin-right:.25em} +table.pyhltable .linenodiv{background:none!important;padding-right:0!important} +.quoteblock{margin:0 1em 1.25em 1.5em;display:table} +.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em} +.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify} +.quoteblock blockquote{margin:0;padding:0;border:0} +.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)} +.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0} +.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right} +.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)} +.quoteblock .quoteblock blockquote{padding:0 0 0 .75em} +.quoteblock .quoteblock blockquote::before{display:none} +.verseblock{margin:0 1em 1.25em} +.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility} +.verseblock pre strong{font-weight:400} +.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex} +.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic} +.quoteblock .attribution br,.verseblock .attribution br{display:none} +.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)} +.quoteblock.abstract{margin:0 1em 1.25em;display:block} +.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center} +.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{word-spacing:0;line-height:1.6} +.quoteblock.abstract blockquote::before,.quoteblock.abstract p::before{display:none} +table.tableblock{max-width:100%;border-collapse:separate} +p.tableblock:last-child{margin-bottom:0} +td.tableblock>.content{margin-bottom:-1.25em} +table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} +table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0} +table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0} +table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0} +table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px} +table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0} +table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0} +table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0} +table.frame-all{border-width:1px} +table.frame-sides{border-width:0 1px} +table.frame-topbot,table.frame-ends{border-width:1px 0} +table.stripes-all tr,table.stripes-odd tr:nth-of-type(odd){background:#f8f8f7} +table.stripes-none tr,table.stripes-odd tr:nth-of-type(even){background:none} +th.halign-left,td.halign-left{text-align:left} +th.halign-right,td.halign-right{text-align:right} +th.halign-center,td.halign-center{text-align:center} +th.valign-top,td.valign-top{vertical-align:top} +th.valign-bottom,td.valign-bottom{vertical-align:bottom} +th.valign-middle,td.valign-middle{vertical-align:middle} +table thead th,table tfoot th{font-weight:bold} +tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7} +tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold} +p.tableblock>code:only-child{background:none;padding:0} +p.tableblock{font-size:1em} +td>div.verse{white-space:pre} +ol{margin-left:1.75em} +ul li ol{margin-left:1.5em} +dl dd{margin-left:1.125em} +dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} +ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} +ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none} +ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em} +ul.unstyled,ol.unstyled{margin-left:0} +ul.checklist{margin-left:.625em} +ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em} +ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em} +ul.inline{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em} +ul.inline>li{margin-left:1.25em} +.unstyled dl dt{font-weight:400;font-style:normal} +ol.arabic{list-style-type:decimal} +ol.decimal{list-style-type:decimal-leading-zero} +ol.loweralpha{list-style-type:lower-alpha} +ol.upperalpha{list-style-type:upper-alpha} +ol.lowerroman{list-style-type:lower-roman} +ol.upperroman{list-style-type:upper-roman} +ol.lowergreek{list-style-type:lower-greek} +.hdlist>table,.colist>table{border:0;background:none} +.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none} +td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em} +td.hdlist1{font-weight:bold;padding-bottom:1.25em} +.literalblock+.colist,.listingblock+.colist{margin-top:-.5em} +.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top} +.colist td:not([class]):first-child img{max-width:none} +.colist td:not([class]):last-child{padding:.25em 0} +.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd} +.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0} +.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em} +.imageblock>.title{margin-bottom:0} +.imageblock.thumb,.imageblock.th{border-width:6px} +.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em} +.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0} +.image.left{margin-right:.625em} +.image.right{margin-left:.625em} +a.image{text-decoration:none;display:inline-block} +a.image object{pointer-events:none} +sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super} +sup.footnote a,sup.footnoteref a{text-decoration:none} +sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline} +#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em} +#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0} +#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em} +#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em} +#footnotes .footnote:last-of-type{margin-bottom:0} +#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0} +.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0} +.gist .file-data>table td.line-data{width:99%} +div.unbreakable{page-break-inside:avoid} +.big{font-size:larger} +.small{font-size:smaller} +.underline{text-decoration:underline} +.overline{text-decoration:overline} +.line-through{text-decoration:line-through} +.aqua{color:#00bfbf} +.aqua-background{background-color:#00fafa} +.black{color:#000} +.black-background{background-color:#000} +.blue{color:#0000bf} +.blue-background{background-color:#0000fa} +.fuchsia{color:#bf00bf} +.fuchsia-background{background-color:#fa00fa} +.gray{color:#606060} +.gray-background{background-color:#7d7d7d} +.green{color:#006000} +.green-background{background-color:#007d00} +.lime{color:#00bf00} +.lime-background{background-color:#00fa00} +.maroon{color:#600000} +.maroon-background{background-color:#7d0000} +.navy{color:#000060} +.navy-background{background-color:#00007d} +.olive{color:#606000} +.olive-background{background-color:#7d7d00} +.purple{color:#600060} +.purple-background{background-color:#7d007d} +.red{color:#bf0000} +.red-background{background-color:#fa0000} +.silver{color:#909090} +.silver-background{background-color:#bcbcbc} +.teal{color:#006060} +.teal-background{background-color:#007d7d} +.white{color:#bfbfbf} +.white-background{background-color:#fafafa} +.yellow{color:#bfbf00} +.yellow-background{background-color:#fafa00} +span.icon>.fa{cursor:default} +a span.icon>.fa{cursor:inherit} +.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} +.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c} +.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111} +.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900} +.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400} +.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000} +.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold} +.conum[data-value] *{color:#fff!important} +.conum[data-value]+b{display:none} +.conum[data-value]::after{content:attr(data-value)} +pre .conum[data-value]{position:relative;top:-.125em} +b.conum *{color:inherit!important} +.conum:not([data-value]):empty{display:none} +dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility} +h1,h2,p,td.content,span.alt{letter-spacing:-.01em} +p strong,td.content strong,div.footnote strong{letter-spacing:-.005em} +p,blockquote,dt,td.content,span.alt{font-size:1.0625rem} +p{margin-bottom:1.25rem} +.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em} +.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc} +.print-only{display:none!important} +@page{margin:1.25cm .75cm} +@media print{*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important} +html{font-size:80%} +a{color:inherit!important;text-decoration:underline!important} +a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important} +a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em} +abbr[title]::after{content:" (" attr(title) ")"} +pre,blockquote,tr,img,object,svg{page-break-inside:avoid} +thead{display:table-header-group} +svg{max-width:100%} +p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3} +h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid} +#toc,.sidebarblock,.exampleblock>.content{background:none!important} +#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important} +body.book #header{text-align:center} +body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em} +body.book #header .details{border:0!important;display:block;padding:0!important} +body.book #header .details span:first-child{margin-left:0!important} +body.book #header .details br{display:block} +body.book #header .details br+span::before{content:none!important} +body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important} +body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always} +.listingblock code[data-lang]::before{display:block} +#footer{padding:0 .9375em} +.hide-on-print{display:none!important} +.print-only{display:block!important} +.hide-for-print{display:none!important} +.show-for-print{display:inherit!important}} +@media print,amzn-kf8{#header>h1:first-child{margin-top:1.25rem} +.sect1{padding:0!important} +.sect1+.sect1{border:0} +#footer{background:none} +#footer-text{color:rgba(0,0,0,.6);font-size:.9em}} +@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} \ No newline at end of file diff --git a/core.html b/core.html index d44a013..85c4d3e 100644 --- a/core.html +++ b/core.html @@ -1,589 +1,1247 @@ - + - - - - GTA3script Specification - - - + + + + +GTA3script Specification + + - -
-

GTA3script Specification

-
- -

Note: This is a draft. It may be wrong, incomplete and subject to change.

-

1 Introduction

+ +
  • 10.11. Require Statements + +
  • + + +
  • 11. Script File Structure + +
  • +
  • 12. Supporting Commands + +
  • +
  • 13. Supporting Command Selectors + +
  • +
  • Appendix A: Regular Lexical Grammar
  • +
  • Appendix B: Ambiguity + +
  • +
  • Appendix C: How to MISS2
  • +
  • Arachniography
  • + + + + +
    +

    1. Introduction

    +
    +

    This is an attempt to produce a formal language specification for the GTA3script language.

    +
    +

    GTA3script is an imperative, strong and statically typed scripting language built by DMA Design (now Rockstar North) to design the mission scripts in Grand Theft Auto.

    +
    +

    The 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 non-exhaustive list of differences is presented on the appendix.

    -

    2 Scope

    +
    +
    +
    +
    +

    2. Scope

    +
    +

    This document is targeted at implementation writers and perhaps curious community members.

    +
    +

    This document specifies the syntax, constraints and semantic rules of the GTA3script language.

    +
    +

    This document does not specify a runtime system nor does it specify mechanisms by which the language is transformed for use by such a system.

    -

    3 Terms and Definitions

    +
    +
    +
    +
    +

    3. Terms and Definitions

    +
    +

    behaviour

    +
    +

    external appearance or action.

    +
    +

    behaviour, implementation-defined

    +
    +

    behavior specific to an implementation, where that implementation must document that behavior.

    +
    +

    behaviour, undefined

    +
    +

    behavior which is not guaranteed to produce any specific result.

    +
    +

    behaviour, unspecified

    +
    +

    behavior for which this specification provides no requirements.

    +
    +

    constraint

    +
    +

    restriction, either syntactic or semantic, on how language elements can be used.

    +
    +

    must

    +
    +

    describes an absolute requirement of the specification. synonymous with shall.

    +
    +

    must not

    +
    +

    describes an absolute prohibition of the specification. synonymous with shall not.

    +
    +

    should

    +
    +

    describes a recommended but not absolutely necessary requirement of the specification.

    +
    +

    should not

    +
    +

    describes an unrecommended but not absolutely necessary requirement of the specifcation.

    +
    +

    may

    +
    +

    describes an optional feature or behaviour of the specification.

    +
    +

    execution environment

    +
    +

    the software on which the result of translation is executed on.

    +
    +

    translation environment

    +
    +

    the software on which the language is translated for use by an execution environment.

    +
    +

    implementation

    +
    +

    particular set of software, running in a particular translation environment under particular control options, that performs translation of programs for, and supports execution of commands in, a particular execution environment.

    +
    +

    ill-formed program

    +
    +

    program that is not well-formed. translators should produce diagnostic messages for such programs.

    +
    +

    well-formed program

    +
    +

    program constructed according to the synctatic and semantic rules as defined by this specification.

    +
    +

    value

    +
    +

    precise meaning of the contents of an name when interpreted as having a specific type.

    +
    +

    argument

    +
    +

    a value passed to a command that is intended to map to a corresponding parameter.

    +
    +

    parameter

    +
    +

    the value to be received in a specific argument position of a command.

    -

    4 Notation

    +
    +
    +
    +
    +

    4. Notation

    +
    +

    TODO

    -

    5 Concepts

    -

    5.1 Scripts

    +
    +
    +
    +
    +

    5. Concepts

    +
    +
    +

    5.1. Scripts

    +

    A script is a unit of execution which contains its own program counter, local variables and compare flag.

    +
    +

    A program is a collection of scripts running concurrently in a cooperative fashion.

    +
    +

    A variable is a named storage location. This location holds a value of specific type.

    +
    +

    There are global and local variables. Global variables are stored in a way they are accessible from any script. Local variables pertains to its particular script and is only accessible from it.

    +
    +

    The lifetime of a global variable is the same as of the execution of all scripts. The lifetime of a local variable is the same as its script and lexical scope.

    +
    +

    A command is an operation to be performed by a script. Commands produces side-effects which are described by each command description.

    +
    +

    A possible side-effect of executing a command is the updating of the compare flag. The compare flag of a command is the boolean result it produces. The compare flag of a script is the compare flag of the its last executed command. The compare flag is useful for conditionally changing the flow of control.

    +
    +

    The program counter of a script indicates its currently executing command. Unless one of the side-effects of a command is to change the program counter, the counter goes from the current command to the next sequentially. An explicit change in the program counter is said to be a change in the flow of control.

    +
    +

    A command is said to perform a jump if it changes the flow of control irreversibly.

    +
    +

    A command is said to call a subroutine if it changes the flow of control but saves the current program counter in a stack to be restored later.

    +
    +

    A command is said to terminate a script if it halts and reclaims storage of such a script.

    -

    5.2 Script Files

    -

    A script file is a source file containing a sequence of commands. Those commands are executed concurrently by multiple scripts.

    +
    +
    +
    +

    5.2. Script Files

    +
    +

    A script file is a source file containing a sequence of commands.

    +
    +

    The multi-file is a collection of script files. Hereafter being the collection of script files being translated.

    -

    The main script file is the entry script file. This is where the first script (called the main script) starts execution. Translation begins here.

    +
    +
    +

    The main script file is the entry script file. This is where the first script (called the main script) starts execution.

    +
    +

    Other script files are required to become part of the multi-file by the means of require statements within the main script file. The main script file itself is required from the translation environment.

    +
    +

    Many kinds of script files can be required.

    -

    A main extension file (or foreign gosub file) is a script file required by the means of a GOSUB_FILE statement. Other script files can be required from here as well.

    +
    +
    +

    A main extension file (or foreign gosub file) is a script file required by the means of a GOSUB_FILE statement. Other script files can be required from main extension files.

    +
    +

    A subscript file is a script file required by the means of the LAUNCH_MISSION statement. A subscript is a script started by the same statement.

    +
    +

    A mission script file is a script file required by the means of the LOAD_AND_LAUNCH_MISSION statement. A mission script is a script started by the same statement. Only a single mission script can be running at once.

    +
    +

    An implementation may contain special features regarding the way subscripts and mission scripts are executed.

    +
    +

    The main script file is found in a unspecified manner. The other script files are found by recursively searching a directory with the same filename (excluding extension) as the main script file. This directory is in the same path as the main script file. The search for the script files shall be case-insensitive. All script files must have a .sc extension. If multiple script files with the same name are found, behaviour is unspecified.

    +
    +

    A script type is said to come before another script type under the following total order:

    -
      -
    1. Main script.
    2. -
    3. Main extension script.
    4. -
    5. Subscript.
    6. -
    7. Mission script.
    8. +
    +
    +
      +
    1. +

      Main script.

      +
    2. +
    3. +

      Main extension script.

      +
    4. +
    5. +

      Subscript.

      +
    6. +
    7. +

      Mission script.

      +
    +
    +

    A script file A (first required from X) is said to come before a script file B (first required from Y) under the following total order:

    -
      -
    1. If A’s script type is not the same as B’s, then A comes before B if and only if A’s script type comes before B’s script type.
    2. -
    3. Otherwise, if X is not the same as Y, A comes before B if and only if X comes before Y.
    4. -
    5. Otherwise, A comes before B if and only if the line on which A is first required from (in X) comes before the line on which B is first required from.
    6. +
    +
    +
      +
    1. +

      If A's script type is not the same as B's, then A comes before B if and only if A's script type comes before B's script type.

      +
    2. +
    3. +

      Otherwise, if X is not the same as Y, A comes before B if and only if X comes before Y.

      +
    4. +
    5. +

      Otherwise, A comes before B if and only if the line on which A is first required from (in X) comes before the line on which B is first required from.

      +
    +
    +

    A line of code A in a script file X is said to come before a line B in a script file Y different from X if and only if X comes before Y.

    -

    5.3 Types

    -

    An integer is a binary signed two’s-complement integral number. It represents 32 bits of data and the range of values -2147483648 through 2147483647.

    +
    +
    +
    +

    5.3. Types

    +
    +

    An integer is a binary signed two’s-complement integral number. It represents 32 bits of data and the range of values -2147483648 through 2147483647.

    +
    +

    A floating-point is a representation of a real number. Its exact representation, precision and range of values is implementation-defined.

    +
    +

    A label is a name specifying the location of a command.

    +
    +

    A text label is a name whose value is only known in the execution environment.

    +
    +

    A string is a sequence of zero or more characters.

    +
    +

    An array is a collection of one or more elements of the same type. Each element is indexed by an integer key.

    -

    6 Elements

    +
    +
    +
    +
    +
    +

    6. Elements

    +
    +

    The lexical grammar of the language is context-sensitive. As such, the lexical elements and the syntactic elements are presented together.

    -

    6.1 Source Code

    +
    +
    +

    6.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).

    -
    ascii_char := ascii_printable | ascii_control ;
    +
    +
    +
    +
    ascii_char := ascii_printable | ascii_control ;
     ascii_printable := /* printable ASCII characters */ ;
    -ascii_control := '\n' | '\t' | '\r' ;
    +ascii_control := '\n' | '\t' | '\r' ; +
    +
    +

    Carriage returns should appear only before a line feed.

    +
    +

    Lowercase letters in the stream shall be interpreted as its uppercase equivalent.

    +
    +

    Space, horizontal tab, parentheses and comma are defined as whitespace characters.

    -
    whitespace := ' ' | '\t' | '(' | ')' | ',' ;
    +
    +
    +
    +
    whitespace := ' ' | '\t' | '(' | ')' | ',' ;
    +
    +
    +

    A line is a sequence of characters delimited by a newline. The start of the stream begins a line. The end of the stream finishes a line.

    -
    newline := ['\r'] `\n` ;
    +
    +
    +
    +
    newline := ['\r'] `\n` ;
    +
    +
    +

    Each line should be interpreted as if there is no whitespaces in either ends of the line.

    +
    +

    A token character is any character capable of forming a single token.

    -
    graph_char := ascii_printable - (whitespace | '"') ;
    -token_char := graph_char - ('+' | '-' | '*' | '/' | '=' | '<' | '>') ;
    +
    +
    +
    +
    graph_char := ascii_printable - (whitespace | '"') ;
    +token_char := graph_char - ('+' | '-' | '*' | '/' | '=' | '<' | '>') ;
    +
    +
    +

    To simplify future definitions, the productions eol (end of line) and sep (token separator) are defined.

    -
    sep := whitespace {whitespace} ;
    -eol := newline | EOF ;
    -

    6.2 Comments

    +
    +
    +
    +
    sep := whitespace {whitespace} ;
    +eol := newline | EOF ;
    +
    +
    +
    +
    +

    6.2. Comments

    +

    Comments serve as program documentation.

    -
    comment := line_comment | block_comment ;
    -line_comment := '//' {ascii_char} eol ;
    -block_comment := '/*' {block_comment | ascii_char} '*/' ;
    +
    +
    +
    +
    comment := line_comment | block_comment ;
    +line_comment := '//' {ascii_char} eol ;
    +block_comment := '/*' {block_comment | ascii_char} '*/' ;
    +
    +
    +

    There are two forms:

    +
    +
      -
    • Line comments starts with the character sequence // and stop at the end of the line.
    • -
    • Block comments starts with the character sequence /* and stop with its matching */. Block comments can be nested inside each other.
    • +
    • +

      Line comments starts with the character sequence // and stop at the end of the line.

      +
    • +
    • +

      Block comments starts with the character sequence /* and stop with its matching */. Block comments can be nested inside each other.

      +
    +
    +

    The contents of a comment shall be interpreted as if it is whitespaces in the source code. More specifically:

    +
    +
      -
    • A line comment should be interpreted as an eol.
    • -
    • A single, nested, block comment should be interpreted as an eol on each line boundary it crosses. On its last line (i.e. the one it does not cross), it should be interpreted as one or more whitespace characters.
    • +
    • +

      A line comment should be interpreted as an eol.

      +
    • +
    • +

      A single, nested, block comment should be interpreted as an eol on each line boundary it crosses. On its last line (i.e. the one it does not cross), it should be interpreted as one or more whitespace characters.

      +
    +
    +

    Comments cannot start inside string literals.

    -

    6.3 Commands

    +
    +
    +
    +

    6.3. Commands

    +

    A command describes an operation for a script to perform.

    -
    command_name := token_char {token_char} ;
    -command := command_name { sep argument } ;
    +
    +
    +
    +
    command_name := token_char {token_char} ;
    +command := command_name { sep argument } ;
    +
    +
    +

    There are several types of arguments.

    -
    argument := integer
    -          | floating 
    +
    +
    +
    +
    argument := integer
    +          | floating
               | identifier
    -          | string_literal ;
    -

    6.3.1 Integer Literals

    -
    digit := '0'..'9' ;
    -integer := ['-'] digit {digit} ;
    + | string_literal ; +
    +
    +
    +

    6.3.1. Integer Literals

    +
    +
    +
    digit := '0'..'9' ;
    +integer := ['-'] digit {digit} ;
    +
    +
    +

    A integer literal is a sequence of digits optionally preceded by a minus sign.

    +
    +

    If the literal begins with a minus, the number following it shall be negated.

    -

    6.3.2 Floating-Point Literals

    -
    floating_form1 := '.' digit { digit | '.' | 'F' } ;
    -floating_form2 := digit { digit } ('.' | 'F') { digit | '.' | 'F' } ;
    -floating := ['-'] (floating_form1 | floating_form2) ;
    +
    +
    +
    +

    6.3.2. Floating-Point Literals

    +
    +
    +
    floating_form1 := '.' digit { digit | '.' | 'F' } ;
    +floating_form2 := digit { digit } ('.' | 'F') { digit | '.' | 'F' } ;
    +floating := ['-'] (floating_form1 | floating_form2) ;
    +
    +
    +

    A floating-point literal is a nonempty sequence of digits which must contain at least one occurrence of the characters . or F.

    +
    +

    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.

    +
    +

    The literal can be preceded by a minus sign, which shall negate the floating-point number.

    +
    +

    The following are examples of valid and invalid literals:

    - + +
    ++++ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    LiteralSame As
    LiteralSame As
    1invalid

    1

    invalid

    -1invalid

    -1

    invalid

    1f1.0

    1f

    1.0

    1.1.0

    1.

    1.0

    .10.1

    .1

    0.1

    .1f0.1

    .1f

    0.1

    .110.11

    .11

    0.11

    .1.90.1

    .1.9

    0.1

    1.11.1

    1.1

    1.1

    1.f1.0

    1.f

    1.0

    1..1.0

    1..

    1.0

    -

    6.3.3 Identifiers

    -
    identifier := ('$' | 'A'..'Z') {token_char} ;
    +
    +
    +

    6.3.3. Identifiers

    +
    +
    +
    identifier := ('$' | 'A'..'Z') {token_char} ;
    +
    +
    +

    An identifier is a sequence of token characters beggining with a dollar or alphabetic character.

    +
    +

    Constraints

    +
    +

    An identifier shall not end with a : character.

    -

    6.3.4 String Literals

    +
    +
    +
    +

    6.3.4. String Literals

    +

    A string literal holds a string delimited by quotation marks.

    -
    string_literal := '"' { ascii_char - (newline | '"') } '"' ;
    -

    6.3.5 Variable References

    +
    +
    +
    +
    string_literal := '"' { ascii_char - (newline | '"') } '"' ;
    +
    +
    +
    +
    +

    6.3.5. Variable References

    +

    A variable name is a sequence of token characters, except the characters [ and ] cannot happen.

    -
    variable_char := token_char - ('[' | ']') ;
    -variable_name := ('$' | 'A'..'Z') {variable_char} ;
    +
    +
    +
    +
    variable_char := token_char - ('[' | ']') ;
    +variable_name := ('$' | 'A'..'Z') {variable_char} ;
    +
    +
    +

    A variable reference is a variable name optionally followed by an array subscript.

    -
    subscript := '[' (variable_name | integer) ']' ;
    -variable := variable_name [ subscript ] ;
    +
    +
    +
    +
    subscript := '[' (variable_name | integer) ']' ;
    +variable := variable_name [ subscript ] ;
    +
    +
    +

    The type of a variable reference is the type of the variable name being referenced.

    +
    +

    The subscript uses an integer literal or another variable name of integer type for zero-based indexing.

    +
    +

    The program is ill-formed if the array subscript uses a negative or out of bounds value for indexing.

    +
    +

    The program is ill-formed if a variable name is followed by a subscript but the variable is not an array.

    +
    +

    An array variable name which is not followed by a subscript behaves as if its zero-indexed element is referenced.

    -

    7 Parameters

    +
    +
    +
    +
    +
    +
    +

    7. Parameters

    +
    +

    A command receives several arguments. Every argument must obey the rules of its corresponding parameter definition.

    +
    +

    A parameter definition is a set of definitions regarding a single parameter for a specific command.

    +
    +

    A command must have the same amount of arguments as its amount of parameter definitions, unless the missing arguments correspond to optional parameters (defined below).

    +
    +

    If a variable is used in the same command both as an input and as an output, the input shall be evaluated before any output is assigned to the variable.

    -

    7.1 String Constants

    +
    +
    +

    7.1. String Constants

    +

    A string constant is a name associated with an integer value. Such association is known in the translation environment.

    +
    +

    An enumeration is a collection of string constants.

    -

    A parameter definition can have an associated enumeration. A string constant is said to be a match if an identifier in an argument refers to a name in its parameter’s enumeration.

    +
    +
    +

    A parameter definition can have an associated enumeration. A string constant is said to be a match if an identifier in an argument refers to a name in its parameter’s enumeration.

    +
    +

    There is an special enumeration called the global string constants enumeration which semantics are defined along this specification. Other enumerations can be defined by an implementation.

    +
    +

    If a parameter definition specifies an enumeration, the global string constants enumeration cannot be matched in the said parameter.

    -

    7.2 Entities

    +
    +
    +
    +

    7.2. Entities

    +

    An entity is an object of the execution environment. Each entity has an entity type, which defines its purposes.

    +
    +

    A parameter definition can have an associated entity type.

    +
    +

    An entity can be assigned to a variable. In such case, the variable is said to be of that specific entity type from that line of code on. Previous lines of code are not affected.

    +
    +

    If an entity type is associated with an parameter and a variable is used as argument, the variable must have the same entity type as the parameter.

    +
    +

    Further semantics for entities are defined along this document.

    -

    7.3 Parameter Types

    -

    7.3.1 INT

    +
    +
    +
    +

    7.3. Parameter Types

    +
    +

    7.3.1. INT

    +

    An INT parameter accepts an argument only if it is an integer literal or an identifier matching a global string constant.

    -

    7.3.2 FLOAT

    +
    +
    +
    +

    7.3.2. FLOAT

    +

    A FLOAT parameter accepts an argument only if it is a floating-point literal.

    -

    7.3.3 VAR_INT

    +
    +
    +
    +

    7.3.3. VAR_INT

    +

    A VAR_INT parameter accepts an argument only if it is an identifier referencing a global variable of integer type.

    -

    7.3.4 VAR_FLOAT

    +
    +
    +
    +

    7.3.4. VAR_FLOAT

    +

    A VAR_FLOAT parameter accepts an argument only if it is an identifier referencing a global variable of floating-point type.

    -

    7.3.5 LVAR_INT

    +
    +
    +
    +

    7.3.5. LVAR_INT

    +

    A LVAR_INT parameter accepts an argument only if it is an identifier referencing a local variable of integer type.

    -

    7.3.6 LVAR_FLOAT

    +
    +
    +
    +

    7.3.6. LVAR_FLOAT

    +

    A LVAR_FLOAT parameter accepts an argument only if it is an identifier referencing a local variable of floating-point type.

    -

    7.3.7 INPUT_INT

    +
    +
    +
    +

    7.3.7. INPUT_INT

    +

    An INPUT_INT parameter accepts an argument only if it is an integer literal or an identifier either matching a string constant, global string constant or referencing a variable of integer type (in this order).

    -

    7.3.8 INPUT_FLOAT

    +
    +
    +
    +

    7.3.8. INPUT_FLOAT

    +

    An INPUT_FLOAT parameter accepts an argument only if it is a floating-point literal or an identifier referencing a variable of floating-point type.

    -

    7.3.9 OUTPUT_INT

    +
    +
    +
    +

    7.3.9. OUTPUT_INT

    +

    An OUTPUT_INT parameter accepts an argument only if it is an identifier referencing a variable of integer type.

    -

    If an entity type is associated with the parameter, the variable must have the same entity type as the parameter, unless there is no entity type associated with the variable. In the latter case, the parameter’s entity type is assigned to the variable.

    -

    7.3.10 OUTPUT_FLOAT

    +
    +
    +

    If an entity type is associated with the parameter, the variable must have the same entity type as the parameter, unless there is no entity type associated with the variable. In the latter case, the parameter’s entity type is assigned to the variable.

    +
    +
    +
    +

    7.3.10. OUTPUT_FLOAT

    +

    An OUTPUT_FLOAT parameter accepts an argument only if it is a identifier referencing a variable of floating-point type.

    -

    7.3.11 LABEL

    +
    +
    +
    +

    7.3.11. LABEL

    +

    A LABEL parameter accepts an argument only if it is an identifier whose name is a label in the multi-file.

    -

    7.3.12 TEXT_LABEL

    +
    +
    +
    +

    7.3.12. TEXT_LABEL

    +

    A TEXT_LABEL parameter accepts an argument only if it is an identifier. If the identifier begins with a dollar character ($), its suffix must reference a variable of text label type and such a variable is the actual argument. Otherwise, the identifier is a text label.

    -

    7.3.13 VAR_TEXT_LABEL

    +
    +
    +
    +

    7.3.13. VAR_TEXT_LABEL

    +

    A VAR_TEXT_LABEL parameter accepts an argument only if it is an identifier referencing a global variable of text label type.

    -

    7.3.14 LVAR_TEXT_LABEL

    +
    +
    +
    +

    7.3.14. LVAR_TEXT_LABEL

    +

    A LVAR_TEXT_LABEL parameter accepts an argument only if it is an identifier referencing a local variable of text label type.

    -

    7.3.15 STRING

    +
    +
    +
    +

    7.3.15. STRING

    +

    A STRING parameter accepts an argument only if it is a string literal.

    -

    7.3.16 Optional Parameters

    +
    +
    +
    +

    7.3.16. Optional Parameters

    +

    Additionally, the following parameters are defined as behaving equivalently to their correspondent parameters above, except that in case an argument is absent, parameter checking stops as if there are no more parameters to be checked.

    +
    +
      -
    • VAR_INT_OPT
    • -
    • VAR_FLOAT_OPT
    • -
    • LVAR_INT_OPT
    • -
    • LVAR_FLOAT_OPT
    • -
    • VAR_TEXT_LABEL_OPT
    • -
    • LVAR_TEXT_LABEL_OPT
    • -
    • INPUT_OPT
    • +
    • +

      VAR_INT_OPT

      +
    • +
    • +

      VAR_FLOAT_OPT

      +
    • +
    • +

      LVAR_INT_OPT

      +
    • +
    • +

      LVAR_FLOAT_OPT

      +
    • +
    • +

      VAR_TEXT_LABEL_OPT

      +
    • +
    • +

      LVAR_TEXT_LABEL_OPT

      +
    • +
    • +

      INPUT_OPT

      +
    +
    +

    Such parameters are always trailing parameters.

    +
    +

    The INPUT_OPT parameter accepts an argument only if it is an integer literal, floating-point literal, or identifier referencing a variable of integer, floating-point or text label type.

    -

    8 Command Selectors

    +
    +
    +
    +
    +
    +
    +

    8. Command Selectors

    +
    +

    A command selector (or alternator) is a kind of command which gets rewritten by the translator to another command based on the supplied argument types.

    +
    +

    A command selector consists of a name and a finite sequence of commands which are alternatives for replacement.

    +
    +

    A command name which is the name of a selector shall behave as if its command name is rewritten as a matching alternative before any parameter checking takes place.

    +
    +

    A matching alternative is the first command in the alternative sequence to have the same amount of parameters as arguments in the actual command, and to obey the following rules for every argument and its corresponding parameter:

    +
    +
      -
    • An integer literal argument must have a parameter of type INT.
    • -
    • A floating-point literal argument must have a parameter of type FLOAT.
    • -
    • For identifiers, the following applies (in the given order): -
        -
      1. If the identifier matches a global string constant, the parameter type must be INT.
      2. -
      3. 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.
      4. -
      5. If the identifier references a local variable, the same rule as above applies, except by using LVAR_INT, LVAR_FLOAT and LVAR_TEXT_LABEL.
      6. -
      7. If the identifier matches any string constant in any 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’s value.
      8. -
      9. Otherwise, the parameter type must be TEXT_LABEL.
      10. -
    • +
    • +

      An integer literal argument must have a parameter of type INT.

      +
    • +
    • +

      A floating-point literal argument must have a parameter of type FLOAT.

      +
    • +
    • +

      For identifiers, the following applies (in the given order):

      +
      +
        +
      1. +

        If the identifier matches a global string constant, the parameter type must be INT.

        +
      2. +
      3. +

        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.

        +
      4. +
      5. +

        If the identifier references a local variable, the same rule as above applies, except by using LVAR_INT, LVAR_FLOAT and LVAR_TEXT_LABEL.

        +
      6. +
      7. +

        If the identifier matches any string constant in any 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’s value.

        +
      8. +
      9. +

        Otherwise, the parameter type must be TEXT_LABEL.

        +
      10. +
      +
      +
    +
    +

    If no matching alternative is found, the program is ill-formed.

    -

    9 Expressions

    +
    +
    +
    +
    +

    9. Expressions

    +
    +

    Constraints

    +
    +

    An argument in an expression cannot be a string literal.

    +
    +

    The name of commands used to require script files (e.g. GOSUB_FILE) and its directive commands (i.e. MISSION_START and MISSION_END) cannot be on the left hand side of a expression.

    -

    9.1 Assignment Expressions

    -
    binop := '+' | '-' | '*' | '/' | '+@' | '-@' ;
    -asop := '=' | '=#' | '+=' | '-=' | '*=' | '/=' | '+=@' | '-=@' ;
    -unop := '--' | '++' ;
    +
    +
    +

    9.1. Assignment Expressions

    +
    +
    +
    binop := '+' | '-' | '*' | '/' | '+@' | '-@' ;
    +asop := '=' | '=#' | '+=' | '-=' | '*=' | '/=' | '+=@' | '-=@' ;
    +unop := '--' | '++' ;
     
    -expr_assign_abs := identifier {whitespace} '=' {whitespace} 'ABS' {whitespace} argument ;
    +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) 
    +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 ;
    + | expr_assign_abs ; +
    +
    +

    The unary assignments ++a and a++ behaves as if ADD_THING_TO_THING a 1 is executed.

    -

    The unary assignments --a and a-- behaves as if SUB_THING_FROM_THING a 1 is executed.

    +
    +
    +

    The unary assignments --a and a-- behaves as if SUB_THING_FROM_THING a 1 is executed.

    +
    +

    The binary assignment expressions behaves as if the following is executed:

    - + +
    ++++ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    ExpressionBehaves As If
    ExpressionBehaves As If
    a = bSET a b

    a = b

    SET a b

    a =# bCSET a b

    a =# b

    CSET a b

    a += bADD_THING_TO_THING a b

    a += b

    ADD_THING_TO_THING a b

    a -= bSUB_THING_FROM_THING a b

    a -= b

    SUB_THING_FROM_THING a b

    a *= bMULT_THING_BY_THING a b

    a *= b

    MULT_THING_BY_THING a b

    a /= bDIV_THING_BY_THING a b

    a /= b

    DIV_THING_BY_THING a b

    a +=@ bADD_THING_TO_THING_TIMED a b

    a +=@ b

    ADD_THING_TO_THING_TIMED a b

    a -=@ bSUB_THING_FROM_THING_TIMED a b

    a -=@ b

    SUB_THING_FROM_THING_TIMED a b

    +

    The absolute assignment a = ABS b behaves as if the following is executed:

    +
    +
      -
    • ABS a if the name a is the same as the name b.
    • -
    • SET a b followed by ABS a otherwise.
    • +
    • +

      ABS a if the name a is the same as the name b.

      +
    • +
    • +

      SET a b followed by ABS a otherwise.

      +
    +
    +

    The ternary assignment a = b + c behaves as if the following is executed:

    +
    +
      -
    • ADD_THING_TO_THING a c if the name a is the same as the name b.
    • -
    • ADD_THING_TO_THING a b if the name a is the same as the name c.
    • -
    • SET a b followed by ADD_THING_TO_THING a c otherwise.
    • +
    • +

      ADD_THING_TO_THING a c if the name a is the same as the name b.

      +
    • +
    • +

      ADD_THING_TO_THING a b if the name a is the same as the name c.

      +
    • +
    • +

      SET a b followed by ADD_THING_TO_THING a c otherwise.

      +
    +
    +

    The ternary assignment a = b - c behaves as if the following is executed:

    +
    +
      -
    • SUB_THING_FROM_THING a c if the name a is the same as the name b.
    • -
    • Implementation-defined if a is the same name as c.
    • -
    • SET a b followed by SUB_THING_BY_THING a c otherwise.
    • +
    • +

      SUB_THING_FROM_THING a c if the name a is the same as the name b.

      +
    • +
    • +

      Implementation-defined if a is the same name as c.

      +
    • +
    • +

      SET a b followed by SUB_THING_BY_THING a c otherwise.

      +
    +
    +

    The ternary assignment a = b * c behaves as if a = b + c, except by using MULT_THING_BY_THING instead of ADD_THING_TO_THING.

    +
    +

    The ternary assignment a = b / c behaves as if a = b - c, except by using DIV_THING_BY_THING instead of SUB_THING_FROM_THING.

    +
    +

    The ternary assignments a = b +@ c and a = b -@ c behaves as if a = b - c, except by using ADD_THING_TO_THING_TIMED and SUB_THING_FROM_THING_TIMED, respectively, instead of SUB_THING_FROM_THING.

    -

    9.2 Conditional Expressions

    -
    relop := '=' | '<' | '>' | '>=' | '<=' ;
    -conditional_expression := argument {whitespace} relop {whitespace} argument ;
    +
    +
    +
    +

    9.2. Conditional Expressions

    +
    +
    +
    relop := '=' | '<' | '>' | '>=' | '<=' ;
    +conditional_expression := argument {whitespace} relop {whitespace} argument ;
    +
    +
    +

    These expressions behave as if the following is executed:

    - + +
    ++++ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    ExpressionBehaves As If
    ExpressionBehaves As If
    a = bIS_THING_EQUAL_TO_THING a b

    a = b

    IS_THING_EQUAL_TO_THING a b

    a > bIS_THING_GREATER_THAN_THING a b

    a > b

    IS_THING_GREATER_THAN_THING a b

    a >= bIS_THING_GREATER_OR_EQUAL_TO_THING a b

    a >= b

    IS_THING_GREATER_OR_EQUAL_TO_THING a b

    a < bIS_THING_GREATER_THAN_THING b a

    a < b

    IS_THING_GREATER_THAN_THING b a

    a <= bIS_THING_GREATER_OR_EQUAL_TO_THING b a

    a <= b

    IS_THING_GREATER_OR_EQUAL_TO_THING b a

    -

    10 Statements

    +
    +
    +
    +
    +

    10. Statements

    +
    +

    A statement specifies an action to be executed.

    -
    statement := labeled_statement 
    -           | embedded_statement ;
    -

    10.1 Labeled Statements

    +
    +
    +
    +
    statement := labeled_statement
    +           | embedded_statement ;
    +
    +
    +
    +

    10.1. Labeled Statements

    +

    Statements can be prefixed with a label.

    -
    label_def := identifier ':' ;
    +
    +
    +
    +
    label_def := identifier ':' ;
     label_prefix := label_def sep ;
     
    -labeled_statement := label_prefix embedded_statement 
    -                   | label_def empty_statement ;
    +labeled_statement := label_prefix embedded_statement + | label_def empty_statement ; +
    +
    +

    Constraints

    +
    +

    The name of a label must be unique across the multi-file.

    +
    +

    Semantics

    +
    +

    This declares a label named after the given identifier.

    +
    +

    The label can be referenced in certain commands to transfer (or start) control of execution to the statement it prefixes. Labels themselves do not alter the flow of control, which continues to the statement it embodies.

    -

    10.2 Empty Statements

    -
    empty_statement := eol ;
    +
    +
    +
    +

    10.2. Empty Statements

    +
    +
    +
    empty_statement := eol ;
    +
    +
    +

    Semantics

    +
    +

    An empty statement does nothing.

    -

    10.3 Embedded Statements

    +
    +
    +
    +

    10.3. Embedded Statements

    +

    Embedded statements are statements not prefixed by a label.

    -
    embedded_statement := empty_statement
    +
    +
    +
    +
    embedded_statement := empty_statement
                          | command_statement
                          | expression_statement
                          | scope_statement
    @@ -595,247 +1253,717 @@ 

    10.3 Emb | while_statement | whilenot_statement | repeat_statement - | require_statement ;

    -

    10.4 Command Statements

    -
    command_statement := command eol ;
    + | require_statement ; +
    +
    +
    +
    +

    10.4. Command Statements

    +
    +
    +
    command_statement := command eol ;
    +
    +
    +

    Constraints

    +
    +

    The command it embodies cannot be any of the commands specified by this section (e.g. VAR_INT, ELSE, ENDWHILE, {, GOSUB_FILE, MISSION_START, etc).

    -

    10.5 Expression Statements

    -
    expression_statement := assignment_expression eol
    -                      | conditional_expression eol ;
    +
    +
    +
    +

    10.5. Expression Statements

    +
    +
    +
    expression_statement := assignment_expression eol
    +                      | conditional_expression eol ;
    +
    +
    +

    Semantics

    +
    +

    An expression statement executes the expression it embodies.

    +
    +

    The execution of the assignment expression a = b is favored over the execution of the conditional expression of the same form.

    -

    10.6 Scope Statements

    -
    scope_statement := '{' eol
    +
    +
    +
    +

    10.6. Scope Statements

    +
    +
    +
    scope_statement := '{' eol
                        {statement}
    -                   [label_prefix] '}' eol ;
    + [label_prefix] '}' eol ; +
    +
    +

    Constraints

    +
    +

    Lexical scopes cannot be nested.

    +
    +

    Semantics

    +
    +

    The command { activates a lexical scope where local variables can be declared.

    +
    +

    The command } leaves the active lexical scope.

    +
    +

    The transfer of control to any of the statements within the scope block activates it.

    +
    +

    The execution of a jump to outside the scope block leaves the lexical scope.

    +
    +

    Performing a subroutine call does not leave the active scope. The name of local variables become hidden if the subroutine is not within the scope block. The behaviour of the program is unspecified if such a subroutine activates another lexical scope.

    +
    +

    Leaving a lexical scope causes the storage for the declared local variables to be reclaimed.

    -

    10.7 Variable Declaration Statements

    -
    command_var_name := 'VAR_INT' 
    -                    | 'LVAR_INT'
    -                    | 'VAR_FLOAT'
    -                    | 'LVAR_FLOAT' ;
    -                    | 'VAR_TEXT_LABEL'
    -                    | 'LVAR_TEXT_LABEL' ;
    +
    +
    +
    +

    10.7. Variable Declaration Statements

    +
    +
    +
    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 ;
    +var_statement := command_var_name command_var_param {command_var_param} eol ; +
    +
    +

    The name of the command is a pair of storage duration and variable type.

    +
    +

    The commands with the VAR_ prefix declares global variables. The ones with LVAR_ declares local variables. The INT suffix declares variables capable of storing integers. The FLOAT suffix declares floating-point ones. Finally, the TEXT_LABEL one declares variables capable of storing text labels.

    +
    +

    Constraints

    +
    +

    Global variable names must be unique across the multi-file.

    +
    +

    Local variables must be declared inside a lexical scope.

    +
    +

    Local variables can have identical names as long as they are in different lexical scopes.

    +
    +

    Local variables shall not have the same name as any global variable.

    +
    +

    A variable shall not have the same name as any string constant in any enumeration (except for the global enumeration).

    +
    +

    The array dimensions of the variable (if any) must be specified by an integer literal greater than zero.

    +
    +

    Semantics

    +
    +

    This command declares one or more names with the specified storage duration, type, and array dimensions.

    +
    +

    Global variable names can be seen by the entire multi-file.

    +
    +

    Local variable names can be seen by their entire lexical scope.

    +
    +

    The initial value of variables is unspecified.

    -

    10.8 Conditional Statements

    +
    +
    +
    +

    10.8. Conditional Statements

    +

    Conditional statements produce changes in the script compare flag.

    -
    conditional_element := ['NOT' sep] (command | conditional_expression) ;
    +
    +
    +
    +
    conditional_element := ['NOT' sep] (command | conditional_expression) ;
     
    -and_conditional_stmt := 'AND' sep conditional_element eol ;
    -or_conditional_stmt := 'OR' sep conditional_element eol ;
    +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}) ;
    + ({and_conditional_stmt} | {or_conditional_stmt}) ; +
    +
    +

    Constraints

    +
    +

    The command it embodies cannot be any of the commands specified by this section (e.g. VAR_INT, ELSE, ENDWHILE, {, GOSUB_FILE, MISSION_START, etc).

    +
    +

    Semantics

    +
    +

    A conditional element executes the command or expression it embodies. The execution of a command follows the same semantic rules of a command statement. The compare flag of the executed element is negated if the NOT prefix is used.

    +
    +

    A conditional list is a sequence of one or more conditional elements separated by either AND or OR tokens.

    +
    +

    The compare flag is set to true if the compare flag of all conditional elements in a AND list holds true. Otherwise it is set to false.

    +
    +

    The compare flag is set to true if the compare flag of at least one conditional elements in a OR list holds true. Otherwise it is set to false.

    +
    +

    A conditional list shall not be short-circuit evaluated. All conditional elements are executed in order.

    +
    +

    The behaviour is unspecified if the command used in a conditional element does not cause side-effects in the compare flag.

    -

    10.9 Selection Statements

    +
    +
    +
    +

    10.9. Selection Statements

    +

    Selection statements selects which statement to execute depending on certain conditions.

    -

    10.9.1 IF Statement

    -
    if_statement := 'IF' sep conditional_list
    +
    +
    +

    10.9.1. IF Statement

    +
    +
    +
    if_statement := 'IF' sep conditional_list
                     {statement}
    -                [[label_prefix] 'ELSE' eol
    +                [[label_prefix] 'ELSE' eol
                     {statement}]
    -                [label_prefix] 'ENDIF' eol ;
    + [label_prefix] 'ENDIF' eol ; +
    +
    +

    Semantics

    +
    +

    This statement executes a list of conditions, grabs its compare flag and chooses between two set of statements to execute.

    +
    +

    If the compare flag is true, control is transferred to the first set of statements. Otherwise, to the second set if an ELSE exists. Execution of the ELSE or the ENDIF command causes control to leave the IF block.

    -

    10.9.2 IFNOT Statement

    -
    ifnot_statement := 'IFNOT' sep conditional_list
    +
    +
    +
    +

    10.9.2. IFNOT Statement

    +
    +
    +
    ifnot_statement := 'IFNOT' sep conditional_list
                        {statement}
    -                   [[label_prefix] 'ELSE' eol
    +                   [[label_prefix] 'ELSE' eol
                        {statement}]
    -                   [label_prefix] 'ENDIF' eol ;
    + [label_prefix] 'ENDIF' eol ; +
    +
    +

    Semantics

    +
    +

    The behaviour of this is the same as of the IF statement, except the complement of the compare flag is used to test which set of statements to execute.

    -

    10.9.3 IF GOTO Statement

    -
    if_goto_statement := 'IF' sep conditional_element sep 'GOTO' sep identifier eol ;
    +
    +
    +
    +

    10.9.3. IF GOTO Statement

    +
    +
    +
    if_goto_statement := 'IF' sep conditional_element sep 'GOTO' sep identifier eol ;
    +
    +
    +

    Semantics

    +
    +

    This statement performs a jump to the label specified by identifier if the compare flag of the conditional element holds true. Otherwise, the flow of control is unchanged.

    -

    10.9.4 IFNOT GOTO Statement

    -
    ifnot_goto_statement := 'IFNOT' sep conditional_element sep 'GOTO' sep identifier eol ;
    +
    +
    +
    +

    10.9.4. IFNOT GOTO Statement

    +
    +
    +
    ifnot_goto_statement := 'IFNOT' sep conditional_element sep 'GOTO' sep identifier eol ;
    +
    +
    +

    Semantics

    +
    +

    The behaviour of this is the same as of the IF GOTO statement, except the complement of the compare flag is used to test whether to jump.

    -

    10.10 Iteration Statements

    -

    10.10.1 WHILE Statement

    -
    while_statement := 'WHILE' sep conditional_list
    +
    +
    +
    +
    +

    10.10. Iteration Statements

    +
    +

    10.10.1. WHILE Statement

    +
    +
    +
    while_statement := 'WHILE' sep conditional_list
                        {statement}
    -                   [label_prefix] 'ENDWHILE' eol ;
    + [label_prefix] 'ENDWHILE' eol ; +
    +
    +

    Semantics

    +
    +

    The WHILE statement executes a set of statements while the compare flag of the conditional list holds true.

    +
    +

    The statement executes by grabbing the compare flag of the list of conditions and transferring control to after the WHILE block if it holds false. Otherwise, it executes the given set of statements. Execution of the ENDWHILE command causes control to be transferred to beginning of the block, where the conditions are evaluated again.

    -

    10.10.2 WHILENOT Statement

    -
    whilenot_statement := 'WHILENOT' sep conditional_list
    +
    +
    +
    +

    10.10.2. WHILENOT Statement

    +
    +
    +
    whilenot_statement := 'WHILENOT' sep conditional_list
                           {statement}
    -                      [label_prefix] 'ENDWHILE' eol ;
    + [label_prefix] 'ENDWHILE' eol ; +
    +
    +

    Semantics

    +
    +

    The behaviour of this is the same as of the WHILE statement, except the complement of the compare flag is used to test whether to continue executing the set of statements.

    -

    10.10.3 REPEAT Statement

    -
    repeat_statement := 'REPEAT' sep integer sep identifier eol
    +
    +
    +
    +

    10.10.3. REPEAT Statement

    +
    +
    +
    repeat_statement := 'REPEAT' sep integer sep identifier eol
                         {statement}
    -                    [label_prefix] 'ENDREPEAT' eol ;
    + [label_prefix] 'ENDREPEAT' eol ; +
    +
    +

    Constraints

    +
    +

    The first argument to REPEAT must be an integer literal.

    +
    +

    The second argument must be a variable of integer type.

    +
    +

    Semantics

    +
    +

    The REPEAT statement executes a set of statements until a counter variable reaches a threshold.

    +
    +

    The REPEAT command causes the variable to be set to zero. Execution of the ENDREPEAT command causes the variable to be incremented and if it compares less than the threshold, it transfers control back to the set of statements. Otherwise, it leaves the block.

    +
    +

    The statements are always executed at least once.

    -

    10.11 Require Statements

    -
    filename := {graph_char} '.SC' ;
    +
    +
    +
    +
    +

    10.11. Require Statements

    +
    +
    +
    filename := {graph_char} '.SC' ;
     
     require_statement := command_gosub_file
                        | command_launch_mission
    -                   | command_load_and_launch_mission ;
    + | command_load_and_launch_mission ; +
    +
    +

    Require statements request script files to become part of the multi-file being translated.

    +
    +

    A file can be required more than once. If it is required using the same statement as the first request, the latter request is ignored. Otherwise, behaviour is unspecified.

    +
    +

    Constraints

    +
    +

    Require statements shall only appear in the main script file or main extension files.

    -

    10.11.1 GOSUB_FILE Statement

    -
    command_gosub_file := 'GOSUB_FILE' sep identifier sep filename eol ;
    +
    +
    +

    10.11.1. GOSUB_FILE Statement

    +
    +
    +
    command_gosub_file := 'GOSUB_FILE' sep identifier sep filename eol ;
    +
    +
    +

    Semantics

    +
    +

    The GOSUB_FILE command requires a main extension file to become part of the multi-file.

    +
    +

    It also calls the subroutine specified by label.

    +
    +

    The behaviour is unspecified if the label is not part of the required file.

    -

    10.11.2 LAUNCH_MISSION Statement

    -
    command_launch_mission := 'LAUNCH_MISSION' sep filename eol ;
    +
    +
    +
    +

    10.11.2. LAUNCH_MISSION Statement

    +
    +
    +
    command_launch_mission := 'LAUNCH_MISSION' sep filename eol ;
    +
    +
    +

    Semantics

    +
    +

    The LAUNCH_MISSION command requires a subscript file to become part of the multi-file.

    +
    +

    It also starts a new subscript with the program counter at the MISSION_START directive of the specified script file.

    -

    10.11.3 LOAD_AND_LAUNCH_MISSION Statement

    -
    command_load_and_launch_mission := 'LOAD_AND_LAUNCH_MISSION' sep filename eol ;
    +
    +
    +
    +

    10.11.3. LOAD_AND_LAUNCH_MISSION Statement

    +
    +
    +
    command_load_and_launch_mission := 'LOAD_AND_LAUNCH_MISSION' sep filename eol ;
    +
    +
    +

    Constraints

    +
    +

    Only a single mission script can be running at once.

    +
    +

    Semantics

    +
    +

    The LOAD_AND_LAUNCH_MISSION command requires a mission script file to become part of the multi-file.

    +
    +

    It also starts a new mission script with the program counter at the MISSION_START directive of the specified script file.

    -

    11 Script File Structure

    -

    11.1 Main Script Files

    -
    main_script_file := {statement} ;
    +
    +
    +
    +
    +
    +
    +

    11. Script File Structure

    +
    +
    +

    11.1. Main Script Files

    +
    +
    +
    main_script_file := {statement} ;
    +
    +
    +

    A main script file is a sequence of zero or more statements.

    +
    +

    Semantics

    +
    +

    The main script starts execution at the first statement of the main script file. If there is no statement to be executed, behaviour is unspecified.

    +
    +

    Constraints

    +
    +

    Commands in the main script file shall not refer to labels in mission script files.

    -

    11.2 Main Extension Files

    -
    main_extension_file := {statement} ;
    +
    +
    +
    +

    11.2. Main Extension Files

    +
    +
    +
    main_extension_file := {statement} ;
    +
    +
    +

    A main extension file is a sequence of zero or more statements.

    +
    +

    Constraints

    +
    +

    Commands in main extension files shall not refer to labels in mission script files.

    -

    11.3 Subscript Files

    -
    subscript_file := 'MISSION_START' eol
    +
    +
    +
    +

    11.3. Subscript Files

    +
    +
    +
    subscript_file := 'MISSION_START' eol
                       {statement}
    -                  [label_prefix] 'MISSION_END' eol
    -                  {statement} ;
    + [label_prefix] 'MISSION_END' eol + {statement} ; +
    +
    +

    A subscript file is a sequence of zero or more statements in a MISSION_START and MISSION_END block. More statements can follow.

    +
    +

    Constraints

    -

    The MISSION_START command shall be the very first line of the subscript file and shall not be preceded by anything but ASCII spaces () and horizontal tabs (\t). Even comments are disallowed.

    +
    +
    +

    The MISSION_START command shall be the very first line of the subscript file and shall not be preceded by anything but ASCII spaces ( ) and horizontal tabs (\t). Even comments are disallowed.

    +
    +

    Commands in subscript files shall not refer to labels in mission script files.

    +
    +

    Semantics

    +
    +

    The MISSION_END command behaves as if by executing the TERMINATE_THIS_SCRIPT command.

    -

    11.4 Mission Script Files

    -
    mission_script_file := subscript_file ;
    +
    +
    +
    +

    11.4. Mission Script Files

    +
    +
    +
    mission_script_file := subscript_file ;
    +
    +
    +

    A mission script file has the same structure of a subscript file.

    +
    +

    Constraints

    +
    +

    Commands in mission script files shall not refer to labels in mission script files other than itself.

    -

    12 Supporting Commands

    +
    +
    +
    +
    +
    +

    12. Supporting Commands

    +
    +

    In order to perform useful computation the following supporting commands may be available.

    -

    12.1 WAIT

    +
    +
    +

    12.1. WAIT

    +

    Parameters

    -
    WAIT INPUT_INT
    +
    +
    +
    +
    WAIT INPUT_INT
    +
    +
    +

    Side-effects

    +
    +

    Yields control to another script. The current script is not resumed for at least the specified number of milliseconds.

    +
    +

    This command is useful due to the cooperative multitasking nature of the execution environment.

    -

    12.2 GOTO

    +
    +
    +
    +

    12.2. GOTO

    +

    Parameters

    -
    GOTO LABEL
    +
    +
    +
    +
    GOTO LABEL
    +
    +
    +

    Side-effects

    +
    +

    Performs a jump to the specified location.

    -

    12.3 GOSUB

    +
    +
    +
    +

    12.3. GOSUB

    +

    Parameters

    -
    GOSUB LABEL
    +
    +
    +
    +
    GOSUB LABEL
    +
    +
    +

    Side-effects

    +
    +

    Calls the subroutine in the specified location.

    -

    12.4 RETURN

    +
    +
    +
    +

    12.4. RETURN

    +

    Parameters

    -
    RETURN
    +
    +
    +
    +
    RETURN
    +
    +
    +

    Side-effects

    +
    +

    Returns from the last called subroutine.

    +
    +

    The behaviour is undefined if there is no active subroutine.

    -

    12.5 RETURN_TRUE

    +
    +
    +
    +

    12.5. RETURN_TRUE

    +

    Parameters

    -
    RETURN_TRUE
    +
    +
    +
    +
    RETURN_TRUE
    +
    +
    +

    Side-effects

    +
    +

    Returns true (as in any command updating the compare flag to true).

    -

    12.6 RETURN_FALSE

    +
    +
    +
    +

    12.6. RETURN_FALSE

    +

    Parameters

    -
    RETURN_FALSE
    +
    +
    +
    +
    RETURN_FALSE
    +
    +
    +

    Side-effects

    +
    +

    Returns false (as in any command updating the compare flag to false).

    -

    12.7 SCRIPT_NAME

    +
    +
    +
    +

    12.7. SCRIPT_NAME

    +

    Parameters

    -
    SCRIPT_NAME TEXT_LABEL
    +
    +
    +
    +
    SCRIPT_NAME TEXT_LABEL
    +
    +
    +

    Side-effects

    +
    +

    Associates a name to the executing script.

    +
    +

    Constraints

    +
    +

    The translation environment must enforce the following constraints.

    +
    +

    The name of a script must be unique across the multi-file.

    +
    +

    The behaviour of the translation is unspecified if the name is given by a text label variable.

    -

    12.8 TERMINATE_THIS_SCRIPT

    +
    +
    +
    +

    12.8. TERMINATE_THIS_SCRIPT

    +

    Parameters

    -
    TERMINATE_THIS_SCRIPT
    +
    +
    +
    +
    TERMINATE_THIS_SCRIPT
    +
    +
    +

    Side-effects

    +
    +

    Terminates the executing script.

    -

    12.9 START_NEW_SCRIPT

    +
    +
    +
    +

    12.9. START_NEW_SCRIPT

    +

    Parameters

    -
    START_NEW_SCRIPT LABEL INPUT_OPT...
    +
    +
    +
    +
    START_NEW_SCRIPT LABEL INPUT_OPT...
    +
    +
    +

    Side-effects

    +
    +

    Creates a script and sets its program counter to the specified label location.

    +
    +

    The first few local variables at the scope of the target label are assigned the values of the optional input arguments. That is, the first declared local variable is set to the first optional argument, the second variable to the second optional argument, and so on.

    +
    +

    Constraints

    +
    +

    The translation environment must enforce the following constraints.

    +
    +

    The specified label location must be within a scope.

    +
    +

    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.

    +
    +

    If there are not enough local variables in the target scope to accomodate the input arguments the program is ill-formed.

    +
    +

    If an input argument is a variable, the value assignment to the variable in the target scope shall obey the same constraints as specified in the SET alternator.

    -

    13 Supporting Command Selectors

    +
    +
    +
    +
    +
    +

    13. Supporting Command Selectors

    +
    +

    To further enchance the set of minimal commands for useful computation, the following command selectors and its supportive alternatives are defined.

    +
    +

    An implementation is required to support these selectors, but it may not support all of its alternatives.

    -

    13.1 SET

    +
    +
    +

    13.1. SET

    +

    Alternatives

    -
    SET_VAR_INT VAR_INT INT
    +
    +
    +
    +
    SET_VAR_INT VAR_INT INT
     SET_VAR_FLOAT VAR_FLOAT INT
     SET_LVAR_INT LVAR_INT INT
     SET_LVAR_FLOAT LVAR_FLOAT FLOAT
    @@ -850,27 +1978,57 @@ 

    13.1 SET

    SET_VAR_INT_TO_CONSTANT VAR_INT INPUT_INT SET_LVAR_INT_TO_CONSTANT VAR_INT INPUT_INT SET_VAR_TEXT_LABEL VAR_TEXT_LABEL TEXT_LABEL -SET_LVAR_TEXT_LABEL LVAR_TEXT_LABEL TEXT_LABEL
    +SET_LVAR_TEXT_LABEL LVAR_TEXT_LABEL TEXT_LABEL +
    +
    +

    Side-effects

    +
    +

    Sets the variable on the left to the value on the right.

    +
    +

    Constraints

    +
    +

    The translation environment must enforce the following constraints.

    +
    +

    A variable cannot be assigned to another variable of different entity type. If the right variable has no entity type but the left one does, the program is ill-formed. If the left variable has no entity type, the entity type of the right variable is assigned to it.

    -

    13.2 CSET

    +
    +
    +
    +

    13.2. CSET

    +

    Alternatives

    -
    CSET_VAR_INT_TO_VAR_FLOAT VAR_INT VAR_FLOAT
    -CSET_VAR_FLOAT_TO_VAR_INT VAR_FLOAT VAR_INT 
    -CSET_LVAR_INT_TO_VAR_FLOAT LVAR_INT VAR_FLOAT 
    -CSET_LVAR_FLOAT_TO_VAR_INT LVAR_FLOAT VAR_INT 
    -CSET_VAR_INT_TO_LVAR_FLOAT VAR_INT LVAR_FLOAT 
    -CSET_VAR_FLOAT_TO_LVAR_INT VAR_FLOAT LVAR_INT 
    -CSET_LVAR_INT_TO_LVAR_FLOAT LVAR_INT LVAR_FLOAT 
    -CSET_LVAR_FLOAT_TO_LVAR_INT LVAR_FLOAT LVAR_INT 
    +
    +
    +
    +
    CSET_VAR_INT_TO_VAR_FLOAT VAR_INT VAR_FLOAT
    +CSET_VAR_FLOAT_TO_VAR_INT VAR_FLOAT VAR_INT
    +CSET_LVAR_INT_TO_VAR_FLOAT LVAR_INT VAR_FLOAT
    +CSET_LVAR_FLOAT_TO_VAR_INT LVAR_FLOAT VAR_INT
    +CSET_VAR_INT_TO_LVAR_FLOAT VAR_INT LVAR_FLOAT
    +CSET_VAR_FLOAT_TO_LVAR_INT VAR_FLOAT LVAR_INT
    +CSET_LVAR_INT_TO_LVAR_FLOAT LVAR_INT LVAR_FLOAT
    +CSET_LVAR_FLOAT_TO_LVAR_INT LVAR_FLOAT LVAR_INT
    +
    +
    +

    Side-effects

    +
    +

    Sets the variable on the left to the value of the variable on the right converted to the left type.

    -

    13.3 ADD_THING_TO_THING

    +
    +
    +
    +

    13.3. ADD_THING_TO_THING

    +

    Alternatives

    -
    ADD_VAL_TO_INT_VAR VAR_INT INT
    +
    +
    +
    +
    ADD_VAL_TO_INT_VAR VAR_INT INT
     ADD_VAL_TO_FLOAT_VAR VAR_FLOAT FLOAT
     ADD_VAL_TO_INT_LVAR LVAR_INT INT
     ADD_VAL_TO_FLOAT_LVAR LVAR_FLOAT FLOAT
    @@ -881,12 +2039,24 @@ 

    13.3 ADD_ ADD_INT_VAR_TO_INT_LVAR LVAR_INT VAR_INT ADD_FLOAT_VAR_TO_FLOAT_LVAR LVAR_FLOAT VAR_FLOAT ADD_INT_LVAR_TO_INT_VAR VAR_INT LVAR_INT -ADD_FLOAT_LVAR_TO_FLOAT_VAR VAR_FLOAT LVAR_FLOAT

    +ADD_FLOAT_LVAR_TO_FLOAT_VAR VAR_FLOAT LVAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Adds the value on the right to the variable on the left.

    -

    13.4 SUB_THING_FROM_THING

    +
    +
    +
    +

    13.4. SUB_THING_FROM_THING

    +

    Alternatives

    -
    SUB_VAL_FROM_INT_VAR VAR_INT INT
    +
    +
    +
    +
    SUB_VAL_FROM_INT_VAR VAR_INT INT
     SUB_VAL_FROM_FLOAT_VAR VAR_FLOAT FLOAT
     SUB_VAL_FROM_INT_LVAR LVAR_INT INT
     SUB_VAL_FROM_FLOAT_LVAR LVAR_FLOAT FLOAT
    @@ -897,12 +2067,24 @@ 

    13.4 SU SUB_INT_VAR_FROM_INT_LVAR LVAR_INT VAR_INT SUB_FLOAT_VAR_FROM_FLOAT_LVAR LVAR_FLOAT VAR_FLOAT SUB_INT_LVAR_FROM_INT_VAR VAR_INT LVAR_INT -SUB_FLOAT_LVAR_FROM_FLOAT_VAR VAR_FLOAT LVAR_FLOAT

    +SUB_FLOAT_LVAR_FROM_FLOAT_VAR VAR_FLOAT LVAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Substracts the value on the right from the variable on the left.

    -

    13.5 MULT_THING_BY_THING

    +
    +
    +
    +

    13.5. MULT_THING_BY_THING

    +

    Alternatives

    -
    MULT_INT_VAR_BY_VAL VAR_INT INT
    +
    +
    +
    +
    MULT_INT_VAR_BY_VAL VAR_INT INT
     MULT_FLOAT_VAR_BY_VAL VAR_FLOAT FLOAT
     MULT_INT_LVAR_BY_VAL LVAR_INT INT
     MULT_FLOAT_LVAR_BY_VAL LVAR_FLOAT FLOAT
    @@ -913,12 +2095,24 @@ 

    13.5 MUL MULT_INT_VAR_BY_INT_LVAR VAR_INT LVAR_INT MULT_FLOAT_VAR_BY_FLOAT_LVAR VAR_FLOAT LVAR_FLOAT MULT_INT_LVAR_BY_INT_VAR LVAR_INT VAR_INT -MULT_FLOAT_LVAR_BY_FLOAT_VAR LVAR_FLOAT VAR_FLOAT

    +MULT_FLOAT_LVAR_BY_FLOAT_VAR LVAR_FLOAT VAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Multiplites the variable on the left by the value on the right.

    -

    13.6 DIV_THING_BY_THING

    +
    +
    +
    +

    13.6. DIV_THING_BY_THING

    +

    Alternatives

    -
    DIV_INT_VAR_BY_VAL VAR_INT INT
    +
    +
    +
    +
    DIV_INT_VAR_BY_VAL VAR_INT INT
     DIV_FLOAT_VAR_BY_VAL VAR_FLOAT FLOAT
     DIV_INT_LVAR_BY_VAL LVAR_INT INT
     DIV_FLOAT_LVAR_BY_VAL LVAR_FLOAT FLOAT
    @@ -929,40 +2123,88 @@ 

    13.6 DIV_ DIV_INT_VAR_BY_INT_LVAR VAR_INT LVAR_INT DIV_FLOAT_VAR_BY_FLOAT_LVAR VAR_FLOAT LVAR_FLOAT DIV_INT_LVAR_BY_INT_VAR LVAR_INT VAR_INT -DIV_FLOAT_LVAR_BY_FLOAT_VAR LVAR_FLOAT VAR_FLOAT

    +DIV_FLOAT_LVAR_BY_FLOAT_VAR LVAR_FLOAT VAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Divides the variable on the left by the value on the right.

    -

    13.7 ABS

    +
    +
    +
    +

    13.7. ABS

    +

    Alternatives

    -
    ABS_VAR_INT VAR_INT
    +
    +
    +
    +
    ABS_VAR_INT VAR_INT
     ABS_LVAR_INT LVAR_INT
     ABS_VAR_FLOAT VAR_FLOAT
    -ABS_LVAR_FLOAT LVAR_FLOAT
    +ABS_LVAR_FLOAT LVAR_FLOAT +
    +
    +

    Side-effects

    -

    Computes the absolute value of a variable’s value and store the result in the same variable.

    -

    13.8 ADD_THING_TO_THING_TIMED

    +
    +
    +

    Computes the absolute value of a variable’s value and store the result in the same variable.

    +
    +
    +
    +

    13.8. ADD_THING_TO_THING_TIMED

    +

    Alternatives

    -
    ADD_TIMED_VAL_TO_FLOAT_VAR VAR_FLOAT FLOAT
    +
    +
    +
    +
    ADD_TIMED_VAL_TO_FLOAT_VAR VAR_FLOAT FLOAT
     ADD_TIMED_VAL_TO_FLOAT_LVAR LVAR_FLOAT FLOAT
     ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR VAR_FLOAT VAR_FLOAT
     ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR LVAR_FLOAT LVAR_FLOAT
     ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR VAR_FLOAT LVAR_FLOAT
    -ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR LVAR_FLOAT VAR_FLOAT
    +ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR LVAR_FLOAT VAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Adds the value on the right multipled by the frame delta time to the variable on the left.

    -

    13.9 SUB_THING_FROM_THING_TIMED

    +
    +
    +
    +

    13.9. SUB_THING_FROM_THING_TIMED

    +

    Alternatives

    -
    SUB_TIMED_VAL_FROM_FLOAT_VAR VAR_FLOAT FLOAT
    +
    +
    +
    +
    SUB_TIMED_VAL_FROM_FLOAT_VAR VAR_FLOAT FLOAT
     SUB_TIMED_VAL_FROM_FLOAT_LVAR LVAR_FLOAT FLOAT
     SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR VAR_FLOAT VAR_FLOAT
     SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR LVAR_FLOAT LVAR_FLOAT
     SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR VAR_FLOAT LVAR_FLOAT
    -SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR LVAR_FLOAT VAR_FLOAT
    +SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR LVAR_FLOAT VAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Substracts the value on the right multipled by the frame delta time from the variable on the left.

    -

    13.10 IS_THING_EQUAL_TO_THING

    +
    +
    +
    +

    13.10. IS_THING_EQUAL_TO_THING

    +

    Alternatives

    -
    IS_INT_VAR_EQUAL_TO_NUMBER VAR_INT INT
    +
    +
    +
    +
    IS_INT_VAR_EQUAL_TO_NUMBER VAR_INT INT
     IS_INT_LVAR_EQUAL_TO_NUMBER LVAR_INT INT
     IS_INT_VAR_EQUAL_TO_INT_VAR VAR_INT VAR_INT
     IS_INT_LVAR_EQUAL_TO_INT_LVAR LVAR_INT LVAR_INT
    @@ -977,12 +2219,24 @@ 

    13.10

    +IS_FLOAT_LVAR_EQUAL_TO_FLOAT_VAR LVAR_FLOAT VAR_FLOAT +
    +
    +

    Side-effects

    +
    +

    Returns whether the value on the left is equal the value on the right.

    -

    13.11 IS_THING_GREATER_THAN_THING

    +
    +
    +
    +

    13.11. IS_THING_GREATER_THAN_THING

    +

    Alternatives

    -
    IS_INT_VAR_GREATER_THAN_NUMBER VAR_INT INT
    +
    +
    +
    +
    IS_INT_VAR_GREATER_THAN_NUMBER VAR_INT INT
     IS_INT_LVAR_GREATER_THAN_NUMBER LVAR_INT INT
     IS_NUMBER_GREATER_THAN_INT_VAR INT VAR_INT
     IS_NUMBER_GREATER_THAN_INT_LVAR INT LVAR_INT
    @@ -1001,12 +2255,24 @@ 

    13.11

    +IS_CONSTANT_GREATER_THAN_INT_LVAR INPUT_INT LVAR_INT +
    +
    +

    Side-effects

    +
    +

    Returns whether the value on the left is greater than the value on the right.

    -

    13.12 IS_THING_GREATER_OR_EQUAL_TO_THING

    +
    +
    +
    +

    13.12. IS_THING_GREATER_OR_EQUAL_TO_THING

    +

    Alternatives

    -
    IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER VAR_INT INT
    +
    +
    +
    +
    IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER VAR_INT INT
     IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER LVAR_INT INT
     IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR INT VAR_INT
     IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR INT LVAR_INT
    @@ -1025,39 +2291,65 @@ 

    IS_INT_VAR_GREATER_OR_EQUAL_TO_CONSTANT VAR_INT INPUT_INT IS_INT_LVAR_GREATER_OR_EQUAL_TO_CONSTANT LVAR_INT INPUT_INT IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_VAR INPUT_INT VAR_INT -IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR INPUT_INT LVAR_INT

    +IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR INPUT_INT LVAR_INT +
    +
    +

    Side-effects

    +
    +

    Returns whether the value on the left is greater than or equal to the value on the right.

    -

    14 Appendix

    -

    14.1 Regular Lexical Grammar

    -
    # A Regular Lexical Grammar for GTA3script
    +
    +
    +
    +
    +
    +

    Appendix A: Regular Lexical Grammar

    +
    +
    +
    +
    # A Regular Lexical Grammar for GTA3script
     sep := sep ;
     eol := eol ;
    -token := token_char {token_char} 
    -       | '-' (digit | '.') {token_char} ;
    +token := token_char {token_char}
    +       | '-' (digit | '.') {token_char} ;
     string_literal := string_literal ;
    -plus := '+' ;
    -minus := '-' ;
    -star := '*' ;
    -slash := '/' ;
    -plus_at := '+@' ;
    -minus_at := '-@' ;
    -equal := '=' ;
    -equal_hash := '=#' ;
    -plus_equal := '+=' ;
    -minus_equal := '-=' ;
    -star_equal := '*=' ; 
    -slash_equal := '/=' ;
    -plus_equal_at := '+=@' ;
    -minus_equal_at := '-=@' ;
    -minus_minus := '--' ;
    -plus_plus := '++' ;
    +plus := '+' ; +minus := '-' ; +star := '*' ; +slash := '/' ; +plus_at := '+@' ; +minus_at := '-@' ; +equal := '=' ; +equal_hash := '=#' ; +plus_equal := '+=' ; +minus_equal := '-=' ; +star_equal := '*=' ; +slash_equal := '/=' ; +plus_equal_at := '+=@' ; +minus_equal_at := '-=@' ; +minus_minus := '--' ; +plus_plus := '++' ; +
    +
    +

    There are only operators, separators, unclassified tokens, and string literals.

    +
    +

    Each unclassified token requires parsing context in order to be classified.

    +
    +

    Comments are excluded from this grammar because nested block comments are context-free.

    +
    +

    This regular grammar is not capable of handling the complete set of words generated by filename. For instance, file-name.sc would not be interpreted properly. A translator should be careful to handle this case properly.

    +
    +

    The following are examples of context dependency for token classification:

    -
    // for the sake of simplicity separation tokens are omitted.
    +
    +
    +
    +
    // for the sake of simplicity separation tokens are omitted.
     
     WORD: WORD:    // label(WORD:) command(WORD:)
     
    @@ -1065,10 +2357,10 @@ 

    14.1 1234 1234 // command(1234) integer(1234) -X = Y // identifier(X) '=' identifier(Y) +X = Y // identifier(X) '=' identifier(Y) X Y // command(X) identifier(Y) -X -- // identifier(X) '--' +X -- // identifier(X) '--' X -1 // command(X) integer(-1) LAUNCH_MISSION a.sc // command(LAUNCH_MISSION) filename(a.sc) @@ -1079,64 +2371,144 @@

    14.1 OR // command(OR) NOT // command(NOT) IF SOMETHING // -OR OR // 'OR' command(OR) -OR NOT NOT // 'OR' 'NOT' command(NOT) +OR OR // 'OR' command(OR) +OR NOT NOT // 'OR' 'NOT' command(NOT) NOP // ENDIF // // NOTE: that is a defect actually, see following example: IF SOMETHING - AND var // 'AND' command(var) -- not what we want + AND var // 'AND' command(var) -- not what we want // same problem for OR. // NOT is affected by IF NOT var. -ENDIF

    -

    14.2 Ambiguity

    +ENDIF +
    +
    +
    +
    +
    +

    Appendix B: 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.

    -

    14.2.1 IF GOTO

    -
    IF COMMAND goto other
    -COMMAND goto other
    +
    +
    +

    B.1. IF GOTO

    +
    +
    +
    IF COMMAND goto other
    +COMMAND goto other
    +
    +
    +

    The first line could mean an command, taking two arguments, goto and other. Or, it could mean that if the command returns true, a jump should be performed into the other label. The correct interpretation is the latter.

    +
    +

    The second line is unambiguous due to context.

    +
    +

    We suggest an implementation to emit an warnings to declarations of names and the use of text labels equal to goto.

    -

    14.2.2 Ternary Minus One

    -
    x = 1-1
    +
    +
    +
    +

    B.2. Ternary Minus One

    +
    +
    +
    x = 1-1
     x = 1 -1
     x = 1 - 1
     x = 1--1
    -x = 1- -1
    +x = 1- -1 +
    +
    +

    The first line could mean 1 minus 1, or it could mean 1 and then the number -1. The latter is the correct interpretation. And yes, it is a syntax error.

    +
    +

    The second line has the same ambiguity and its interpretation should be the same as the first line.

    +
    +

    The third line is not ambiguous.

    +
    +

    The fourth line is ambiguous. Its actual meaning is 1 followed by the unary operator -- and it is a syntax error.

    +
    +

    The fifth line is not ambiguous.

    +
    +

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

    -

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

    +
    +
    +
    +
    +
    +

    Appendix C: 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.

    +
    +

    Do note a regular lexical grammar (like above) cannot be built for the language recognized by miss2.

    +
    +

    Unrestricted character set

    +
    +

    More control codes than the specified are accepted by miss2 (such as \r anywhere or \v). The compiler behaves in weird ways when those are used.

    +
    +

    You may use custom characters (c > 127), but you may clash with the characters DMA used to tokenize string literals.

    +
    +

    A string literal is the same as four tokens

    -
    SAVE_STRING_TO_DEBUG_FILE "OO AR AZ WERTY"
    +
    +
    +
    +
    SAVE_STRING_TO_DEBUG_FILE "OO AR AZ WERTY"
     SAVE_STRING_TO_DEBUG_FILE FOO BAR BAZ QWERTY
     // both are recognized by miss2 and produce the same bytecode
    -// this specification only accepts the string literal one
    +// this specification only accepts the string literal one +
    +
    +

    A string literal ends a line

    +
    +

    As part of transforming a string literal into tokens, miss2 puts a null terminator in the line. Thus, any argument following it is kinda of ignored.

    -
    SAVE_STRING_TO_DEBUG_FILE "this is a string" and this is ignored
    -// this specification does not accept this
    +
    +
    +
    +
    SAVE_STRING_TO_DEBUG_FILE "this is a string" and this is ignored
    +// this specification does not accept this
    +
    +
    +

    Accepts internal compiler commands

    +
    +

    Remove the constraint that commands that conflict with grammar definitions cannot be used in a command_statement and you get atrocities like:

    -
    IF { // does not begin a lexical scope
    +
    +
    +
    +
    IF { // does not begin a lexical scope
     ENDIF
     
    -IF WHILE 0 // it's like an ANDOR within an ANDOR
    +IF WHILE 0 // it's like an ANDOR within an ANDOR
     ENDIF
     
    -// there is probably a lot more of these
    +// there is probably a lot more of these +
    +
    +

    WHILENOT is incomplete

    +
    +

    WHILENOT only accepts equality comparison

    -
    WHILENOT x = 1
    +
    +
    +
    +
    WHILENOT x = 1
     ENDWHILE
     
     WHILENOT x < 1 // not recognized
    @@ -1144,9 +2516,15 @@ 

    14.3 How to MIS // since we accept the above, we are not a subset anymore. // to fix this (and become a subset again) only allow equality -// on WHILENOT.

    +// on WHILENOT. +
    +
    +

    AND/OR behaves differently than IF/WHILE/expressions

    -
    WHILENOT x < 1 // not recognized
    +
    +
    +
    +
    WHILENOT x < 1 // not recognized
     AND x < 1      // recognized
     ENDWHILE
     // this specification accepts both
    @@ -1157,82 +2535,210 @@ 

    14.3 How to MIS WHILE WAIT-1 // the command WAIT with a -1 argument AND WAIT-1 // a command named WAIT-1 -// this specification accepts neither

    +// this specification accepts neither +
    +
    +

    INT tokens allow minus in the middle

    -
    WAIT 1-1
    +
    +
    +
    +
    WAIT 1-1
     WAIT 1-
    -// this specification does not accept this
    +// this specification does not accept this +
    +
    +

    Commands may have operator characters

    -
    --b   // recognized as '--' identifier(b)
    +
    +
    +
    +
    --b   // recognized as '--' identifier(b)
     --b b // recognized as command(--b) identifier(b)
     // this makes the lexer context sensitive
     // but this spec disallow the later form based
     // on the belief the IF/WHILE/expressions parser
    -// is the correct one (details above).
    +// is the correct one (details above). +
    +
    +

    anything may follow MISSION_START

    -
    MISSION_START anythin"may follow" this thing
    -MISSION_END the same "happens"with mission_end
    -// this specification does not accept this
    +
    +
    +
    +
    MISSION_START anythin"may follow" this thing
    +MISSION_END the same "happens"with mission_end
    +// this specification does not accept this
    +
    +
    +

    labels may contain any printable character (except quotation marks)

    -
    e-=1:                  // recognized (we don't accept this)
    +
    +
    +
    +
    e-=1:                  // recognized (we don't accept this)
     GOTO e-=1              // not recognized
    -LAUNCH_MISSION e/=.sc  // recognized (we don't accept this)
    +LAUNCH_MISSION e/=.sc // recognized (we don't accept this) +
    +
    +

    label may be empty or not match identifier

    +
    +

    The name of a label may be empty. The name of a label may contain characters that do not match the identifier production.

    -
    :     // recognized
    +
    +
    +
    +
    :     // recognized
     ::::  // recognized
     @abc: // recognized
    -// this specification does not accept this
    +// this specification does not accept this +
    +
    +

    non-identifiers on the lhs of assignment expressions

    -

    Some expressions implement this correctly in miss2, some don’t.

    -
    1 = ABS 2 // recognized
    +
    +
    +

    Some expressions implement this correctly in miss2, some don’t.

    +
    +
    +
    +
    1 = ABS 2 // recognized
     --1       // recognized for every unary expression
     1 = 2 * 3 // recognized for every ternary expression
     1 = 2     // recognized
     1 =# 2    // recognized
     1 *= 2    // not recognized for every other binary expression
    -// this specification does not accept any of this
    +// this specification does not accept any of this +
    +
    +

    labels in AND/OR

    +
    +

    miss2 allows labels to prefix AND/OR conditions. However, it produces weird code. As such, this specification does not accept it.

    -
    IF x = 0
    +
    +
    +
    +
    IF x = 0
     lab_or: OR x = 1 // goes to the WAIT 0 after the last condition
     OR x = 2         // this specification does not accept this
         WAIT 1
     ELSE
         WAIT 2
    -ENDIF
    +ENDIF +
    +
    +

    weird closing blocks

    +
    +

    stuff like the following is recognized by miss2

    -
    WHILE x = 0
    +
    +
    +
    +
    WHILE x = 0
         IF y = 1
             WAIT 0
     ENDWHILE
         ENDIF
    -// this specification does not accept this (nor variations of this)
    +// this specification does not accept this (nor variations of this) +
    +
    +

    this happens with scopes, IFs, REPEATs, WHILEs, MISSION_END, and what not.

    +
    +

    it is very interesting actually, but clearly a language bug (would not say a implementation bug though).

    +
    +

    exclusive scripts

    -

    we don’t really what are these, so we won’t specify them.

    +
    +
    +

    we don’t really what are these, so we won’t specify them.

    +
    +

    entities

    -
    VAR_INT vcar
    +
    +
    +
    +
    VAR_INT vcar
     COMMAND_INPUT_CAR_OUTPUT_CAR vcar vcar
     // this spec gives an error, miss2 recognizes (does not look like intended behaviour?)
    -// [...] we are not a subset anymore because of this.
    +// [...] we are not a subset anymore because of this. +
    +
    +

    arrays

    -
    WAIT arr[0]anything // recognized
    -// this specification does not accept this
    -

    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 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) TODO timera timerb (remember, only within scope; cannot declare var with same name; global shall not be named timera/timerb) TODO interesting NOP is not compiled TODO creating packages and such are declarations too (not only var decls) TODO translation limits LIMITS TODO gxtsema gxt key length <8 TODO gxtsema filename (excluding extension must be) <16 TODO label name <=38 TODO varname <40 TODO scriptname <=7 TODO scriptnames <= 300 TODO <=9216 gvar storage words TODO <=16 lvars storage words TODO <=255 array size TODO <=35000 label refs TODO <=255 line TODO <=127 string

    -

    15 Arachniography

    -
      -
    1. Official GTA2script Compiler V9.6 by DMA Design.
    2. -
    3. Official GTA2script Scripting Information by DMA Design.
    4. -
    5. Official GTA3 Script Compiler V413 by Rockstar North.
    6. -
    7. GTA III 10th Anniversary Multiscripts Source Code by Rockstar North, War Drum Studios.
    8. -
    9. GTA3 Script Compiler V413 Strings organized by Wesser.
    10. -
    11. GTA3 Script Compiler V413 Definitions organized by Wesser.
    12. -
    13. GTASA Mobile Symbol Listing organized by LINK/2012.
    14. -
    15. Work-In-Progress SCM Language Article by Wesser.
    16. -
    17. Ancient SCM Language Article by Wesser.
    18. +
    +
    +
    +
    WAIT arr[0]anything // recognized
    +// this specification does not accept this
    +
    +
    +
    +
    +
    +

    Arachniography

    +
    +
    +
      +
    1. +

      Official GTA2script Compiler V9.6 by DMA Design.

      +
    2. +
    3. +

      Official GTA2script Scripting Information by DMA Design.

      +
    4. +
    5. +

      Official GTA3 Script Compiler V413 by Rockstar North.

      +
    6. +
    7. +

      GTA III 10th Anniversary Multiscripts Source Code by Rockstar North, War Drum Studios.

      +
    8. +
    9. +

      GTA3 Script Compiler V413 Strings organized by Wesser.

      +
    10. +
    11. +

      GTA3 Script Compiler V413 Definitions organized by Wesser.

      +
    12. +
    13. +

      GTASA Mobile Symbol Listing organized by LINK/2012.

      +
    14. +
    15. +

      Work-In-Progress SCM Language Article by Wesser.

      +
    16. +
    17. +

      Ancient SCM Language Article by Wesser.

      +
    +
    +
    +

    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 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) +TODO timera timerb (remember, only within scope; cannot declare var with same name; global shall not be named timera/timerb) +TODO interesting NOP is not compiled +TODO creating packages and such are declarations too (not only var decls) +TODO translation limits +LIMITS +TODO gxtsema gxt key length <8 +TODO gxtsema filename (excluding extension must be) <16 +TODO label name <=38 +TODO varname <40 +TODO scriptname <=7 +TODO scriptnames <= 300 +TODO <=9216 gvar storage words +TODO <=16 lvars storage words +TODO <=255 array size +TODO <=35000 label refs +TODO <=255 line +TODO <=127 string

    +
    +
    +
    +
    - + \ No newline at end of file