Skip to content

VirtLang v3.1.0

Choose a tag to compare

@dev-kas dev-kas released this 20 May 12:24
· 63 commits to master since this release

VirtLang-Go v3.1.0 Release Notes: AST Source Code Metadata & Enhanced Diagnostics Foundation

We are excited to announce the release of VirtLang-Go v3.1.0, just a short while after our major v3.0.0 update! This release focuses on enriching the internal representation of your VirtLang-Go programs by embedding detailed source code metadata directly into every Abstract Syntax Tree (AST) node.

This foundational enhancement paves the way for future advancements in tooling, debugging, and runtime error reporting, making the VirtLang-Go ecosystem even more robust and developer-friendly.

Major Features & Enhancements

  • AST Source Code Metadata:
    • Benefit: Every node in the Abstract Syntax Tree now carries precise information about its origin in the source code. This is a crucial internal improvement for current and future VirtLang-Go tooling.
    • Details: Each AST node (from individual expressions and statements up to the entire program) now includes:
      • Filename: The name of the source file.
      • StartLine & StartColumn: The 1-based line and column where the node begins.
      • EndLine & EndColumn: The 1-based line and column where the node ends.
    • This detailed metadata will enable more accurate runtime error reporting (pinpointing issues directly to the responsible code), facilitate the development of debuggers, linters, and other advanced static analysis tools.

Core Interpreter Enhancements

  • Parser Updates:
    • The Parser now requires a filename upon initialization (parser.New(filename)). This filename is then propagated to all AST nodes it creates.
    • All parsing functions have been updated to meticulously capture and store the start and end positions (line/column) of the language constructs they parse, embedding this into the SourceMetadata of the generated AST nodes.
  • AST Structure (ast package):
    • A new ast.SourceMetadata struct has been introduced.
    • This SourceMetadata struct is now embedded within every AST node type defined in ast/ast.go.

API Changes (for Go Consumers)

  • parser.New() Constructor:
    • The constructor for parser.Parser now requires a filename string as an argument: func New(filename string) *Parser.
    • Migration Action (if your Go code directly creates Parser instances): You will need to update calls from parser.New() to parser.New("your_filename_here"). For testing or in contexts where a real filename isn't available, a placeholder like "test_source" can be used.

Testing

  • Existing unit tests for the parser (parser_test.go) and evaluator (evaluator_test.go) have been updated to reflect the new parser.New(filename) constructor signature, ensuring continued test coverage.

Known Issues and Limitations

  • None specific to this v3.1.0 feature. The primary impact of this change is internal and foundational for future work.

Upgrade Notes

  • This release is backwards-compatible for VirtLang-Go language users; existing VirtLang-Go scripts will continue to compile and run without modification.
  • Go developers directly using the parser.New() function will need to update their code to pass a filename, as noted in the "API Changes" section.
  • This release builds directly upon the error reporting enhancements of v3.0.0.

Getting Started

Refer to the README.md and the generated DOCS.md for information on how to use the interpreter or contribute to the project. The DOCS.md has also been updated to accurately reflect the latest API for the errors package.

Acknowledgements

Thank you to @dev-kas for this swift and significant enhancement to VirtLang-Go's core infrastructure!