Changes between Initial Version and Version 1 of JSC


Ignore:
Timestamp:
Jul 1, 2009 1:41:22 PM (15 years ago)
Author:
bfulgham@webkit.org
Comment:

Initial entry to document the utility.

Legend:

Unmodified
Added
Removed
Modified
  • JSC

    v1 v1  
     1= JSC =
     2{{{jsc}}} is a command-line utility that allows you to run JavaScript programs outside of the context of a web browser.  It is primarily used as part of the test harness for validating the JavaScript portions of WebKit, but can also be used as a scripting tool.
     3
     4{{{jsc}}} can be run in an interactive mode to test out JavaScript expressions, or it can be passed one or more files to run similar to invoking a Perl or Python script.
     5
     6== Usage ==
     7=== Command Line Flags ===
     8{{{
     9Usage: jsc [options] [files] [-- arguments]
     10  -d         Dumps bytecode (debug builds only)
     11  -e         Evaluate argument as script code
     12  -f         Specifies a source file (deprecated)
     13  -h|--help  Prints this help message
     14  -i         Enables interactive mode (default if no files are specified)
     15  -s         Installs signal handlers that exit on a crash (Unix platforms only)
     16}}}
     17
     18=== Built-In Functions ===
     19* {{{quit()}}} Quit the interpreter
     20
     21
     22== Examples ==
     23You can use {{{jsc}}} as a calculator:
     24{{{
     25$ ./jsc
     26> "hello"
     27hello
     28> 1 + 3
     294
     30> 2 * Math.sin(32)
     311.1028533624833812
     32> 2 * Math.floor(1.2)
     332
     34> 2 * Math.ceil(1.2)
     354
     36> 15.3 / 18 * 27.1 * (Math.ceil(1.3) * Math.exp(2.3) * Math.log (1.223) * Math.sin(32.22))
     3766.6192983328985
     38>
     39}}}
     40
     41You can also test more complicated expressions:
     42{{{
     43> var add3 = function(arg) { return arg + 3; }
     44undefined
     45> add3(3)
     466
     47>
     48}}}
     49