#+title: TODOs #+author: Aryadev Chavali #+date: 2023-11-02 #+startup: noindent * WIP Write assembler in a different language :ASM: While the runtime and base library needs to deal with only binary, the assembler has to deal with string inputs and a larger variety of bugs. As the base library is written in C, and is all that is necessary to write a program that targets the virtual machine, we could realistically use another language to write the assembler in via FFI with minimal pain. Languages in the competition: + C++ + Rust + Python 2024-04-14: Chose C++ cos it will require the least effort to rewrite the currently existing codebase while still leveraging some less efficient but incredibly useful features. ** DONE Write Lexer ** WIP Write Preprocesser ** TODO Write parser * TODO Better documentation [0%] :DOC: ** TODO Comment coverage [0%] *** TODO ASM [0%] **** TODO asm/lexer.h **** TODO asm/parser.h ** TODO Write a specification * TODO Preprocessing directives :ASM: 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 Macros Essentially constants expressions which take literal parameters (i.e. tokens) and can use them throughout the body. Something like #+begin_src asm %macro(name)(param1 param2 param3) ... %end #+end_src Where each parameter is substituted in a call at preprocessing time. A call should look something like this: #+begin_src asm $name 1 2 3 #+end_src and those tokens will be substituted literally in the macro body. * Completed ** DONE Write a label/jump system :ASM: Essentially a user should be able to write arbitrary labels (maybe through ~label x~ or ~x:~ syntax) which can be referred to by ~jump~. It'll purely be on the assembler side as a processing step, where the emitted bytecode purely refers to absolute addresses; the VM should just be dealing with absolute addresses here. ** DONE Allow relative addresses in jumps :ASM: As requested, a special syntax for relative address jumps. Sometimes it's a bit nicer than a label. ** DONE Calling and returning control flow :VM: :ASM: When writing library code we won't know the addresses of where callers are jumping from. However, most library functions want to return control flow back to where the user had called them: we want the code to act almost like an inline function. There are two ways I can think of achieving this: + Some extra syntax around labels (something like ~@inline