Skip to content

Feature: Semantic validation#11

Open
martin-azpillaga wants to merge 10 commits intoStrumenta:masterfrom
martin-azpillaga:feature-semantic-validation
Open

Feature: Semantic validation#11
martin-azpillaga wants to merge 10 commits intoStrumenta:masterfrom
martin-azpillaga:feature-semantic-validation

Conversation

@martin-azpillaga
Copy link
Copy Markdown

@martin-azpillaga martin-azpillaga commented Jun 7, 2023

Inspired by issue #1, this PR implements semantic validation for identifiers in the calc language.

Following the rules of most mainstream programming languages, identifiers need to be declared before usage, and cannot be declared multiple times.

In the case of calc, the editor will report errors when:

  • More than one input statements declare the same identifier
    inputs
  • An identifier used in a calculation expression has not been declared in previous lines
    calculations
  • An identifier used in an output statement has not been declared in previous lines
    outputs

Instead of an ANTLR listener or visitor, a simple parse tree walker is used to check the relevant nodes.
Additional validation tests have been added to the parsingTest file.
The features of the editor are now documented in the readme.

@martin-azpillaga martin-azpillaga changed the title Feature semantic validation Feature: Semantic validation Jun 8, 2023
@martin-azpillaga martin-azpillaga marked this pull request as ready for review June 8, 2023 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant