Skip to content

[Feature] Support recursion in Amber #818

@Ph0enixKM

Description

@Ph0enixKM

Is your feature request related to a problem? Please describe.
Currently Amber doesn't support recursion. We want to add this support to Amber.

Describe the solution you'd like
There are multiple key changes that have to be made for it to work:

  1. Variables declared in functions require local prefix. Add this prefix to VarStmtFragment. Also update declaration.rs file to use the newly updated VarStmtFragment.
  2. FunctionDeclaration structures stored in ParserMetadata require to store information whether or not this function is already being parsed (there might be a situation where the previous function wasn't parsed but we recursively call the same function)
  3. Error message for recursion should be removed
  4. We should extensively test recursive functions for:
  • pre order flow
  • in order flow
  • post order flow
  • multiple (two is enough) recursive function calls in a single function (shallow recursion for quick script completion)
  • multiple different (two is enough) recursive function calls in a single function (shallow recursion for quick script completion)
  • multiple variants of recursion (calling the same function with the same parameter types, with different parameter types)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions