tree: 2a13b7b7f7eb8c012100c3ceffbbfc5bbab2b010 [path history] [tgz]
  1. analyzer/
  2. builder/
  3. dill/
  4. kernel/
  5. parser/
  6. scanner/
  7. source/
  8. testing/
  9. util/
  10. colors.dart
  11. combinator.dart
  12. command_line.dart
  13. compile_platform.dart
  14. compiler_command_line.dart
  15. compiler_context.dart
  16. environment_variable.dart
  17. errors.dart
  18. export.dart
  19. import.dart
  20. loader.dart
  21. messages.dart
  22. modifier.dart
  23. operator.dart
  24. outline.dart
  25. parser.dart
  26. quote.dart
  27. README.md
  28. run.dart
  29. scanner.dart
  30. target.dart
  31. target_implementation.dart
  32. ticker.dart
  33. translate_uri.dart
pkg/front_end/lib/src/fasta/README.md

Fasta -- Fully-resolved AST, Accelerated.

Fasta is a compiler framework for compiling Dart sources to Kernel IR. When Fasta works well, you won‘t even know you’re using it, as it will be transparently integrated in tools like dart, dartanalyzer, dart2js, etc.

Hopefully, you'll notice that Fasta-based tools are fast, with good error messages. If not, please let us know.

Fasta sounds like faster, and that's a promise we intend to keep.

Getting Started

  1. Build the VM and patched SDK. Note: you only need to build the target runtime, so you only need to run this command:
./tools/build.py --mode release --arch x64 runtime

Make sure to define these environment variables, for example, by adding them to ~/.bashrc:

# Linux
DART_SDK=<Location of Dart SDK source check out>
export DART_AOT_VM=${DART_SDK}/out/ReleaseIA32/dart
export DART_AOT_SDK=${DART_SDK}/out/ReleaseIA32/patched_sdk
# Mac OS X
DART_SDK=<Location of Dart SDK source check out>
export DART_AOT_VM=${DART_SDK}/xcodebuild/ReleaseIA32/dart
export DART_AOT_SDK=${DART_SDK}/xcodebuild/ReleaseIA32/patched_sdk

If you want to help us translate these instructions to another OS, please let us know.

Create an Outline File

  1. Run dart pkg/front_end/lib/src/fasta/bin/outline.dart pkg/compiler/lib/src/dart2js.dart

  2. Optionally, run dart pkg/kernel/bin/dartk.dart pkg/compiler/lib/src/dart2js.dart.dill to view the generated outline.

This will generate a file named pkg/compiler/lib/src/dart2js.dart.dill which contains a serialized reprsentation of the input program excluding method bodies. This is similar to an analyzer summary.

Create a Platform Dill File

A platform.dill is a dill file that contains the Dart SDK platform libraries. For now, this is generated with dartk until fasta reaches a higher rate of test passes.

dart pkg/front_end/lib/src/fasta/bin/compile_platform.dart platform.dill

Make sure to define $DART_AOT_SDK as described above.

Compiling a Program

dart pkg/front_end/lib/src/fasta/bin/compile.dart pkg/front_end/test/fasta/hello.dart

This will generate pkg/front_end/test/fasta/hello.dart.dill which can be run this way:

$DART_AOT_VM pkg/front_end/test/fasta/hello.dart.dill

Where $DART_AOT_VM is defined as described above.

Using dartk and the Analyzer AST

dart pkg/front_end/lib/src/fasta/bin/kompile.dart pkg/front_end/test/fasta/hello.dart

This will generate pkg/front_end/test/fasta/hello.dart.dill which can be run this way:

$DART_AOT_VM pkg/front_end/test/fasta/hello.dart.dill

Where $DART_AOT_VM is defined as described above.

Running Tests

Run:

dart -c pkg/testing/bin/testing.dart --config=pkg/front_end/test/fasta/testing.json

Running dart2js

dart pkg/front_end/lib/src/fasta/bin/compile.dart pkg/compiler/lib/src/dart2js.dart
$DART_AOT_VM pkg/compiler/lib/src/dart2js.dart.dill pkg/front_end/test/fasta/hello.dart

The output of dart2js will be out.js, and it can be run on any Javascript engine, for example, d8 which is included with the Dart SDK sources:

./third_party/d8/<OS>/d8 out.js

Where <OS> is one of linux, macos, or windows.