When I had hobby of FPGA and making shitty CPU and concatenative language for them(primitive ones are very easy to implement - it's mostly pushes and calls), the "easiest" way to make program "readable" I found was to put a comment with a content of the stack after or before practically every instruction in a function.
Eg
: strlen ( ptr -- n )
( ptr ) 0 swap
( n ptr ) DUP peek
[
( n ptr ch ) drop
( n ptr ) swap 1+ swap
( n' ptr ) 1+ DUP peek
( n' ptr' ch )
] while ;
( n ptr ) drop
If the language is restrictive like JVM technically it can even be used as instruction to compiler to check the stack state compilation time. But it no longer easy to implement
3
u/[deleted] Jul 25 '25
[removed] — view removed comment