Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Self/self-reference incomplete #140

Closed
phorward opened this issue Jul 6, 2024 · 0 comments · Fixed by #142
Closed

bug: Self/self-reference incomplete #140

phorward opened this issue Jul 6, 2024 · 0 comments · Fixed by #142
Assignees
Labels
bug Something isn't working

Comments

@phorward
Copy link
Member

phorward commented Jul 6, 2024

This bug came from further investigation into #127.


A: @<E, I: Self> {
    Ident '=' Expect<I>  # (1)
    E
}

A<Int>                   # (2)
A<Int, Self>             # (3)

Expected result:

  • Expect<P> is a prelude base parselet, no instance
  • A<E, I: Self> is a base parselet, no instance
  • (2) A<E: Int, I: Self> derives (1) Expect<A<E: Int, I: Self>>
  • (3) A<E: Int, I: __main__> derives (1) Expect<A<E: Int, I: __main__>>

Current (buggy) implementation:

  • ImlParseletModel is created once for Expect and A
  • ImlParselet (and ImlRefParselet) is created for
    • Expect<P>
    • Expect<Self>
    • A<E, I: Self>
    • A<E: Int, I: Self> where Self should refer to the self-recusive parselet instance, but this information is lost, and
    • A<E: Int, I: Self> where Self refers to __main__, and Self currently is __main__ everywhere, so that imaginary
      • A<E: Int, I: __main__> and
      • Expect<__main__> is constructed and executed.
  • The derives are only created from the parselet which is currently compiled or finalized:
    • src/compiler/iml/imlprogram.rs 187,43: let derived = parselet.derive(current).unwrap();
    • src/tokay/src/compiler/iml/imlvalue.rs 401,63: ImlValue::Parselet(parselet) => match parselet.derive(current.0) {
@phorward phorward added the bug Something isn't working label Jul 6, 2024
@phorward phorward self-assigned this Sep 11, 2024
@phorward phorward pinned this issue Sep 11, 2024
@phorward phorward changed the title Self/self-reference currently unclear bug: Self/self-reference currently unclear Sep 11, 2024
@phorward phorward changed the title bug: Self/self-reference currently unclear bug: Self/self-reference incomplete Sep 11, 2024
phorward added a commit to phorward/tokay that referenced this issue Sep 13, 2024
@phorward phorward mentioned this issue Sep 16, 2024
3 tasks
phorward added a commit that referenced this issue Sep 17, 2024
* Add more trace and some comments

* Step 1

* Step 2

* Possible solution for #140

* Push through offset on generic

* Handle SelfToken in left-recursion finalization correctly

* Add some tests for generic Self
@phorward phorward unpinned this issue Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant