oliverjonasson

Halppp - programming language

Created March 19, 2023

Description

While exploring new places where I can go with programming. I realized I'm writing a lot of code but it's defined by someone else. I wanna try writing in a language where I've decided everything.

Defining features

Inspiration

Sample of syntax

definately not everything

//inc => vector (include c++ headers)
get => print, option
get => library/[module, othermodule]

class Parent
protected
    int age = 0
private
    string name = ""
    Parent => do return
pub
    fn as_str => string doremi $"{name} - {age}"
;

class SomeClass<T> => Parent
    T generic_value
    SomeClass string name, int age, T generic_value =>
        this->name = name
        this->age = age
        this->generic_value = generic_value
    ;
pub
    fn get_age => int doremi name
    fn get_generic<T> T
         return generic_value
    ;
;

fn main =>
    println($"Arguments count: {argc}")
    for i until 100
        println(i)
    ;
    let elements = {1,2,3,4,5,6,7}
    foreach i,e in elements
        println($"{i + e}")
    ;
    let a = rand() % 2 == 0 ? Some("hello world!") : None<string>()
    select hello from a
        println(hello)
    ;
    if a.is_none()
        println("a is nothing")
    ;
    elif a.is_some()
        println("a is something")
    ;
    else
        println("this shouldn't happen")
    ;
    if a.is_none() doremi 0
    elif a.is_some() doremi 1
    else do println("this shouldn't happen")
;