Skip to content
develop
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

logo

[WIP] Hades Programming Language

Build Status License

Welcome!

This is the official repository for the reference implementation of the Hades Programming Language (standard library & interpreter).

Hello world

with console from std:io
console.out("Hello world")

Pipelines

with list fixed from std:collections
with console from std:io

var fruits = list.of({"Apple", "Banana", "Mango", "Kiwi", "Avocado"})

fruits
|> map(??, {x => x.toLower()})
|> filter({x => x.startsWith("a")})
//if ?? is not in the parameters, the method is inserted as the first parameter
|> forEach(??, {x => console.out(x)})

Function guards

with console from std:io

func myFunction(a int) requires a < 10
    console.out("a is smaller than 10")
end

func myFunction(a int) requires a > 10
    console.out("a is greater than 10")
end

myFunction(5) // a is smaller than 10
myFunction(17) // a is greater than 10

Actors

with msg from std:io
with sleep from std:time

func ping()
    receive(m)
        {:ping, data} => {_ =>
            sleep.seconds(1)
            send(data, :pong)
        }
    end
    ping()
end

func pong()
    receive(m)
        {:pong, data} => {_ =>
            sleep.seconds(1)
            send(data, :ping)
        }
    end
    pong()
end

var pingPid = spawn({_ => ping()}
var pongPid = spawn({_ => pong()}

send(pingPid, {:ping, pongPid})

Fibonacci sequence

with console from std:io

func fib(n)
    if((n is 0) or (n is 1))
        put n
    end
    
    put fib(n-1) + fib(n-2)
end

fib(10) |> console.out

Optional static typing

with console from std:io

func fib(n int64) -> int64
    if((n is 0) or (n is 1))
        put n
    end
    
    put fib(n-1) + fib(n-2)
end

fib(10) |> console.out

Getting Started

Learning Hades and writing your first programs.

Installing Hades

Instructions for downloading HadesLang and/or embedding it into your programs.

Basic Syntax

Hades basics and quick introduction into the language.

Coding Conventions

Current coding style for HadesLang.

References

Language Spec

The official HadesLang specification.

Package Documentation

Documentation and definition of the Hades standard library.

Tool Documentation

Documentation for HadesLang tools.

Examples

Examples of Hades in use.