Parsing linked list without recursion?
I'm writing ksy file for the pci configuration space.

Among other things it includes a linked list of registers called capabilities list.

To quote from the spec:
> Certain capabilities added to PCI after the publication of revision 2.1 are supported by
> adding a set of registers to a linked list called the Capabilities List. This optional data
> structure is indicated in the PCI Status Register by setting the Capabilities List bit (bit 4) to
> indicate that the Capabilities Pointer is located at offset 34h. This register points to the first
> item in the list of capabilities.
> Each capability in the list consists of an 8-bit ID field assigned by the PCI SIG, an 8 bit
> pointer in configuration space to the next capability, and some number of additional
> registers immediately following the pointer to implement that capability. Each capability
> must be DWORD aligned. The bottom two bits of all pointers (including the initial pointer
> at 34h) are reserved and must be implemented as 00b although software must mask them to
> allow for future uses of these bits. A pointer value of 00h is used to indicate the last
> capability in the list.

![Capabilities list diagram](https://user-images.githubusercontent.com/5587093/34911104-9db51154-f8d3-11e7-8079-0b2a6ad9a779.png)

Simplified version of what I'm doing right now is:
```yaml
meta:
  id: caplist

instances:
  capabilities_pointer:
    type: u1
    pos: 0x34

  capabilities_list:
    type: capability
    pos: capabilities_pointer
    if: capabilities_pointer != 0

types:
  capability:
    seq:
    - id: id
      type: u1
    - id: next_pointer
      type: u1
    instances:
      next:
        type: capability
        pos: next_pointer
        io: _root._io
        if: next_pointer != 0
```
But this grammar uses recursion.
It's not a problem in this particular case, because most of pcie devices will have from 3 to 5 or maybe 7 capabilities, and any realistic pcie conf space will have less than 100 of those.

But nonetheless: is it possible to parse such format without recursion?

PCI spec could be found at: https://www.xilinx.com/Attachment/PCI_SPEV_V3_0.pdf capabilities section are on the page 230

Edit: added caplist diagram