📄 js.1
字号:
.\"
.\" Manual page for the js interpreter.
.\" Copyright (c) 1998 New Generation Software (NGS) Oy
.\" Author: Markku Rossi <mtr@iki.fi>
.\"
.\" This library is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Library General Public
.\" License as published by the Free Software Foundation; either
.\" version 2 of the License, or (at your option) any later version.
.\"
.\" This library is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
.\" Library General Public License for more details.
.\"
.\" You should have received a copy of the GNU Library General Public
.\" License along with this library; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
.\" MA 02111-1307, USA
.\"
.TH JS 1 "Sep 25, 1998" "JS" "JS"
.SH NAME
js \- interpret, execute, and compile JavaScript files
.SH SYNOPSIS
.B js
[\f3\-acfghlNStvV\f1]
[\f1\-d \f2type\f1]
[\f1\-e \f2code\f1]
[\f1\-O\f1[\f2level\f1]]
[\f1\-r \f2option\f1]
[\f1\-s \f2size\f1]
[\f1\-W \f2option\f1]
\f2file\f1 [\f2argument\f1]...
.SH DESCRIPTION
The \f3js\f1 program is the JavaScript interpreter command. It can be
used to execute JavaScript and JavaScript byte-code files. The progam
can also be used to compile JavaScript files into the byte-code files.
.SH OPTIONS
.TP 8
.B \-a, \-\-annotate\-assembler
Annotate the created assembler listing with the original JavaScript
source code. The option can be used only with the \f3\-\-assembler\f1
option.
.TP 8
.B \-c, \-\-compile
Compile JavaScript files to byte\-code. The generated byte\-code is
saved to file which name is created from the name of the input file by
replacing the suffix \f3.js\f1 with the suffix \f3.jsc\f1. The
compilation can be controlled with options \f3\-\-debug\f1,
\f3\-\-optimize\f1, and \f3\-\-compiler-option\f1.
.TP 8
.B \-d \f2type\f3, \-\-dispatch=\f2type\f3
Use the byte-code instruction dispatch method \f2type\f1. The current
implementation supports the following dispatch methods:
.RS 8
.TP 8
.B switch\-basic
The basic switch-method using a big switch-case table to dispatch the
instruction. This method is available only if the interpreter has been
configured with the option \f3\-\-with\-all\-dispatchers\f1.
.TP 8
.B switch
An optimized version of the switch\-method. This method is supported on
all environments.
.TP
.B jumps
The fastest dispatch method that uses the `computed goto' statement of
the GNU C\-compiler. This method is available if the interpreter has
been compiled with the GNU C\-compiler.
.RE
The default dispatch method, for environments that has the GNU
C-compiler, is \f3jumps\f1. For all other environments, the default
method is \f3switch\f1.
.TP
.B \-e \f2code\f1, \-\-eval=\f2code\f3
Evaluate JavaScript code \f2code\f1.
.TP
.B \-f, \-\-file
Stop processing options and use the next argument as the name of the
JavaScript (or byte\-code) file. All the remaining arguments are
passed to the interpreter through the \f3ARGS\f1 array. The first
item of the array will be the name of the script, i.e. the argument
that follows the option \f3\-\-file\f1.
.TP
.B \-g, \-\-debug
Make the compiler to generate debugging information to the generated
byte\-code files. This option can be used with the option
\f3\-\-compile\f1.
.TP
.B \-h, \-\-help
Print a short help message that describes the options that can be given
to the \f3js\f1 program.
.TP
.B \-l, \-\-load
Load multiple JavaScript and JavaScript byte\-code files to the
interpreter. Normally, the first non\-option argument is evaluated
and all remaining arguments are passed to the script as arguments.
With the option \f3\-\-load\f1, multiple files can be loaded the to
the interpreter. The loading can be stopped with option
\f3\-\-file\f1 that specifies the last file to load.
.TP
.B \-N, \-\-no\-compiler
Do not define the compiler to the virtual machine. This option makes
the interpreter smaller, but the interpreter can only execute
pre\-compiled byte\-code files. The option disables the \f3eval\f1
global method.
.TP
.B \-O \f1[\f2level\f1]\f3, \-\-optimize\f1[\f3=\f2level\f1]\f3
Set the compiler optimization level to \f2level\f1. The compiler has
three different optimization levels:
.RS 8
.TP 8
.B 0
Do not optimize.
.TP 8
.B 1
Perform all cheap optimizations which do not required heavy assembler
instruction analyzing.
.TP 8
.B 2
Perform all optimizations, supported by the compiler.
.RE
The default optimization level is 1.
.TP
.B \-r \f2option\f3, \-\-secure=\f2option\f3
Turn on virtual machine security option \f2option\f1. The following
security options are available:
.RS 8
.TP 8
.B file
Disable insecure methods from the buit-in File object.
.TP 8
.B system
Disable insecure methods from the buit-in System object.
.RE
.TP
.B \-s \f2size\f3, \-\-stack\-size=\f2size\f3
Set the size of the virtual machine operand stack to \f2size\f1. The
size of the virtual machine operand stack is set at the startup\-time
and it can't be enlarged dynamically at the runtime.
.TP
.B \-S, \-\-assembler
Compile JavaScript files to JavaScript assembler. The generated
assembler listing is saved to file which name is created from the name
of the input file by replacing the suffix \f3.js\f1 with the suffix
\f3.jas\f1. The compilation can be controlled with options
\f3\-\-optimize\f1, and \f3\-\-compiler\-option\f1.
.TP
.B \-t, \-\-stacktrace
Print a stack trace on error. When an error occurs during the
evaluation of a script, the virtual machine will halt and the \f3js\f1
program terminates. If the option \f3\-\-stacktrace\f1 was given to
the interpreter, the virtual machine will print a stack trace that
shows the call stack at the point of the error.
.TP
.B \-v, \-\-verbose
Increase the verbosity of the interpreter. The option can be given
multiple times to increase the amount of messages the interpreter
prints.
.TP
.B \-V, \-\-version
Print the version number of the \f3js\f1 program.
.TP
.B \-W \f3option\f3, \-\-compiler\-option=\f2option\f3
Set JavaScript compiler options according to the option specification
\f2option\f1. The specification \f2option\f1 can be given in two
forms. In the normal form, the option specifies a compiler option
that should be set on. If the specification @var{option} starts with
the prefix `\f3no-\f1', the specified option will be turn off. The
following option specifications are currently implemented:
.RS 8
.TP 8
.B all
match most of the compile time options
.TP 8
.B pedantic
match all compile time options. This option generates as much warnings
as possible. It will also complain about some things that are allowed
by the ECMAScript standard, but which are consired to show bad
programming style, for example, missing semicolons.
.TP 8
.B runtime
match all runtime options
.TP 8
.B shadow
warn if a variable declaration shadows a parameter
.TP 8
.B undefined
runtime check for undefined global variables
.TP 8
.B unused\-argument
warn about unused arguments
.TP 8
.B unused-variable
warn about unused local variables
.TP 8
.B with\-clobber
warn if the with\-lookup of a symbol is clobbered because the symbol is
defined to be a local variable or a function argument
.TP 8
.B missing\-semicolon
warn about missing semicolons that are fixed by the missing semicolon
inserting during the compilation
.TP 8
.B strict\-ecma
warn about things that are supported by this implementation, but are not
allowed by the ECMAScript standard. These features are:
.RS 8
.TP 2
\- line terminators in string and regular expression constant
.RE
.TP 8
.B deprecated
warn if deprecated features has been used in the source code
.RE
.TP 8
.B \-x, \-\-executable
Add execute permissions to the generated byte-code files. This option
is useful on Linux environments where JavaScript byte-code files can be
executed natively with the `binfmt_js' module.
.SH AUTHOR
Markku Rossi <mtr@ngs.fi>
NGS JavaScript WWW home page: <http://www.ngs.fi/js/>
.SH SEE ALSO
jsdas(1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -