hakk_builder 0.2.2

  • README.md
  • Installing
  • Versions
  • 27

Hakk Builder

Hakk builder is an API that allows you to construct hakkML source code using Dart.

The generated source code can then be uploaded to http://hakk.it and used in competition.

What is a Hakk?

A hakk is a "program" that is specially written for the game hakk.it. Hakks compete in combat arenas against other hakks, or to complete challenges.

Basic API

The basic API provides a higher-level abstraction over the VM machine language (hakkML). It provides support for expressions, logical branching and looping. The API also provides convience functions for common hakk tasks, such as turning toward the enemy.

Using the basic API provides and easier entry point to writing hakks, but the trade-off is that the hakk will likely operate slower than hakks written in pure hakkML.

Some of the higher level constructs supported by the basic API

  • IF/ENDIF - For conditional evaluation of expressions.
  • GOSUB/RETURN - Provides a way to call subroutines, including the ability to pass parameters and get a return result.
  • WHILE/ENDWHILE - Provides a basic looping mechanism.
  • FOR/NEXT - A familiar looping construct.

Hello World

Using the basic builder API, hello world looks like this:

 Block.system(0, 1);

 output("Hello World!");


The builder generates the following hakkML for you:

 name: "hello_world"
   - core:
   - mem: {name: "__sys__", loc: [0, 1]}
     - out: "Hello World!"

The basic API provides some convience capabilities for utilizing traditional higher level programming techniques. These are not robust, but sufficient enough for the scope of what hakks are intended for.

Advanced API

The advanced API exposes direct access to each instruction supported by the VM, but allows Dart's available tooling (like the Dart Editor) to help with the development process.

Hello World

Using the builder, you would construct the Hakk like this.

final myHakk = 
  hakk('hello_world', (){
      B.entry('main', 0, 1);
      codeBlock('main', (){
        I.out('Hello World');

The builder generates the hakkML and outputs:

name: hello_world
  - core:
  - entry: {name: "main", loc : [0, 1]}
    - out: "Hello World"

Saving The Result

Using the example above, this library provides a helper function to save the generated source code:

saveToFile('my_hakk', myHakk);

You could of course use dart:io to save, or do whatever else you want with the source code.


  • Improved memory management during compilation. Memory reference clobbering should be very rare, if at all.
  • Added unit tests for basic API


Basic API changes

  • Added an MMU which conserves memory allocs during compilation.
  • Added some unit tests for the basic API

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  hakk_builder: "^0.2.2"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:hakk_builder/advanced.dart';

      import 'package:hakk_builder/basic.dart';

      import 'package:hakk_builder/lang.dart';
Version Uploaded Documentation Archive
0.2.2 Oct 31, 2014 Go to the documentation of hakk_builder 0.2.2 Download hakk_builder 0.2.2 archive
0.2.1 Oct 29, 2014 Go to the documentation of hakk_builder 0.2.1 Download hakk_builder 0.2.1 archive
0.2.0 Oct 27, 2014 Go to the documentation of hakk_builder 0.2.0 Download hakk_builder 0.2.0 archive
0.1.0 Oct 21, 2014 Go to the documentation of hakk_builder 0.1.0 Download hakk_builder 0.1.0 archive
0.0.1+5 Oct 21, 2014 Go to the documentation of hakk_builder 0.0.1+5 Download hakk_builder 0.0.1+5 archive
0.0.1+4 Oct 21, 2014 Go to the documentation of hakk_builder 0.0.1+4 Download hakk_builder 0.0.1+4 archive
0.0.1+3 Oct 21, 2014 Go to the documentation of hakk_builder 0.0.1+3 Download hakk_builder 0.0.1+3 archive
0.0.1+2 Oct 21, 2014 Go to the documentation of hakk_builder 0.0.1+2 Download hakk_builder 0.0.1+2 archive
0.0.1+1 Oct 11, 2014 Go to the documentation of hakk_builder 0.0.1+1 Download hakk_builder 0.0.1+1 archive
0.0.1 Oct 11, 2014 Go to the documentation of hakk_builder 0.0.1 Download hakk_builder 0.0.1 archive


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
89 / 100
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/lang.dart: Target of URI doesn't exist: 'package:petitparser/beta.dart'.


  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Error(s) in lib/lang.dart: Target of URI doesn't exist: 'package:petitparser/beta.dart'.

  • Homepage does not exists.

    We were unable to access http://hakk.it at the time of the analysis.

  • Package is too old.

    The package was released more than two years ago.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 16 errors 29 hints.

    Make sure that the imported libraries are not in conflict. Error(s) in lib/lang.dart: Target of URI doesn't exist: 'package:petitparser/beta.dart'.

    Strong-mode analysis of lib/src/basic/_expression_node.dart failed with the following error:

    line: 19 col: 30
    The argument type '(_ExpressionNode) → Null' can't be assigned to the parameter type '(dynamic) → void'.

    Similar analysis of the following files failed:

    • lib/src/basic/_operator_class.dart (error)
    • lib/src/lang/grammar.dart (error)
    • lib/advanced.dart (hint)
    • lib/basic.dart (hint)
    • lib/src/advanced/blocks.dart (hint)
    • lib/src/advanced/instructions.dart (hint)
    • lib/src/basic/_code_block.dart (hint)
    • lib/src/basic/_hakk_object.dart (hint)
    • lib/src/basic/_mem_unit.dart (hint)
    • lib/src/basic/_mmu.dart (hint)
    • lib/src/basic/block.dart (hint)
    • lib/src/basic/debugger.dart (hint)
    • lib/src/basic/flow_control.dart (hint)
    • lib/src/basic/predefines.dart (hint)
    • lib/src/lang/parser.dart (hint)
  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use hakk_builder.dart.


Package Constraint Resolved Available
Direct dependencies
logging >=0.9.2 <0.10.0 0.9.3 0.11.3+1
petitparser >=1.2.2 <2.0.0 1.7.6
Transitive dependencies
matcher 0.12.2+1
path 1.6.0
stack_trace 1.9.2
Dev dependencies
args >=0.12.0+2
unittest >=0.11.0+4