EJS(1)                           User Commands                          EJS(1)



NAME
       ejs  -  Interpreted  object-oriented  scripting  language  (Javascript)
       shell.

SYNOPSIS
       ejs [--class className] [--debug] [--ecma] [--files "files..."]  [--log
       logSpec]   [--method   methodName]   [--nodebug]   [--optimize   level]
       [--searchPath ejsPath] [--standard]  [--stats]  [--strict]  [--version]
       [--warn level] file [arguments ...]

DESCRIPTION
       Ejscript  is  an interpreted, object oriented scripting language and is
       an  enhanced  implementation  of  the  emerging  ECMAScript  Edition  4
       (Javascript)   language.  Ejscript  supports  statements,  expressions,
       objects, classes, exceptions, namespaces,  iterators,  type  annotation
       and a powerful suite of data types.

       While  Javascript  is  the  language  of the browser, Ejscript has been
       designed to run Javascript outside a browser. The goal of  Ejscript  is
       to  create  a  language  ideally suited for embedded applications where
       efficiency of execution is a paramount concern.

INVOCATION
       The ejs command can be used as a shell to interactively interpret  com-
       mands typed at the console or to run script files. When invoked with no
       files on the command line and no --class or --method switches, ejs runs
       in  interactive  mode.   In  interactive mode, ejs reads input from the
       console and parses and executes script code as it is entered.  The  ejs
       command  will read input until it has a complete block of code and will
       then execute the block. The last result value computed will  be  echoed
       to the console. For example:

               ejs-0>  if  (true)  { ejs-2>     print("Hello World"); ejs-2> }
               Hello World

               ejs-0>

       Note the input prompt includes a level of nest  indicator  starting  at
       zero  and increasing upward as commands nest. This is a hint as to when
       you have closed sufficient braces for ejs to execute your  command.  As
       this  is  an  internal compiler nest value, it will sometimes increment
       more than 1 for each brace.

       If ejs is invoked with a file name on the command line, that file  will
       be  read  and its statements executed. One file may be supplied and the
       arguments after it will be passed into the script as command line argu-
       ments. For example:

               ejs myscript.es arg1 arg2 arg3

       The  given  file  may  be either a script file or it may be an Ejscript
       module with a ".mod" extension, previously compiled with  the  ec  com-
       mand.

       If  you  require more script files to be parsed, use the --files "files
       ..." switch to supply extra scripts. These will be parsed in order, but
       after the primary script on the command line.

       The  ejs  command  can also invoke a specific static method on startup.
       If either the --class or --method switches are supplied, then ejs  will
       run  the requested static method after the input file script statements
       have been executed.

OPTIONS
       --class className
              Use the given className when searching for  the  startup  method
              specified  via  --method  or  "main" by default.  --debug Run in
              debug mode.

       --ecma Run in ECMAScript Edition 4 (ES4) compilance mode. The ejs  com-
              mand  normally  runs  in  non-compliant,  enhanced  mode.   This
              enhanced mode eliminates browser specific portions  of  the  ES4
              standard  to give a safer, faster language.  For example: in ES4
              compliant mode, function variables used without an  accompanying
              var  declaration are global variables, whereas in enhanced mode,
              they are local variables.

       --files "files ..."
              Specifies an extra set of files to be compiled. The ejs  command
              normally  takes  just  one script file on the command line.  The
              --files switch allows extra script to be compiled after the pri-
              mary script, but before the scripts are run.

       --log logName[:logLevel][.maxSize]
              Specify  a file to log internal execution messages. Ejs will log
              execution related trace to the log file. The log level specifies
              the  desired  verbosity  of output. Level 0 is the least verbose
              and level 9 is the most. Level 2  will  include  trace  of  each
              source  statement  and  assembler instruction executed (provided
              --nodebug is not specifiec).  When the maximum size is specified
              (MB)  and  exceeded, the log file will be rotated to logName.old
              and a new log file will be started.

       ---method methodName
              Set the startup method name. Defaults to "main" if a --className
              is specified and --method is not.

       --nodebug
              Run  the  script  without debug information. This will result in
              exceptions not having symbolic stack backtraces.

       --optimize level
              Set the code optimization level. Level values must be between  0
              (least) and 9 (most). Default is 9.

       --searchPath ejsPath
              Override the module search path. The module search path is a set
              of directories that the ejs command will use when  locating  and
              loading  Ejscript  modules.  Given  a  module named "a.b.c" in a
              script, ejs will use the following search strategy to locate the
              module:

              1. Search for a module file named "a.b.c.mod"

              2. Search for a module file named "a/b/c.mod"

              3. Search for a module file named "a.b.c.mod" in EJSPATH

              4. Search for a module file named c.mod in EJSPATH

              The  search  path  is  initiallly  specified via the environment
              variable EJSPATH and may be overridden via the --searchPath ejs-
              Path switch. EJSPATH and the ejsPath command line value are sim-
              ilar to the system PATH formats. On windows, path  segments  are
              separated  by  ";" and on Linux, Unix, FreeBSD and MAC, the path
              segments are separated by ":" delimiters.

       --standard
              Run scripts in standard  mode.  Ejscript  supports  two  parsing
              modes: strict and standard. Standard mode does not require vari-
              ables be declared and typed before use.

       --stats
              Print various statistics on exit.

       --strict
              Run scripts in standard  mode.  Ejscript  supports  two  parsing
              modes:  strict and standard. Strict mode requires that all vari-
              ables be declared and typed.

       --warn level
              Set the compiler warning verbosity level. Level values  must  be
              between 0 (least verbose) and 9 (most). Default is 0.

       --version
              Print the ejs command version and exit.


REPORTING BUGS
       Report bugs to <dev@embedthis.com>.

COPYRIGHT
       Copyright (C) 2004-2009 Embedthis Software.  Ejscript is a trademark of
       Embedthis Software.

SEE ALSO
       ec, ejsmod, ejsvm



ejs                                May 2009                             EJS(1)
