Skip to content

Feature: Support nesting of macro calls #40

@cakevm

Description

@cakevm

Support calling macros within other macros calls to enhance flexibility and composability. For example MACRO1(MACRO2()) should be possible. This should also work with different argument variations MACRO1(MACRO2(0x1), 0x2).

Example:

#define macro TWO_PARMS_TO_STACK(a, b) = takes(0) returns(2) {
  <a>
  <b>
}

#define macro ADD(ops) = takes(2) returns(1) {
    <ops>
    add
}

#define macro MAIN() = takes(0) returns(1) {
  ADD(TWO_PARMS_TO_STACK(0x01, 0x01))
}

A similar feature was already proposed for huff-rs here: huff-language/huff-rs#265

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