syntax v2

introduce a new, more ergonomic syntax for haku
not all features are implemented just yet. still missing:

- custom tags (non-True/False)
- color literals
- lists
This commit is contained in:
りき萌 2024-08-27 20:43:14 +02:00
parent a3e5e8bd10
commit 2595bf0d82
21 changed files with 2844 additions and 1062 deletions

View file

@ -17,6 +17,8 @@ pub enum Opcode {
// Duplicate existing values.
/// Push a value relative to the bottom of the current stack window.
Local, // (index: u8)
/// Set the value of a value relative to the bottom of the current stack window.
SetLocal, // (index: u8)
/// Push a captured value.
Capture, // (index: u8)
/// Get the value of a definition.
@ -24,12 +26,8 @@ pub enum Opcode {
/// Set the value of a definition.
SetDef, // (index: u16)
/// Drop `number` values from the stack.
/// <!-- OwO -->
DropLet, // (number: u8)
// Create literal functions.
Function, // (params: u8, then: u16), at `then`: (capture_count: u8, captures: [(source: u8, index: u8); capture_count])
Function, // (params: u8, then: u16), at `then`: (local_count: u8, capture_count: u8, captures: [(source: u8, index: u8); capture_count])
// Control flow.
Jump, // (offset: u16)