Skip to content

Insert a Ret at end of asm-interp? #28

@dvanhorn

Description

@dvanhorn

So asm-interp goes to a little bit of trouble to add in any missing pieces to make the code it's given runnable. For example, if you don't define any labels, it will invent one at the start of the instructions and call it.

We don't currently do something similar for the Ret, which is needed in order to return a value back from the interpreter. This leads to crashes when students forget to add a Ret. Should we just insert one on at the end unconditionally? I don't see any harm in doing this, other than not forcing students to think about the return instruction, which will be needed in their compiler. If we also added an implicit seq, you could then write things like (asm-interp (Mov rax 42)) => 42, which is maybe nice to have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions