ASSEMBLY AS A HIGH LEVEL LANGUAGE An attempt to move forward, while going backward. This is a brainstorm of how assembly could be used in an easier way while retaining its essence. The "perfect" hello world program, in assembly: .... bits 64 section .text global _start _start: mov rdx, len mov rsi, msg mov rdi, 1 mov rax, 1 syscall mov rdi, 0 mov rax, 60 syscall section .rodata msg: db "hello world", 10 len: equ $-msg .... How could we make this better? Maybe this: .... // no need to declare text sections...of course, everything can be overridden. _start: mov rdx, len \ len > 10 // apply a constraint to the constant mov rsi, msg \ rsi > 10 // or apply it to the register. these constraints are built up while assembly and are checked with each call to _start mov rdi, 1 mov rax, 1 syscall mov rdi, 0 mov rax, 60 syscall // no need to declare data sections by default. data is collected and allocated // as necessary. msg: db "hello world", 10 len: equ $-msg .... Now let's rebuild it using these new ideas: .... main: mov rdx, len \ len == string_length(msg) mov rsi, msg \ string_contains(msg, "hello") call print print: call _memcpy call _write _memcpy: mov rdi, 1 mov rax, 1 syscall _write: mov rdi, 0 mov rax, 60 syscall // These functions are compiled first because they are required to run at // compile time as compile-time functions, but are included in the final binary // if used outside of compile-time. string_length: mov rdx, msg // rest of the code to count the length // return the length string_contains: // code... msg: db "hello world", 10 len: equ $-msg .... So we get any compile-time functions we want, while remaining ultra small and fast. The language has some builtins, the most important being ==, >, <, >=, and <=. Defining these for strings and numbers is all that's required. More complex comparisons against structures can be done using compile-time functions. Structures and enums should use the same syntax as we expect today: .... struct Player { name: string; position: Point; health: int64 >= 0 // We can constraint what values we expect on the integer. } // enums MUST specify size. enum Cardinals: int8 >= 0 { NORTH, SOUTH, EAST, WEST } ....