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

[ENHANCEMENT] Change AST nodes to be dataclasses #38

Description

@ElBe-Plaq

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BREAKING CHANGEMarks a breaking change.EnhancementEnhances something already existing.

Type

No type

Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions