diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2024-02-04 16:46:20 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2024-02-04 16:46:20 -0800 |
| commit | 17face3633686e374aa0859271ccf462a48e60aa (patch) | |
| tree | 6a5482717ef1b8194ccf347a6d8af06d664902cd /bytecode/encoding.h | |
| parent | d940187fd8720e0ab3c00e5a6a7ae8f181c7752d (diff) | |
| download | sml-17face3633686e374aa0859271ccf462a48e60aa.tar.zst | |
Rewrite the bytecode interpreter in Rust.
Diffstat (limited to 'bytecode/encoding.h')
| -rw-r--r-- | bytecode/encoding.h | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/bytecode/encoding.h b/bytecode/encoding.h deleted file mode 100644 index 9d4da14..0000000 --- a/bytecode/encoding.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef _ENCODING_H_ -#define _ENCODING_H_ - -#include <stdbool.h> -#include <stdint.h> - -#include "byte_slice.h" -#include "value.h" - -typedef uint8_t local; - -#define NUM_LOCALS 8 - -// An arg can be a value or a constant. -struct arg { - local local; - value constant; -}; - -enum opcode { - OALLOC = 1, - OCALL = 2, - OPOKE = 3, - OPEEK = 4, - OSHUF = 5, - OEXIT = 6, -}; - -struct op { - enum opcode code; - union { - struct { - local out; - struct arg size; - } alloc; - struct { - uint8_t offset; - local pointer; - struct arg value; - } poke; - struct { - local out; - uint8_t offset; - struct arg value; - } peek; - struct { - local out; - struct arg value; - } shuf; - struct { - struct arg value; - } exit; - }; -}; - -struct result { - struct op op; - int n; -}; - -struct result parse(uint8_t_slice); - -#endif |
