Redefined proposed syntax for preprocessor in TODO.org

This commit is contained in:
2023-11-05 16:20:14 +00:00
parent a3d8e5ee1f
commit aadb21853a

View File

@@ -35,37 +35,30 @@ Something to consider is /static/ and /dynamic/ "linking" i.e.:
+ 63 bit references user code (not a lot of loss in precision) + 63 bit references user code (not a lot of loss in precision)
+ Easy to check if a reference is a library reference or a user + Easy to check if a reference is a library reference or a user
code reference by checking "sign bit" (negativity) code reference by checking "sign bit" (negativity)
* TODO Inlining subroutines :ASM: * TODO Preprocessing directives :ASM:
Essentially consider the following situation Like in FASM or NASM where we can give certain helpful instructions to
the assembler. I'd use the ~%~ symbol to designate preprocessor
directives.
** TODO Constants
Essentially a directive which assigns some literal to a symbol as a
constant. Something like
#+begin_src asm #+begin_src asm
global _start %const:n:20%end
a:
push.word 1
push.word 1
plus.word
print.word
ret
_start:
call a
halt
#+end_src #+end_src
What I'd like to be able to do is:
Where you'd refer to the definition using ~$n~. The assembler will
look for symbols like ~$n~ and insert definitions it finds for them.
Can be useful when defining data type bounds and other useful constants.
2023-11-04: You could even put full program instructions for a
constant potentially
#+begin_src asm #+begin_src asm
global _start %const:print-1:
%inline:a:
push.word 1 push.word 1
push.word 1
plus.word
print.word print.word
ret
%end %end
_start:
%inline a
halt
#+end_src #+end_src
This is equivalent in LOC, but in terms of the actually output which when referred to ~$print-1~ would just insert the bytecode given inline.
instructions the second is smaller in size, doesn't use any jumps nor
does it use the call stack. As a result it's a linear program.
* Completed * Completed
** DONE Write a label/jump system :ASM: ** DONE Write a label/jump system :ASM:
Essentially a user should be able to write arbitrary labels (maybe Essentially a user should be able to write arbitrary labels (maybe