How to run
Basic usage
./jc (.exe for windows) [source files] --boolean-argument -key-value-argument=param1, param2, ..., paramN
There're two kinds of CLI arguments:
- Boolean, that is, just a flag
- Key-value that receive parameters
Also, arguments have constraints:
- Non-existent arguments leads to an error
- For key-value arguments: count of arguments (maybe any count) and allowed parameters (what you are able to write after
=
) - Dependencies. It means that some arguments are not allowed if another argument is not set, e.g. you cannot use
--compile-depth
(it controls how deep will compilation process go by workflow) without setting the--dev
argument.
Example usage.
./bin example.jc --print=ast
The actual list of options
Key-value options
--dev-print
- (any count of parameters) - Development option that enables printing of representations of some structures on different compilation stages:suggestions
- Prints suggestions as non-formatted text for each stage.summary
- Prints summary table after when compilation completes (even with error).dir-tree
- Prints directory tree where root file is placed, so we can check which files will be compiledsource
- Prints source for each file will be compiledtokens
- Prints token stream (each on a new line) with position and lengthast
- Prints source code from the view of AST (does not actually print AST as a tree)ast-node-map
- (Ignoresast
argument if passed) - Prints AST in the same way as--dev-print=ast
by also appending node id after each AST node.ast-names
- Prints AST with color markers (connections to names) after name resolution.mod-tree
- Prints Module-Tree which, i.e. tree of items defined in scope tree.ribs
- Prints ribs, i.e. scopes for local variables.definitions
- Prints definition list.resolutions
- Prints resolution list.all
- prints everything described above
--log-level
- (1 parameter; default:info
) - Global log level. The level is checked by precedence wheredev
has the lowest one anderror
the higher.debug
info
- (Default)warn
- (Don't confuse with warnings in the context of suggestions)error
--lexer-log-level
- (1 parameter) - Lexer log level- (Same parameters as in
-log-level
)
- (Same parameters as in
--parser-log-level
- (1 parameter) - Parser log level- (Same parameters as in
-log-level
)
- (Same parameters as in
--name-resolver-log-level
- (1 parameter) - NameResolver log level- (Same parameters as in
-log-level
)
- (Same parameters as in
--compile-depth
- (1 parameter, depends ondev
) - controls how deep will compilation process go by workflow (each next argument implicitly includes all previous arguments):parser
- stops after parsing filesname-resolution
- stops after name resolution
--dev-stages
- (multiple parameters) - Enables dev-mode for specific stages, includes logs and additional info.lexer
- Lexing stageparser
- Parser stagename-res
- Name resolution stage (includes "module tree building", "importation" and "name resolution")lowering
- Lowering stage
--dev-log
- Enables development logs for specific objects and storages.lexer
- Enable dev logs forLexer
parser
- Enable dev logs forParser
mod-tree-builder
- Enable dev logs forModuleTreeBuilder
importer
- Enable dev logs forImporter
name-resolver
- Enable dev logs forNameResolver
lowering
- Enable dev logs forLowering
--parser-extra-debug
(depends ondev
) - enables additional debug logs in parserno
- (default) - No extra debug infoentries
- Prints what syntax units parser enters and leaveall
- Printsentries
and also special much info about skipping, etc.
Toggle key-value option arguments
If you want to disable specific argument of key-value option, e.g. passing `--dev-print=all` to exclude `tokens` you need to write `--dev-print all=no` or `--dev-print=all=no`, but first form is more readable. You can use any boolean value to toggle arguments, allowed boolean values described below.
Boolean options
--dev
- enables dev mode: all logs will be printed includingdev
-level logs and new logs will be added. Generally just produces more debug info everywhere.--dev-full
- (depends on--dev
) - Enable all development logs and (maybe) some additional info emitting. You still can disable something using specific option, e.g.--dev-full --dev-print source=no
.--dev-full
does not enable "extra" options like--parser-extra-debug
.
Explicit Boolean option value
What if you want to set bool-arg to false
? Let's imagine that --dev
is set by default (it is not anyway). There is
the pretty same syntax for bool-args as for key-value args.
--dev=no
There's a bunch of allowed bool values:
(Truthy) | (Falsy) |
---|---|
yes | no |
y | n |
true | false |
1 | 0 |
on | off |
This values are case insensitive, so you are able to write Y
or tRue
or False
, etc..