Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

[ENHANCEMENT] Change AST nodes to be dataclasses #38

Open
1 of 3 tasks
ElBe-Plaq opened this issue Apr 15, 2023 · 0 comments
Open
1 of 3 tasks

[ENHANCEMENT] Change AST nodes to be dataclasses #38

ElBe-Plaq opened this issue Apr 15, 2023 · 0 comments
Assignees
Labels
BREAKING CHANGE Marks a breaking change. Enhancement Enhances something already existing.

Comments

@ElBe-Plaq
Copy link
Member

ElBe-Plaq commented Apr 15, 2023

Change the AST module to use nodes of the following scheme:

@dataclass
class Node:
    name: str
    type: str # One of the possible types, sub classes such as VariableNode can use base types here
    value: Any
    below: Optional[List["Node"]] = None # Requires from __future__ import annotations
    arguments: Optional[List[str]] = None # Subject to of change, arguments or annotations for the node

Sub classes will inherit from them but use a custom __init__ method. The nodes of a program are stored in a list containing one item, the program node (contains args passed from the shell and the name of the file).

Todo:

  • Change existing nodes
  • Add more nodes
  • Rewrite parser to use new AST system
@ElBe-Plaq ElBe-Plaq added Enhancement Enhances something already existing. BREAKING CHANGE Marks a breaking change. labels Apr 15, 2023
@ElBe-Plaq ElBe-Plaq added this to the Release Beta v0.0.10 milestone Apr 15, 2023
@ElBe-Plaq ElBe-Plaq self-assigned this Apr 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
BREAKING CHANGE Marks a breaking change. Enhancement Enhances something already existing.
Projects
No open projects
Status: In Progress
Status: 0.0.10
Development

No branches or pull requests

1 participant