1 · Syntax & math
File header
Every .vt file starts with the init block, then function definitions, then a call:
vt.init
mvga.vth
(main)
branch
vectfn main
...
main()
vt.init prepares the runtime, (main) selects the entry point, branch transfers control. Blocks are 4-space indented, one statement per line, no semicolons, no braces.
Variables
Compact assignment: trailing digits are the value, no spaces, no keywords.
x10 cmt x = 10
count100 cmt count = 100
timer0 cmt timer = 0
msg"hi" cmt string assignment
Re-assigning works the same way: running0 sets running = 0. Floats use a dot: y3.14. Using a name that was never assigned is a runtime error with a line number.
Math — target notation
All arithmetic uses (target.expression). The target is written first, then the expression after a dot:
(c.a+b) cmt c = a + b
(total.c*2) cmt total = c * 2
(ballX.ballX + ballDX) cmt velocity update
(root.sqrt.val) cmt square root of val
(shlRes.bit shl a, 2) cmt 10 << 2 = 40
(shrRes.bit shr b, 1) cmt 20 >> 1 = 10
(inv.bit not v) cmt flip all bits
(r.a AND b) cmt bitwise / logical AND
(r.a OR b) cmt OR
(r.a XOR b) cmt exclusive OR
| Group | Operators |
|---|---|
| Arithmetic | + - * / % |
| Comparison | == != < <= > >= |
| Word logic | AND OR XOR inside target expressions |
Mixing ints and floats promotes to float: (m.a+y) with a10, y3.14 gives 13.14. Division by zero halts the program immediately.
Comments
cmt starts a comment that runs to end of line — full-line or trailing:
cmt a full line note
x10 cmt trailing note