Command
compile
Purpose
Compiles a script.
Aliases
compilescript, compilescr, compile, comp
Syntax
compile [ <options> ] <script_file> [ <object_file> ]
Options
-l List commands. With this options, commands read from the script file
(including comments) are listed on Stream Error.
NOTE: If you are getting errors from your script, and don't know which
lines are producing those errors, call the script command using this option,
so that the command lines will be listed along with errors. The command line
IMMEDIATELY ABOVE THE ERROR is the offending line.
-p Parse only. With this option, this script is parsed (and any errors listed).
The script is, however, not compiled. This option is useful when first
developing a new script. The -l option needs to be specified if you want
to see the listing and errors.
Arguments
<script_file> Name of the script file. This file can have relative or absolute path.
<object_file> Name of the object file into which output is written. This file can have relative
or absolute path. File extension of ".bscs" is preferred, which stands for
biterScripting Compiled Script. If object file is not specified or is empty, output
is written to the file in the current directory, whose name is same as <script_file>, and
whose extension is "bscs".
Stream Input
Ignored
Stream Output
Ignored
Stream Error
Any errors encountered are produced here.
Description
This command compiles a biterScripting script into a compiled biterScript.
A compiled biterScript is executed by its users with the -c option of the script command.
There are several advantages to compiling a script. Some of them are listed below.
The compiled biterScript executes more efficiently compared to an un-compiled script.
You can control who can execute your script, and for how long.
Users of your script do not see the source code of your script.
During compilation, the same syntax checks are performed that are performed when executing
an un-compiled script. If any errors are found, they are written to the stream output.
Restrictions
It is important to thoroughly code-inspect and test your script in various environments
before compiling. This makes sure that the script is not relying on, for example,
variables, functions, scripts, that may not be available in the user's computing
environment.
Consider the following for example. Let's assume you have declared a global function
called square() in your startup.txt script, and the script being compiled uses
function square(). The script will compile without errors in your computing environment.
But when a user, who does not have the square() function declared in his/her computing
environment, will receive an error when he/she attempts to execute the compiled script.
Similar considerations apply to variables and other scripts called by the script being
compiled.
Valid Examples
compile "myscript.txt"
Will compile myscript.txt and will write the compiled version into file myscript.bscs in
the current directory.
compile "myscript.txt" "myscript.bscs"
Will compile myscript.txt and will write the compiled version into file myscript.bscs in
the current directory.
Invalid Examples
compile "myscript.txt" "myscript.bscs"
script "myscript.bscs"
Will produce an error. The script file name myscript.bscs is in compiled format. Thus,
the -c option of the script command should be used, as follows.
script -c "myscript.bscs"
See Also
script
function
var
startup
|
© 2008-2012, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.
|