Asger Feldthaus | 4045d8c | 2016-11-25 10:22:08 | [diff] [blame] | 1 | Moved |
| 2 | ===== |
| 3 | |
| 4 | This has moved into the [Dart SDK repository](github.com/dart-lang/sdk). |
| 5 | |
| 6 | This repository is not kept up-to-date. |
| 7 | |
Asger Feldthaus | dfb9c50 | 2016-04-26 08:29:55 | [diff] [blame] | 8 | Dart Kernel |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 9 | =========== |
| 10 | **Dart Kernel** is a small high-level language derived from Dart. |
| 11 | It is designed for use as an intermediate format for whole-program analysis |
| 12 | and transformations, and as a frontend for codegen and execution backends. |
| 13 | |
| 14 | The kernel language has in-memory representations in Dart and C++, and |
| 15 | can be serialized as binary or text. |
| 16 | |
Asger Feldthaus | 7f8c0ea | 2016-08-26 08:16:54 | [diff] [blame] | 17 | Both the kernel language and its implementations are unstable and are under development. |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 18 | |
| 19 | This package contains the Dart part of the implementation and contains: |
| 20 | - A transformable IR for the kernel language |
| 21 | - A frontend based on the analyzer |
| 22 | - Serialization of kernel code |
| 23 | |
Asger Feldthaus | 7f8c0ea | 2016-08-26 08:16:54 | [diff] [blame] | 24 | Getting Kernel |
| 25 | ------------ |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 26 | |
Asger Feldthaus | 7f8c0ea | 2016-08-26 08:16:54 | [diff] [blame] | 27 | Checkout the repository and run pub get: |
| 28 | ```bash |
| 29 | git clone https://github.com/dart-lang/kernel |
| 30 | cd kernel |
| 31 | pub get |
| 32 | ``` |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 33 | |
| 34 | Command-Line Tool |
| 35 | ----------------- |
| 36 | |
| 37 | Run `bin/dartk.dart` from the command-line to convert between .dart files |
| 38 | and the serialized binary and textual formats. |
| 39 | |
Asger Feldthaus | 5ad5fa8 | 2016-07-19 15:52:33 | [diff] [blame] | 40 | `dartk` expects the `.dill` extension for files in the binary format. |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 41 | The textual format has no preferred extension right now. |
| 42 | |
| 43 | Example commands: |
| 44 | ```bash |
| 45 | dartk foo.dart # print text IR for foo.dart |
Asger Feldthaus | 5ad5fa8 | 2016-07-19 15:52:33 | [diff] [blame] | 46 | dartk foo.dart -ofoo.dill # write binary IR for foo.dart to foo.dill |
| 47 | dartk foo.dill # print text IR for binary file foo.dill |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 48 | ``` |
| 49 | |
| 50 | Pass the `--link` or `-l` flag to link all transitive dependencies into one file: |
| 51 | ```bash |
Asger Feldthaus | 5ad5fa8 | 2016-07-19 15:52:33 | [diff] [blame] | 52 | dartk myapp.dart -ppackages -l -omyapp.dill # Bundle everything. |
| 53 | dartk myapp.dill # Print it back out in a (very, very long) textual format. |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 54 | ``` |
| 55 | |
| 56 | See [ast.dart](lib/ast.dart) for the in-memory IR, or [binary.md](binary.md) for |
| 57 | a description of the binary format. For now, the textual format is very ad-hoc |
| 58 | and cannot be parsed back in. |
| 59 | |
| 60 | |
Asger Feldthaus | 7f8c0ea | 2016-08-26 08:16:54 | [diff] [blame] | 61 | Testing |
| 62 | ------- |
| 63 | |
| 64 | If you plan to make changes to kernel, get a checkout of the Dartk SDK and run: |
| 65 | ```bash |
| 66 | tool/regenerate_dill_files.dart --sdk <path to SDK checkout> |
| 67 | pub run test |
| 68 | ``` |
| 69 | |
| 70 | |
Asger Feldthaus | e5262de | 2016-10-20 11:12:41 | [diff] [blame] | 71 | Linking |
Asger Feldthaus | 02604e9 | 2016-04-26 08:39:15 | [diff] [blame] | 72 | ------------------------- |
Asger Feldthaus | e5262de | 2016-10-20 11:12:41 | [diff] [blame] | 73 | Linking from binary files is not yet implemented. In order to compile a whole |
| 74 | program, currently everything must be compiled from source at once. |