Skip to content

Syntax Tree: Add validations #93

@meganindya

Description

@meganindya

Description

generateFromSnapshot function in src/syntax/tree/syntaxTree.ts generates the syntax tree from a snapshot. However, there is no construct to validate the input snapshot.

Also, attachment checking functions and attaching functions have no connections — the idea is that the connection checks will externally be performed first before the connection is made. In this way, if a connection is known to be valid, we can skip the additional cost of reverifying. However, it would be nice to optionally check connection validity before the connections, as a direct step and not a two step process in certain use cases.

Objectives

Snapshot validation

  • Add a function to validate an input snapshot
    • Validate shape of snapshot components; refer ITreeSnapshotData, ITreeSnapshotExpression, ITreeSnapshotStatement, ITreeSnapshotBlock (discuss your approach before proceeding as the interfaces listed as TypeScript specific and JavaScript doesn't have them)
    • Validate attachments — whether the snapshot describes valid instruction or argument attachments
  • Call the snapshot validation function before generating the syntax tree from it, in generateFromSnapshot

Connection validation

  • Add an optional flag to attachArgumentCheck to indicate whether to perform a validation
  • Add an optional flag to attachInstructionBelowCheck to indicate whether to perform a validation
  • Add an optional flag to attachInstructionInsideCheck to indicate whether to perform a validation

This can be done as two separate PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions