Triple scripts use a concatenated block format. It's one of the most portable application file formats in the world. Refer to the existing info about the triple script file format.
As the linked page indicates, you should NOT use the "published" triple script file format for anything that is not actually a triple script. Programs are only triple scripts if they conform to all three of the triple script invariants. To experiment with similar concepts for files that are not valid triple scripts, it's not necessary to use the triple slash delimiter, so please do not use it for programs that are not intended to assert their conformance to the triplescripts.org standards.
The latest versions of trplkt, the triplescripts.org reference compiler, will by default output g-blocks—that is, delimiters set off by the
//? character sequence, rather than ordinary triple slash delimiters. There are no restrictions on the use of the g-block delimeters; feel free to experiment with programs that use them for whatever reason (or try using ordinary comments instead). Authors of genuine triple scripts should use trplkt to run the
publish command after compilation, which will should produce the same program with triple slash delimiters in place of the
//?-style delimiters used in programs comprising a sequence of g-blocks.
The clever design and use of triple slash script delimiters is what allows triple scripts to run in various legacy runtimes, including Web browsers and JS engines. The triple script dialect was carefully designed so the triple slash script delimiters that appear in compilation form indicating the beginning and end of a given module are not just valid tokens for the triple script compiler, but are valid sequences according to the ECMA-262 grammar and for a Web browser expecting markup to be parsing using the HTML5 parsing algorithm.
The file format permits, as an alternative to t-blocks, delimiters that look like
//? <script> and
//? </script> to denote a g-blocks. Files comprising a sequence of g-blocks are not meant to have strong guarantees about the contents the way that t-blocks do. The trplkt publish command may be used to convert a valid program into a triple script for wide distribution. Programs that are *not* valid triple scripts (because they fail to abide by the three invariants) should not repurpose existing triple script tools to produce non-triple scripts, but instead rely on a separate toolchain of their own. Despite this, the design of trplkt incorporates a set of choices, such as the one to produce a sequence of g-blocks by default and require a separate "publish" step, to guard against misuse inadvertently polluting the world with malformed triple scripts (that is, programs that are not triple scripts that have been formatted as if they were).
The triple script dialect has two forms: compilation form and normal form. Normal form is the pre-compilation form that exists in files dedicated to a single source module, and compilation from is the form that source code appears in after it has been prepared for execution (or distribution) in concatenated block format. The rules for mapping between compilation form and normal form are simple:
exportin normal form get replaced by
/// exporttriple slash sequences, respectively
- in compilation form, source modules appear wrapped with delimiters, either as t-blocks or g-blocks
- attributes in compilation form are stripped of triple slash sequences when converted to normal form (and in the case of synthesized attributes, are erased entirely)
Compilation form may use either t-blocks or g-blocks. It is forbidden to mix t-blocks and g-blocks within the same script. It is best to use trplkt's
publish command to handle translating a script from g-blocks to t-blocks before distribution.