Skip to content

Conversation

@biqiboqi
Copy link
Contributor

No description provided.

This was linked to issues Oct 23, 2025
@bialger
Copy link
Contributor

bialger commented Oct 23, 2025

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@bialger bialger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all, titanic work has been done. It is fantastic, and I don't see any major architecture flaws. Although there is a place to grow and some simple mistakes. Please fix them. Really good job, thank you.

@bialger
Copy link
Contributor

bialger commented Nov 10, 2025

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +11 to +35
const Token& VectorTokenStream::Peek(size_t k) {
const Token* token = TryPeek(k);

if (token != nullptr) {
return *token;
}

if (last_ != nullptr) {
return *last_;
}

if (!tokens_.empty()) {
return *tokens_.back();
}

throw std::out_of_range("VectorTokenStream::Peek out of range");
}

TokenPtr VectorTokenStream::Consume() {
if (index_ < tokens_.size()) {
last_ = tokens_[index_].get();
return std::move(tokens_[index_++]);
}

last_ = nullptr;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid returning references to tokens that were moved out

In VectorTokenStream::Consume the stream stores a raw pointer to the consumed token (last_ = tokens_[index_].get();) and then moves the unique_ptr out to the caller. Peek and LastConsumed later return *last_ when no tokens remain. If the caller releases the returned TokenPtr—which destroys the token—the stored pointer dangles and the next call to Peek or LastConsumed dereferences freed memory. The stream should either retain ownership of consumed tokens or avoid returning pointers/references after handing ownership to the caller; otherwise calls past EOF have undefined behavior.

Useful? React with 👍 / 👎.

Copy link
Contributor

@bialger bialger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot review

Copy link

Copilot AI commented Nov 10, 2025

@bialger I've opened a new pull request, #26, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a comprehensive parser infrastructure for the Ovum compiler. It implements a type system with type references, nullability tracking, AST nodes for expressions/statements/declarations, visitor patterns for AST traversal, parser states, diagnostics with severity levels, and Pratt parsing infrastructure.

  • Introduces TypeReference class with qualified names, type arguments, nullability, and resolution tracking
  • Implements full AST node hierarchy including expressions, statements, declarations, and class members
  • Adds visitor pattern support with WalkVisitor, ConstWalkVisitor, PrintVisitor, StructuralValidator, and LintVisitor
  • Provides diagnostic system with severity levels, error collection, and filtering capabilities
  • Sets up parser state machine infrastructure and token stream handling

Reviewed Changes

Copilot reviewed 231 out of 231 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/parser/types/TypeReference.{hpp,cpp} Core type reference implementation with qualified names, type arguments, nullability, and resolution
lib/parser/types/Param.{hpp,cpp} Parameter representation with name and type
lib/parser/types/Nullable.{hpp,cpp} Nullable type wrapper
lib/parser/ast/nodes/* Complete AST node hierarchy for expressions, statements, declarations, and class members
lib/parser/ast/visitors/* Visitor pattern implementations for AST traversal and validation
lib/parser/diagnostics/* Diagnostic system with severity levels, collection, and filtering
lib/parser/states/* Parser state machine infrastructure (headers only, implementations pending)
lib/parser/pratt/* Pratt parser infrastructure for expression parsing
lib/parser/tokens/* Token stream and source tracking utilities

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +16
[[nodiscard]] std::string GetName();

[[nodiscard]] TypeReference GetType();
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GetName() and GetType() methods should return const references for consistency with the rest of the codebase. These methods copy the entire std::string and TypeReference objects on every call, which is inefficient.

Change:

[[nodiscard]] std::string GetName();
[[nodiscard]] TypeReference GetType();

To:

[[nodiscard]] const std::string& GetName() const;
[[nodiscard]] const TypeReference& GetType() const;

Copilot uses AI. Check for mistakes.
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.

Implement AST structure Create and push parser interfaces

3 participants