πŸš€ MELP in 30 Minutes

In this guide you will learn MELP from scratch and write working programs in seven steps β€” all of them in your browser.

Step 0: Getting a Compiler (1 min)

Use the Web IDE. It runs the real self-hosted MELP compiler, built to WASM, in your browser β€” every step below works there, with nothing to install.

⚠️ There is no public download yet. The compiler repository is not open to the outside, so there is no binary to fetch and no package to install. Rather than print a command that 404s, we point you at the thing that actually runs today.

When the repository opens, a local build will need clang-22 and libgmp-dev, and the steps will appear on the install page.
Step 1: Hello World (3 min)

Your first MELP program:

-- hello.mlp
numeric function main()
    println("Hello MELP!")
    return 0
end function

Compile and run:

cp hello.mlp /tmp/.melp_compile_src
melp_compiler > hello.ll
clang-22 -O2 build/shim.o hello.ll -o hello -lm -lgmp
./hello
Hello MELP!
πŸ’‘ Three things to notice straight away: the return type comes first (numeric function), comments start with --, and blocks close by echoing their opener (end function) rather than with a brace.
Step 2: Variables and Loops (5 min)
numeric function main()
    numeric age  = 25
    string  name = "Ali"
    println(name & " is " & str(age) & " years old")

    -- count from 1 to 5
    numeric i = 1
    loop i <= 5
        println(str(i))
        i = i + 1
    end loop

    -- factorial
    println("5! = " & str(factorial(5)))
    return 0
end function

numeric function factorial(numeric n)
    if n <= 1 then return 1 end if
    return n * factorial(n - 1)
end function
Ali is 25 years old
1
2
3
4
5
5! = 120
πŸ’‘ Strings are joined with &, not +. There is exactly one loop keyword β€” loop β€” and no while, for or continue.
Step 3: Reading a File (5 min)
numeric function main()
    string content = mlp_fs_read_to_string("/etc/hostname")
    println("Hostname: " & content)
    return 0
end function
Hostname: pardus-81y4
πŸ’‘ mlp_fs_read_to_string reads a file; mlp_fs_write writes one.
Step 4: An HTTP Request (5 min)
numeric function main()
    -- HTTP GET through curl
    string reply = shell_exec("curl -s https://api.github.com/zen")
    println("GitHub Zen: " & reply)
    return 0
end function
GitHub Zen: Avoid administrative distraction.
πŸ’‘ This shells out rather than using a native HTTP client. MELP's standard library is young β€” that is one of the gaps we list openly on the honest map.
Step 5: Struct and Enum (5 min)
struct Point
    numeric x
    numeric y
end struct

enum Color
    Red
    Green
    Blue
end enum

numeric function main()
    Point p = Point(3; 4)
    println("Point: (" & str(p.x) & ", " & str(p.y) & ")")

    Color c = Color.Blue
    println("Color enum: " & str(c))
    return 0
end function
Point: (3, 4)
Color enum: 2
πŸ’‘ Constructor arguments are separated with ;, because , is the decimal mark. There are no classes and no inheritance β€” struct plus free functions covers the same ground.
Step 6: A Web Page (5 min)
numeric function main()
    string html  = "<h1>MELP Web</h1><p>Hello world!</p>"
    string reply = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" & html
    string cmd   = "echo '" & reply & "' | nc -l -p 8888 -q 1 & sleep 1 && echo 'http://localhost:8888'"
    numeric rc   = shell_exec(cmd)
    return 0
end function
http://localhost:8888
Step 7: A Letter to the Future (5 min)

The feature that has no close equivalent in other languages. A debug block turns an assumption into a sentry that runs:

numeric function main()
    numeric member_count = 9998

    debug
        if member_count > 10000 then stop
        -- Past ten thousand members this design may need
        -- a new database architecture. β€” 2026, the first team
    end debug

    println("members: " & str(member_count))
    return 0
end function
members: 9998

Nothing happens today. In ten years, on the day the count passes ten thousand, the program stops and makes someone read the letter β€” instead of silently becoming wrong. Compiled with MELP_RELEASE=1 the block is stripped entirely, at zero cost.

Next Steps

MELP β€” Plain. Scope-based. Fast. πŸš€