The ARK front-end tools use the command line interaction mode and convert JS code into ARK bytecodes that can run on ARK runtime. The toolchain supports Windows, Linux, and macOS.
JS Bytecode Compiler
Front-end tools, converting JS source code into ARK bytecode, can be built by specifying the --build-target with ark_ts2abc.
Build tools:
$ $ ./build.sh --product-name rk3568 --build-target ets_frontend_build
$ cd out/rk3568/clang_x64/arkcompiler/ets_frontend/
$ ./es2abc [options] file.js
If no parameter is specified for [options], an ARK binary file is generated by default.
Option
|
Description
|
Value Range
|
Default Value
|
--debug-info
|
Provides debug information.
|
-
|
-
|
--debugger-evaluate-expression
|
Evaluates base64 style expression in debugger
|
-
|
-
|
--dump-assembly
|
Outputs an assembly file.
|
-
|
-
|
--dump-ast
|
Prints the parsed AST(Abstract Syntax Tree)
|
-
|
-
|
--dump-debug-info
|
Prints debug Info
|
-
|
-
|
--dump-literal-buffer
|
Prints the content of literal buffer
|
-
|
-
|
--dump-size-stat
|
Displays statistics about bytecodes.
|
-
|
-
|
--extension
|
Specifies input file type
|
['js', 'ts', 'as']
|
-
|
--help
|
Displays help information.
|
-
|
-
|
--module
|
Compiles the code based on the ecmascript standard module.
|
-
|
-
|
--opt-level
|
Specifies the level for compilation optimization.
|
['0', '1', '2']
|
0
|
--output
|
Specifies the path of the output file.
|
-
|
-
|
--parse-only
|
Parse the input file only
|
-
|
-
|
--thread
|
Specifies the number of threads used to generate bytecode
|
0-Number of threads supported by your machine
|
0
|
Disassembler ark_disasm
The ark_disasm disassembler converts binary ARK bytecodes into readable text ARK bytecodes.
Command:
ark_disasm [Option] Input file Output file
Option
|
Description
|
--debug
|
Enables the function for printing debug information.
|
--debug-file
|
Specifies the path of the debug information output file. The default value is std::cout.
|
--help
|
Displays help information.
|
--verbose
|
Outputs the comments of the output file.
|
Input file: ARK bytecodes in binary format
Output file: ARK bytecodes in text format