The Tridash compiler (tridashc
) accepts a number of options which
affect the compilation of certain files and the output code that is
generated.
View the man page for tridashc
or run the command tridashc -h
for
details of how these options are specified.
The compilation target (or compiler backend) determines the type of
output file that is generated. The compilation target is specified
using the -t
command-line option or the backend
output option of
the build configuration file, View the tridashc man-page for more
information.
The current version of Tridash has the following targets:
javascript
wasm32
(32-bit WebAssembly)
The output options control various aspects of the output code that is generated. The options accepted depends on the compilation target.
The JavaScript backend accepts the following options:
indented
runtime-path
runtime-linkage
Controls how the runtime library is linked with the generated code. This only has an effect when the output is an HTML file, otherwise the runtime library is not linked to the output and has to be loaded manually.
It can be one of the following values:
static
dynamic
runtime-path
, inside the HTML file.
none
type
Type of output that is generated. Can be one of the following:
html
main-ui
option, is used as the template for
the HTML output file.
js
Tridash
object, prior to loading
the generated JavaScript file. This is the default.
main-ui
module-name
The identifier of the JavaScript variable, by which the runtime module object is referenced.
If empty (the default) and the output type is a JavaScript file, the
properties of the runtime module object are assigned to the exports
object. The file can then be loaded using the require
function, in a JavaScript runtime where it is supported. When the
output type is an HTML file, the runtime module object is not
accessible.
When given a value, the runtime module object is assigned to the global variable with the identifier given by the value. The JavaScript file can then be loaded using an HTML script tag.
When targeting WebAssembly (wasm32
), two output files are generated:
.wasm
containing the compiled Tridash code.
To use the compiled module, only the loader script has to be loaded.
The following output options are accepted.
indented
type
Type of output that is generated.
By default a separate WebAssembly (.wasm
) and JavaScript file are
generated. The module loader library has to be loaded manually.
If set to html
, generate an HTML file with the compiled Tridash code
embedded in it. The HTML source, which is referenced by the HTML node
with identifier given by the main-ui
option, is used as the template
for the HTML output file.
main-ui
module-name
The identifier of the JavaScript variable, through which, the runtime module object is referenced.
If empty (the default) and the output type is not html
, the
properties of the runtime module object are assigned to the exports
object. The loader script can then be loaded using the require
function, in a JavaScript runtime where it is supported. When the
output type is an HTML file, the runtime module object is not
accessible.
When given a value, the runtime module object is assigned to the global variable with the identifier given by the value. The loader script file can then be loaded using an HTML script tag.
linkage
Control how the WebAssembly module is linked to the loader script
This can be one of the following:
local
require
function and the fs
module. The paths to the compiled
module and runtime library are given by the module-path
and
runtime-path
options, respectively.
remote
module-path
and runtime-path
options,
respectively.
embed
module-path
and runtime-path
options, respectively.
runtime-path
module-path
stack-size
The amount of space to reserve for the GC root set stack. The default stack size is 64 KB.
The root set stack does not expand after the space is reserved. If more elements are pushed onto it than there is space, a memory access out of bounds exception will be thrown by the WebAssembly runtime. |