Skip to content

Conversation

@jberthold
Copy link
Member

No description provided.

Instead of equations for a single function, `K` helper functions are
generated and the equations split (more or less?) evenly among them (by
modulo of the Int-valued IDs).

```
syntax TypeInfo ::= lookupType0(Int) [function, total]
syntax TypeInfo ::= lookupType1(Int) [function, total]
...
syntax Typeinfo ::= lookupType<K-1>(Int) [function, total]

rule lookupType(ty(N)) => lookupType0(N) requires N %Int K ==Int 0
rule lookupType(ty(N)) => lookupType1(N) requires N %Int K ==Int 1
...
rule lookupType(ty(N)) => lookupType<K-1>(N) requires N %Int K ==Int <K - 1>
```
Each of the helpers gets its own default, all are total.
```
rule lookupType0(_) => TypeInfoVoidType [owise] // (i.e., not found)
rule lookupType1(_) => TypeInfoVoidType [owise] // (i.e., not found)
...
```

For a given `TypeMapping(ty('X), 'TYPEINFO)`, the `X` is divided by `K`
and the equation is generated in the respective helper function `m = 'X
%Int K`
```
  rule lookupType'<m>('X) => 'TYPEINFO
```

This stratification is applied for the `lookupAlloc` and `lookupTy`
functions.
…876)

When using pointer offsets followed by dereferencing, the returned
result is an array (subslice of the original).
In some cases, the value is used as a single element, for instance by
projecting out a field. This PR adds a special rule for the field
projection case to proceed using the head element in those cases.

Related: #771
@jberthold jberthold marked this pull request as ready for review December 4, 2025 07:11
@jberthold jberthold merged commit 30eb09b into feature/p-token Dec 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants