Compiler Options

Options are specified in the object passed to the jscc function when using JS/CC as a module. When using JS/CC from the command line, options are specified as command-line arguments prefixed with two hyphens.

Option Type Default Description
out_file string Empty string, meaning to print to standard output or the engine's equivalent The path of the output file.
src_file string Empty string, meaning to read from standard input or the engine's equivalent The path of the input grammar file.
tpl_file string A default template file for generic compilation tasks. The path of the input template file.
input string or function None If a string, the contents of the input grammar. If a function, a function that returns the contents of the grammar. When input is specified, src_file is ignored.
template string or function None If a string, the contents of the template. If a function with no arguments, a function that returns the contents of the template. When template is specified, tpl_file is ignored.
outputCallback function(string) None A function with a parameter that will be called with the output. When outputCallback is specified, out_file is ignored.
dump_nfa boolean false Whether to output the nondeterministic finite automata for debugging purposes.
dump_dfa boolean false Whether to output the deterministic finite automata for debugging purposes.
verbose boolean false Makes output slightly chattier. Will probably be deprecated in favor of using only logLevel at some point.
logLevel string or member of the jscc.enums.LOG_LEVEL enumeration (FATAL, ERROR, WARN, INFO, DEBUG , TRACE) WARN The logging level.
throwIfErrors boolean false Whether to throw an exception before completion of the main method if there are any compilation errors. Not available from the command line.
exitIfErrors boolean false Whether to exit the process with a non-zero exit code if there are any errors, provided that the platform permits doing so. Intended for use with shell scripts. Not available from the command line.