From 149ca8ad671256d1d6b6dfa69f23673346d8abfe Mon Sep 17 00:00:00 2001 From: gongyuhang Date: Thu, 25 May 2023 14:11:51 +0800 Subject: [PATCH] Replace ts2panda with es2panda in subsys-arkcompiler-guide.md Issue: https://gitee.com/openharmony/docs/issues/I789CK Test: N/A Signed-off-by: gongyuhang --- .../subsystems/subsys-arkcompiler-guide.md | 23 +++++++++---------- .../subsystems/subsys-arkcompiler-guide.md | 21 ++++++++--------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/en/device-dev/subsystems/subsys-arkcompiler-guide.md b/en/device-dev/subsystems/subsys-arkcompiler-guide.md index 44633a8b7ea..9988a819133 100644 --- a/en/device-dev/subsystems/subsys-arkcompiler-guide.md +++ b/en/device-dev/subsystems/subsys-arkcompiler-guide.md @@ -32,29 +32,28 @@ Ubuntu 18.04 or later is recommended. ## How to Develop -1. Create the build products **ark_js_vm** and **ts2panda**. +1. Compile for executables **es2panda(es2abc)** and **ark_js_vm**. ```shell - python ark.py x64.release + python ark.py x64.release es2panda ark_js_vm ``` - - **ark_js_vm**: executable program for running .abc files. - - **ts2panda**: tool that converts ArkTS files into ArkCompiler bytecode files. + - **es2panda(es2abc)**: executable for generating ArkCompiler bytecode files(suffix: .abc) with ArkTS files. + - **ark_js_vm**: executable for running ArkCompiler bytecode files. -2. Use **ts2panda** to convert a TypeScript file to an .abc file. +2. Use **es2abc** to generate ArkCompiler bytecode files with TypeScript files. ```shell - prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node --expose-gc out/x64.release/clang_x64/obj/arkcompiler/ets_frontend/ts2panda/build/src/index.js helloworld.ts --opt-level 0 + out/x64.release/arkcompiler/ets_frontend/es2abc helloworld.ts ``` Code snippet of the TypeScript case file **helloworld.ts**: - ```JavaScript - declare function print(arg:any):string; - print("Hello world!"); + ```TypeScript + declare function print(arg: any): any; + print('Hello world!'); ``` + Generated file: helloworld.abc -3. Run the generated .abc file. +3. Use **ark_js_vm** to run the generated ArkCompiler bytecode file. ```shell out/x64.release/clang_x64/arkcompiler/ets_runtime/ark_js_vm helloworld.abc ``` - .abc file: ArkCompiler bytecode file. - The execution output is as follows: ``` Hello world! diff --git a/zh-cn/device-dev/subsystems/subsys-arkcompiler-guide.md b/zh-cn/device-dev/subsystems/subsys-arkcompiler-guide.md index a4a3c76d6a7..b5f60b34aa1 100644 --- a/zh-cn/device-dev/subsystems/subsys-arkcompiler-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-arkcompiler-guide.md @@ -32,29 +32,28 @@ ArkCompiler是一种统一编程平台,包含编译器、工具链、运行时 ## 开发步骤 -1. 生成编译产物ark_js_vm及es2panda。 +1. 编译出可执行程序es2panda(es2abc)、ark_js_vm。 ```shell - python ark.py x64.release + python ark.py x64.release es2panda ark_js_vm ``` - - ark_js_vm:运行abc文件的可执行程序。 - - es2panda:将ArkTS文件转换生成ArkCompiler字节码文件的工具。 + - es2panda(es2abc):生成ArkTS文件对应的ArkCompiler字节码文件(尾缀:.abc)的可执行程序。 + - ark_js_vm:运行ArkCompiler字节码文件的可执行程序。 -2. 使用ts2panda将TypeScript文件转换为abc文件。 +2. 用es2abc生成.ts文件对应的ArkCompiler字节码文件。 ```shell out/x64.release/arkcompiler/ets_frontend/es2abc helloworld.ts ``` - TypeScript用例文件helloworld.ts源码。 - ```JavaScript - declare function print(arg:string):string; + TypeScript用例文件helloworld.ts源码: + ```TypeScript + declare function print(arg: any): any; print('Hello world!'); ``` + 生成的文件:helloworld.abc -3. 执行生成的abc文件。 +3. 用ark_js_vm运行生成的ArkCompiler字节码文件。 ```shell out/x64.release/arkcompiler/ets_runtime/ark_js_vm helloworld.abc ``` - abc文件:ArkCompiler字节码文件。 - 执行结果: ``` Hello world! -- Gitee