Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.
This repository was archived by the owner on Nov 11, 2021. It is now read-only.

Macro naming convension for porth.porth #130

@mjdr

Description

@mjdr

Right now macros in porth.porth refer to addresses of corresponding objects
And they de referenced as needed

Proposal:

Template for names of addresses:

&{name}

So, macros that gets value of single cell object can be implemented like this:

macro {name}
  &{name} @64
end

And for writing single cell values, like this (not sure about syntax):

macro ={name}
  &{name} !64
end

With #129 this code

macro push-op // type operand -- 
  ops-count @64 sizeof(Op) * ops +
  dup Op.operand rot swap !64
  Op.type !64
  ops-count inc64
end

transforms into this

macro push-op // type operand -- 
  ops-count &ops[]
  dup Op.operand rot swap !64
  Op.type !64
  &ops-count inc64
end

A lot more readable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions