1e41f4b71Sopenharmony_ci# ArkCompiler Development 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## Introduction 4e41f4b71Sopenharmony_ciArkCompiler is a unified programming platform. Its key components include a compiler, toolchain, and runtime. ArkCompiler supports compilation and running of high-level programming languages on the multi-chip platform and accelerates the running of applications and services on mobile phones, PCs, tablets, TVs, automobiles, and smart wearables. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci## Environment Setup 7e41f4b71Sopenharmony_ciUbuntu 18.04 or later is recommended. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci1. Install dependent tools. 10e41f4b71Sopenharmony_ci ```shell 11e41f4b71Sopenharmony_ci sudo apt-get update && sudo apt-get install python ruby python3-pip git-lfs gcc-multilib g++-multilib zlib1g-dev libc++1 curl nodejs 12e41f4b71Sopenharmony_ci ``` 13e41f4b71Sopenharmony_ci2. Install the **repo** tool. 14e41f4b71Sopenharmony_ci ```shell 15e41f4b71Sopenharmony_ci mkdir ~/bin/ 16e41f4b71Sopenharmony_ci curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > ~/bin/repo 17e41f4b71Sopenharmony_ci chmod a+x ~/bin/repo 18e41f4b71Sopenharmony_ci export PATH=~/bin:$PATH 19e41f4b71Sopenharmony_ci pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests 20e41f4b71Sopenharmony_ci ``` 21e41f4b71Sopenharmony_ci3. Download source code. 22e41f4b71Sopenharmony_ci ```shell 23e41f4b71Sopenharmony_ci repo init -u https://gitee.com/ark-standalone-build/manifest.git -b master 24e41f4b71Sopenharmony_ci repo sync -c -j8 25e41f4b71Sopenharmony_ci repo forall -c 'git lfs pull' 26e41f4b71Sopenharmony_ci ``` 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci4. Install the compiler and binary tool. 29e41f4b71Sopenharmony_ci ```shell 30e41f4b71Sopenharmony_ci ./prebuilts_download.sh 31e41f4b71Sopenharmony_ci ``` 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci## How to Develop 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci1. Create the build products **ark_js_vm** and **es2panda**. 36e41f4b71Sopenharmony_ci ```shell 37e41f4b71Sopenharmony_ci python ark.py x64.release 38e41f4b71Sopenharmony_ci ``` 39e41f4b71Sopenharmony_ci - **ark_js_vm**: executable program for running .abc files. 40e41f4b71Sopenharmony_ci - **es2panda**: tool that converts ArkTS files into ArkCompiler bytecode files. 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci2. Use **es2panda** to convert a TypeScript file to an .abc file. 43e41f4b71Sopenharmony_ci ```shell 44e41f4b71Sopenharmony_ci out/x64.release/arkcompiler/ets_frontend/es2abc helloworld.ts 45e41f4b71Sopenharmony_ci ``` 46e41f4b71Sopenharmony_ci Code snippet of the TypeScript case file **helloworld.ts**: 47e41f4b71Sopenharmony_ci ```JavaScript 48e41f4b71Sopenharmony_ci declare function print(arg:string):string; 49e41f4b71Sopenharmony_ci print('Hello world!'); 50e41f4b71Sopenharmony_ci ``` 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci3. Run the generated .abc file. 53e41f4b71Sopenharmony_ci ```shell 54e41f4b71Sopenharmony_ci out/x64.release/arkcompiler/ets_runtime/ark_js_vm helloworld.abc 55e41f4b71Sopenharmony_ci ``` 56e41f4b71Sopenharmony_ci .abc file: ArkCompiler bytecode file. 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci The execution output is as follows: 59e41f4b71Sopenharmony_ci ``` 60e41f4b71Sopenharmony_ci Hello world! 61e41f4b71Sopenharmony_ci ``` 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci## Running the Test262 Test Suite 64e41f4b71Sopenharmony_ci``` 65e41f4b71Sopenharmony_cipython ark.py x64.release test262 66e41f4b71Sopenharmony_ci``` 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci## Build Options 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ciSelect a build mode, for example, mode for building a debug version on an x64 platform. 71e41f4b71Sopenharmony_ci``` 72e41f4b71Sopenharmony_cipython ark.py x64.debug 73e41f4b71Sopenharmony_ci``` 74e41f4b71Sopenharmony_ciObtain help information. 75e41f4b71Sopenharmony_ci``` 76e41f4b71Sopenharmony_cipython ark.py --help 77e41f4b71Sopenharmony_ci``` 78