Typed language compiling to JavaScript & LLVM
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
dist
doc
examples
ext
lib
scratch
share
src
test
.gitignore
.npmignore
.travis.yml
Jakefile
LICENSE
README.md
jake
notes.js
package.json
test-grammar.js

README.md

Build Status Coverage Status

Hummingbird

Hummingbird is a language inspired by JavaScript, ML, and Swift. It features/will feature a usable type system with ML-inspired type inference, JavaScript code generation, and a concise syntax designed for readability.

Example

An obligatory hello world:

let welcome: String = "Hello "
func sayHello () -> Boolean {
  console.log(welcome + "world")
  return true
}
sayHello()

For more examples see the specification and manual.

Getting started

The quickest way to get started is to clone the repository and use that directly. This language is actively being built out, so many features you would expect may be missing.

git clone git@github.com:dirk/hummingbird.git
cd hummingbird
# Install the dependencies
npm install
# We're actively transitioning to TypeScript, so right now you'll need to
# call the `compile` or `watch` tasks to compile the sources to JavaScript.
# nb. We use a custom invocation script for Jake that exposes the V8
#     garbage collector.
./jake # Default task, calls ts:compile
# Run the command-line tool with no arguments to see the options
bin/hb
# To see the parsed and type-checked AST of a file
bin/hb inspect examples/simple.js
# To compile and run a file
bin/hb run examples/simple.js

Contributing

To contribute just fork the repository, commit your changes on a branch on your fork, and create a pull request!

If you're planning to introduce significant changes/features, then we highly suggest creating an issue with the "Proposal" label ahead-of-time so that everyone can contribute to a discussion before starting to commit development time. We really don't want to have to needlessly turn down pull requests!

Specification

The Hummingbird specification is designed to be both human- and machine-readable. It is organized into sections for each syntactical and semantic feature of the language.

Each feature has a <spec name="..."></spec> block containing the Hummingbird example source and the expected JavaScript output. These can then be parsed and a full suite of unit tests generated in test/spec/.

# Generating the spec tests
npm run gen-spec
# Running those tests
npm run test-spec

Native compilation (via LLVM)

The LLVM-based native compiler is still in its pre-alpha stages and should be considered very unstable. Getting started with it requires a few more steps on top of the basic setup:

# The BDW garbage collector is required for building and running, so
# make sure you have it installed. On a Mac with Homebrew you will
# want to do:
brew install bdw-gc
# Call the Jake default task if you haven't already to build the
# standard library "extension" objects
./jake
# Then call the native compiler with a source file
bin/hbn examples/simple.hb
# And run the compiled binary
./a.out

License

Released under the Modified BSD License. See LICENSE for details.