Start is a simple 'toy' programming language for investigating different aspects of compiler implementation and optimization.
Start is based upon a subset of the Dart programming language, an optionally typed C-style programming language. This includes:
- top-level methods
- basic types: int, bool, List, dynamic
- basic control flow: if, while
- classes and heap-allocated objects
- static and dynamic typing
Start omits many features of Dart: it doesn't have inheritance, virtual methods, closures, libraries, and some control flow features (exceptions, switches, for-loops). It doesn't support any of Dart's libraries.
Although many Start programs run identically in Dart, Start differs in important ways. The int type is 32-bit and non-nullable in Start but infinite precision and nullable in Dart. The bool type is non-nullable in Start but nullable in Dart.
The start compiler translates source programs into a bytecode-like intermediate representation. The start interpreter executes the bytecode-like representation.
See the Start Language and Intermediate Form Overview for more details.
-
Download the Dart SDK from here: http://www.dartlang.org/downloads.html
-
Unzip and add the dart-sdk/bin directory to your path.
-
Download Start from https://github.com/vsmenon/start. You can either use git (recommended):
git clone https://github.com/vsmenon/start.git
Or, download a tarball: https://github.com/vsmenon/start/archive/master.zip
-
Navigate to the project:
cd start
-
Install dependencies:
pub install
-
Run correctness tests to ensure everything is working:
dart bin/test.dart
-
Run performance tests:
dart bin/time.dart
You can execute a Start program from source as follows:
dart bin/start.dart examples/link.dart
To compile without running, use the -c
flag:
dart bin/start.dart -c examples/link.dart
To save the intermediate code to file, run:
dart bin/start.dart -c examples/link.dart > link.start
Finally, to run intermediate code:
dart bin/start.dart -r link.start
The Start interpreter provides performance metrics that model a very simple execution machine. To print these after execution, use the -p flag. For example, the following shows the performance of both the typed and untyped version of link.dart:
dart bin/start.dart -p examples/link.dart
dart bin/start.dart -p untyped/link.dart
The Start compiler and intermediate representation are based upon the csc educational compiler developed by Martin Burtscher at UT Austin and used in Prof. Keshav Pingali's graduate compiler course there.