endbasic-core 0.13.0

The EndBASIC programming language - core
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
// EndBASIC
// Copyright 2026 Julio Merino
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

//! Common compilers for callable arguments.

use super::SymbolKey;
use super::syms::LocalSymtable;
use crate::ast::{ArgSpan, CallSpan, Expr, VarRef};
use crate::bytecode::{self, Register};
use crate::callable::CallableMetadata;
use crate::compiler::codegen::Codegen;
use crate::compiler::exprs::{compile_expr, compile_expr_as_type};
use crate::compiler::syms::{self, SymbolPrototype, TempSymtable};
use crate::compiler::{Error, Result};
use crate::reader::LineCol;
use crate::{ArgSep, ArgSepSyntax, ExprType, RepeatedTypeSyntax, SingularArgSyntax};
use std::rc::Rc;

/// Validates an argument separator against the expected syntax.
///
/// `syn` contains the details about the separator syntax that is accepted.
///
/// `end_ok` indicates whether an `ArgSep::End` is acceptable.  This is true for repeated
/// arguments, where `End` terminates the argument sequence, and false for singular arguments,
/// where `End` should only be accepted by `ArgSepSyntax::End`.
///
/// `is_last` indicates whether this is the last separator in the command call and is used
/// only for diagnostics purposes.
///
/// `sep` and `sep_pos` are the details about the separator being validated.
fn validate_syn_argsep(
    md: &Rc<CallableMetadata>,
    syn: &ArgSepSyntax,
    end_ok: bool,
    is_last: bool,
    sep: ArgSep,
    sep_pos: LineCol,
) -> Result<()> {
    debug_assert!(
        (!is_last || sep == ArgSep::End) && (is_last || sep != ArgSep::End),
        "Parser can only supply an End separator in the last argument"
    );

    match syn {
        ArgSepSyntax::Exactly(exp_sep) => {
            debug_assert!(*exp_sep != ArgSep::End, "Use ArgSepSyntax::End");
            if sep == *exp_sep || (sep == ArgSep::End && end_ok) {
                Ok(())
            } else {
                Err(Error::CallableSyntax(sep_pos, md.as_ref().clone()))
            }
        }

        ArgSepSyntax::OneOf(exp_seps) => {
            if sep == ArgSep::End {
                if end_ok {
                    return Ok(());
                }
                return Err(Error::CallableSyntax(sep_pos, md.as_ref().clone()));
            }

            let mut found = false;
            for exp_sep in *exp_seps {
                debug_assert!(*exp_sep != ArgSep::End, "Use ArgSepSyntax::End");
                if sep == *exp_sep {
                    found = true;
                    break;
                }
            }
            if !found {
                return Err(Error::CallableSyntax(sep_pos, md.as_ref().clone()));
            }
            Ok(())
        }

        ArgSepSyntax::End => {
            debug_assert!(is_last);
            Ok(())
        }
    }
}

/// Pre-allocates one local variable for a command output argument, setting its to its default
/// value.
fn define_new_arg(
    symtable: &mut LocalSymtable<'_>,
    vref: &VarRef,
    pos: LineCol,
    codegen: &mut Codegen,
) -> Result<()> {
    let key = SymbolKey::from(&vref.name);
    let vtype = vref.ref_type.unwrap_or(ExprType::Integer);
    let reg = symtable
        .put_local(key, SymbolPrototype::Scalar(vtype))
        .map_err(|e| Error::from_syms(e, pos))?;
    codegen.emit_default(reg, vtype, pos);
    Ok(())
}

/// Pre-allocates local variables for command output arguments.
pub(super) fn define_new_args(
    span: &CallSpan,
    md: &Rc<CallableMetadata>,
    symtable: &mut LocalSymtable<'_>,
    codegen: &mut Codegen,
) -> Result<()> {
    let Some(syntax) = md.find_syntax(span.args.len()) else {
        return Err(Error::CallableSyntax(span.vref_pos, md.as_ref().clone()));
    };

    let mut arg_iter = span.args.iter();

    for syn in syntax.singular.iter() {
        match syn {
            SingularArgSyntax::RequiredValue(_details, _exp_sep) => {
                arg_iter.next().expect("Args and their syntax must advance in unison");
            }

            SingularArgSyntax::RequiredRef(details, _exp_sep) => {
                let ArgSpan { expr, .. } =
                    arg_iter.next().expect("Args and their syntax must advance in unison");

                if let Some(Expr::Symbol(span)) = expr
                    && let Err(syms::Error::UndefinedSymbol(..)) =
                        symtable.get_local_or_global(&span.vref)
                    && details.define_undefined
                {
                    let key = SymbolKey::from(&span.vref.name);
                    if symtable.get_callable(&key).is_some() {
                        continue;
                    }
                    define_new_arg(symtable, &span.vref, span.pos, codegen)?;
                }
            }

            SingularArgSyntax::OptionalValue(_details, _exp_sep) => {
                arg_iter.next();
            }

            SingularArgSyntax::AnyValue(_details, _exp_sep) => {
                arg_iter.next();
            }
        };
    }

    if let Some(syn) = syntax.repeated.as_ref()
        && let RepeatedTypeSyntax::VariableRef = syn.type_syn
    {
        for arg in arg_iter {
            let Some(Expr::Symbol(span)) = &arg.expr else {
                continue;
            };

            let Err(syms::Error::UndefinedSymbol(..)) = symtable.get_local_or_global(&span.vref)
            else {
                continue;
            };

            let key = SymbolKey::from(&span.vref.name);
            if symtable.get_callable(&key).is_some() {
                continue;
            }

            define_new_arg(symtable, &span.vref, span.pos, codegen)?;
        }
    }

    Ok(())
}

/// Compiles the arguments of a callable invocation.
///
/// Returns the first register containing the compiled arguments and the source positions for all
/// allocated registers.  The register layout depends on the callable's syntax:
///
/// * Singular arguments and variable repeated arguments use `VarArgTag` tag registers followed by
///   optional value registers.  See the `VarArgTag` documentation for details.
///
/// * Repeated arguments of type `TypedValue` with `Exactly` separators and `!allow_missing` use
///   plain value registers without tags, since the type and separator are statically known.  The
///   callable can use `Scope::nargs()` to determine the total number of register slots.
///
/// The caller *must* invoke `define_new_args` beforehand when compiling arguments for commands.
/// This separate function is necessary to pre-allocate local variables for any output arguments.
///
/// TODO(jmmv): The `md` metadata is passed by value, not because we want to, but because it's
/// necessary to appease the borrow checker.  The `md` is obtained from the `symtable` in the caller
/// (as a reference) to perform various validations so it is not possible to pass it as input along
/// `symtable`.  An alternative would be to take the symbol `key` as a parameter here and perform
/// another lookup from the symtable.  Or maybe we could make `Metadata` objects static by
/// eliminating the `MetadataBuilder` and pass a static reference here.
pub(super) fn compile_args(
    span: CallSpan,
    md: Rc<CallableMetadata>,
    symtable: &mut TempSymtable<'_, '_>,
    codegen: &mut Codegen,
) -> Result<(Register, Vec<LineCol>)> {
    let key_pos = span.vref_pos;

    let Some(syntax) = md.find_syntax(span.args.len()) else {
        return Err(Error::CallableSyntax(key_pos, md.as_ref().clone()));
    };

    let mut scope = symtable.temp_scope();

    // Collects the source position for each register slot allocated below, in allocation order.
    // This is used to populate the UPCALL instruction's arg_linecols metadata so that callables
    // can query the source position of any argument via `Scope::get_pos`.
    let mut arg_linecols: Vec<LineCol> = Vec::new();

    let input_nargs = span.args.len();
    let mut arg_iter = span.args.into_iter().peekable();

    for (i, syn) in syntax.singular.iter().enumerate() {
        let end_ok = i + 1 == syntax.singular.len()
            && input_nargs == syntax.singular.len()
            && syntax.repeated.as_ref().is_some_and(|syn| !syn.require_one);

        match syn {
            SingularArgSyntax::RequiredValue(details, exp_sep) => {
                let ArgSpan { expr, sep, sep_pos } =
                    arg_iter.next().expect("Args and their syntax must advance in unison");
                let arg_pos = expr.as_ref().map(|e| e.start_pos()).unwrap_or(sep_pos);

                match expr {
                    None => return Err(Error::CallableSyntax(key_pos, md.as_ref().clone())),
                    Some(expr) => {
                        let temp_value = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                        arg_linecols.push(arg_pos);
                        compile_expr_as_type(codegen, symtable, temp_value, expr, details.vtype)?;
                        validate_syn_argsep(
                            &md,
                            exp_sep,
                            end_ok,
                            arg_iter.peek().is_none(),
                            sep,
                            sep_pos,
                        )?;
                    }
                }
            }

            SingularArgSyntax::RequiredRef(details, exp_sep) => {
                let ArgSpan { expr, sep, sep_pos } =
                    arg_iter.next().expect("Args and their syntax must advance in unison");
                let arg_pos = expr.as_ref().map(|e| e.start_pos()).unwrap_or(sep_pos);

                match expr {
                    None => return Err(Error::CallableSyntax(key_pos, md.as_ref().clone())),
                    Some(Expr::Symbol(span)) => {
                        let (reg, vtype) = match symtable.get_local_or_global(&span.vref) {
                            Ok((reg, SymbolPrototype::Array(info))) if details.require_array => {
                                (reg, info.subtype)
                            }
                            Ok((reg, SymbolPrototype::Scalar(vtype))) if !details.require_array => {
                                (reg, vtype)
                            }
                            Ok((_, _)) => {
                                return Err(Error::CallableSyntax(span.pos, md.as_ref().clone()));
                            }
                            Err(e @ syms::Error::UndefinedSymbol(..)) => {
                                if !details.define_undefined {
                                    return Err(Error::from_syms(e, span.pos));
                                }
                                let key = SymbolKey::from(&span.vref.name);
                                if symtable.get_callable(&key).is_some() {
                                    return Err(Error::NotAFunction(span.pos, span.vref));
                                }
                                unreachable!("Caller must use define_new_args first for commands");
                            }
                            Err(e) => return Err(Error::from_syms(e, span.pos)),
                        };
                        let temp = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                        arg_linecols.push(arg_pos);
                        codegen.emit(bytecode::make_load_register_ptr(temp, vtype, reg), arg_pos);
                        validate_syn_argsep(
                            &md,
                            exp_sep,
                            end_ok,
                            arg_iter.peek().is_none(),
                            sep,
                            sep_pos,
                        )?;
                    }
                    Some(expr) => {
                        return Err(Error::CallableSyntax(expr.start_pos(), md.as_ref().clone()));
                    }
                }
            }

            SingularArgSyntax::OptionalValue(details, exp_sep) => {
                // The `CallSpan` is optimized (for simplicity) to not carry any arguments at all
                // when callables are invoked without arguments.  This leads to a little
                // inconsistency though: a call like `PRINT ;` carries two arguments whereas
                // `PRINT` carries none (instead of one).  Deal with this here.
                let (expr, sep, sep_pos) = match arg_iter.next() {
                    Some(ArgSpan { expr, sep, sep_pos }) => (expr, sep, sep_pos),
                    None => (None, ArgSep::End, key_pos),
                };
                let arg_pos = expr.as_ref().map(|e| e.start_pos()).unwrap_or(sep_pos);

                let temp_tag = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                arg_linecols.push(arg_pos);
                let tag = match expr {
                    None => bytecode::VarArgTag::Missing(sep),
                    Some(expr) => {
                        let temp_value = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                        arg_linecols.push(arg_pos);
                        compile_expr_as_type(codegen, symtable, temp_value, expr, details.vtype)?;
                        bytecode::VarArgTag::Immediate(sep, details.vtype)
                    }
                };
                validate_syn_argsep(&md, exp_sep, end_ok, arg_iter.peek().is_none(), sep, sep_pos)?;
                codegen.emit(bytecode::make_load_integer(temp_tag, tag.make_u16()), arg_pos);
            }

            SingularArgSyntax::AnyValue(details, exp_sep) => {
                // The `CallSpan` is optimized (for simplicity) to not carry any arguments at all
                // when callables are invoked without arguments.  This leads to a little
                // inconsistency though: a call like `PRINT ;` carries two arguments whereas
                // `PRINT` carries none (instead of one).  Deal with this here.
                let (expr, sep, sep_pos) = match arg_iter.next() {
                    Some(ArgSpan { expr, sep, sep_pos }) => (expr, sep, sep_pos),
                    None => {
                        if !details.allow_missing {
                            return Err(Error::CallableSyntax(key_pos, md.as_ref().clone()));
                        }
                        (None, ArgSep::End, key_pos)
                    }
                };
                let arg_pos = expr.as_ref().map(|e| e.start_pos()).unwrap_or(sep_pos);

                let temp_tag = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                arg_linecols.push(arg_pos);
                let tag = match expr {
                    None => bytecode::VarArgTag::Missing(sep),
                    Some(expr) => {
                        let temp_value = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                        arg_linecols.push(arg_pos);
                        let etype = compile_expr(codegen, symtable, temp_value, expr)?;
                        bytecode::VarArgTag::Immediate(sep, etype)
                    }
                };
                validate_syn_argsep(&md, exp_sep, end_ok, arg_iter.peek().is_none(), sep, sep_pos)?;
                codegen.emit(bytecode::make_load_integer(temp_tag, tag.make_u16()), arg_pos);
            }
        };
    }

    // Variable (repeated) arguments can be represented in two different layouts depending on
    // the type syntax and separators.
    //
    // When `use_plain_values` is true (TypedValue + Exactly separators + !allow_missing), each
    // argument occupies a single register containing only the value.  The type and separator are
    // known at compile time, so no tags are needed.  The callable uses `Scope::nargs()` to
    // determine how many repeated values are present, starting from the offset after all
    // singular arguments.
    //
    // When `use_plain_values` is false, each argument is represented as 1 or 2 consecutive
    // registers.  The first register always contains a `VarArgTag`, which indicates the type of
    // separator following the argument and, if an argument is present, its type.  The second
    // register is only present if there is an argument.  The caller must iterate over all tags
    // until it finds `ArgSep::End`.
    if let Some(syn) = syntax.repeated.as_ref() {
        let mut min_nargs = syntax.singular.len();
        if syn.require_one {
            min_nargs += 1;
        }
        if input_nargs < min_nargs {
            return Err(Error::CallableSyntax(key_pos, md.as_ref().clone()));
        }

        let use_plain_values = matches!(syn.type_syn, RepeatedTypeSyntax::TypedValue(_))
            && !syn.allow_missing
            && matches!(syn.sep, ArgSepSyntax::Exactly(_));

        if use_plain_values {
            while let Some(ArgSpan { expr, sep, sep_pos }) = arg_iter.next() {
                let vtype = match syn.type_syn {
                    RepeatedTypeSyntax::TypedValue(vtype) => vtype,
                    _ => unreachable!(),
                };
                let arg_pos = expr.as_ref().map(|e| e.start_pos()).unwrap_or(sep_pos);
                validate_syn_argsep(&md, &syn.sep, true, arg_iter.peek().is_none(), sep, sep_pos)?;

                match expr {
                    None => {
                        return Err(Error::CallableSyntax(arg_pos, md.as_ref().clone()));
                    }
                    Some(expr) => {
                        let temp_value = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                        arg_linecols.push(arg_pos);
                        compile_expr_as_type(codegen, symtable, temp_value, expr, vtype)?;
                    }
                }
            }
        } else {
            if arg_iter.peek().is_none() {
                let temp_tag = scope.alloc().map_err(|e| Error::from_syms(e, key_pos))?;
                arg_linecols.push(key_pos);
                let tag = bytecode::VarArgTag::Missing(ArgSep::End);
                codegen.emit(bytecode::make_load_integer(temp_tag, tag.make_u16()), key_pos);
            }

            while arg_iter.peek().is_some() {
                let ArgSpan { expr, sep, sep_pos } =
                    arg_iter.next().expect("Args and their syntax must advance in unison");

                let arg_pos = expr.as_ref().map(|e| e.start_pos()).unwrap_or(sep_pos);
                let temp_tag = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                arg_linecols.push(arg_pos);
                validate_syn_argsep(&md, &syn.sep, true, arg_iter.peek().is_none(), sep, sep_pos)?;

                let tag = match expr {
                    None => {
                        if !syn.allow_missing {
                            return Err(Error::CallableSyntax(arg_pos, md.as_ref().clone()));
                        }
                        bytecode::VarArgTag::Missing(sep)
                    }

                    Some(expr) => match syn.type_syn {
                        RepeatedTypeSyntax::AnyValue => {
                            let temp_value =
                                scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                            arg_linecols.push(arg_pos);
                            let etype = compile_expr(codegen, symtable, temp_value, expr)?;
                            bytecode::VarArgTag::Immediate(sep, etype)
                        }

                        RepeatedTypeSyntax::TypedValue(vtype) => {
                            let temp_value =
                                scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                            arg_linecols.push(arg_pos);
                            compile_expr_as_type(codegen, symtable, temp_value, expr, vtype)?;
                            bytecode::VarArgTag::Immediate(sep, vtype)
                        }

                        RepeatedTypeSyntax::VariableRef => {
                            let Expr::Symbol(span) = expr else {
                                return Err(Error::CallableSyntax(arg_pos, md.as_ref().clone()));
                            };

                            let (reg, vtype) = match symtable.get_local_or_global(&span.vref) {
                                Ok((reg, SymbolPrototype::Scalar(vtype))) => (reg, vtype),
                                Ok((_, SymbolPrototype::Array(_))) => {
                                    return Err(Error::CallableSyntax(
                                        arg_pos,
                                        md.as_ref().clone(),
                                    ));
                                }
                                Err(syms::Error::UndefinedSymbol(..)) => {
                                    let key = SymbolKey::from(&span.vref.name);
                                    if symtable.get_callable(&key).is_some() {
                                        return Err(Error::NotAFunction(span.pos, span.vref));
                                    }
                                    unreachable!(
                                        "Caller must use define_new_args first for commands"
                                    );
                                }
                                Err(e) => return Err(Error::from_syms(e, span.pos)),
                            };
                            let temp = scope.alloc().map_err(|e| Error::from_syms(e, arg_pos))?;
                            arg_linecols.push(arg_pos);
                            codegen
                                .emit(bytecode::make_load_register_ptr(temp, vtype, reg), arg_pos);
                            bytecode::VarArgTag::Pointer(sep)
                        }
                    },
                };
                codegen.emit(bytecode::make_load_integer(temp_tag, tag.make_u16()), arg_pos);
            }
        }
    }

    if arg_iter.peek().is_some() {
        debug_assert!(arg_iter.next().is_some(), "Args and their syntax must advance in unison");
        return Err(Error::CallableSyntax(key_pos, md.as_ref().clone()));
    }

    let first_reg = scope.first().map_err(|e| Error::from_syms(e, key_pos))?;
    Ok((first_reg, arg_linecols))
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::CallableMetadataBuilder;
    use crate::callable::RepeatedSyntax;
    use crate::compiler::syms::GlobalSymtable;
    use std::borrow::Cow;
    use std::collections::HashMap;

    #[test]
    fn test_compile_args_materializes_missing_repeated_tag() -> Result<()> {
        let pos = LineCol { line: 1, col: 1 };
        let md = CallableMetadataBuilder::new("OUT")
            .with_syntax(&[(
                &[],
                Some(&RepeatedSyntax {
                    name: Cow::Borrowed("arg"),
                    type_syn: RepeatedTypeSyntax::AnyValue,
                    sep: ArgSepSyntax::Exactly(ArgSep::Short),
                    require_one: false,
                    allow_missing: false,
                }),
            )])
            .test_build();

        let mut codegen = Codegen::default();

        let upcalls = HashMap::default();
        let mut global = GlobalSymtable::new(upcalls);
        let mut local = global.enter_scope();
        let (first_reg, arg_linecols) = {
            let mut symtable = local.frozen();
            compile_args(
                CallSpan { vref: VarRef::new("OUT", None), vref_pos: pos, args: vec![] },
                md,
                &mut symtable,
                &mut codegen,
            )?
        };
        assert_eq!(Register::local(0).unwrap(), first_reg);
        assert_eq!(vec![pos], arg_linecols);

        let upcall = codegen.get_upcall(SymbolKey::from("OUT"), None, pos)?;
        let addr = codegen.emit(bytecode::make_upcall(upcall, first_reg), pos);
        codegen.set_arg_linecols(addr, arg_linecols);
        codegen.emit(bytecode::make_eof(), LineCol { line: 0, col: 0 });

        let image = codegen.build_image(HashMap::default(), HashMap::default(), vec![])?;
        assert_eq!(
            vec![
                "0000:   LOADI       R64, 0              ; 1:1".to_owned(),
                "0001:   UPCALL      0, R64              ; 1:1, OUT".to_owned(),
                "0002:   EOF                             ; 0:0".to_owned(),
            ],
            image.disasm()
        );
        Ok(())
    }
}