DEV Community

Cover image for x10 means x = 10: I built my own programming language
Vect
Vect

Posted on AI-assisted

x10 means x = 10: I built my own programming language

I'm building a programming language called Vect. Its whole idea: stop repeating yourself. In Vect, this:

x10
Enter fullscreen mode Exit fullscreen mode

declares x = 10. No let, no =, no semicolon. And this:

(c.a+b)
Enter fullscreen mode Exit fullscreen mode

means c = a + b. Every computation names its destination first.

Why?

Every language I used made me type the same boilerplate forever. So with my team we stripped it all out: 4-space indents instead of braces, one statement per line, memory/file/hardware primitives in the core language instead of libraries you have to go find.

A real program

vectfn add.a, b
    (sum.a+b)
    rtn sum

vectfn main
    (result.add 25, 75)
    echo result
main()
Enter fullscreen mode Exit fullscreen mode

Output: 100. Loops look like this:

counter0
lo10
    echo counter
    (counter.counter+1)
Enter fullscreen mode Exit fullscreen mode

It's actually real

This isn't screenshots of a dream — there's a compiler, vectc, written in Zig. It compiles .vt files to bytecode and runs them on a stack VM. You can even watch it think:

vectc --dump func.vt
Enter fullscreen mode Exit fullscreen mode

And install it in two commands with Scoop:

scoop bucket add vect https://github.com/MerixCipher/scoop-bucket
scoop install vect/vectc
Enter fullscreen mode Exit fullscreen mode




What's next

v0.2.4 brings a timing primitive and string escapes, then v0.2.5 starts the big one: rewriting the lexer in Vect itself.

Links: website · docs · GitHub · YouTube

Tell me what looks wrong — I read everything.

Top comments (0)