Skip to content

v1.0.0 - Expressions, Parsing etc (WIP)#3

Draft
dhedey wants to merge 526 commits intomainfrom
develop
Draft

v1.0.0 - Expressions, Parsing etc (WIP)#3
dhedey wants to merge 526 commits intomainfrom
develop

Conversation

@dhedey
Copy link
Owner

@dhedey dhedey commented Sep 29, 2025

No description provided.

@dhedey dhedey marked this pull request as draft September 29, 2025 14:37
dhedey and others added 28 commits November 22, 2025 17:00
- Change `SourceParseBuffer<'a>` from a struct to a type alias:
  `type SourceParseBuffer<'a> = ParseBuffer<'a, Source>`
- Move Source-specific methods (parse, parse_optional, parse_terminated,
  call, parse_virtual_empty_stream) to `impl ParseBuffer<'a, Source>`
- Add Output-specific parse methods to `impl ParseBuffer<'a, Output>`
- Rename generic ParseBuffer methods to avoid conflicts:
  parse -> parse_generic, call -> call_generic,
  parse_terminated -> parse_terminated_generic
- Make `ParseStreamStack` generic over `K` and `'a`, with Source-specific
  methods in a separate impl block
…018rdQvBWCgaBLgwwaiQYVLG

refactor: Remove SourceParseBuffer wrapper, make it a type alias
refactor: Input lives in interpreter
Create a detailed plan for incrementally migrating binary operations
from the HandleBinaryOperation trait pattern to method resolution.

First PR scope:
- Add BinaryOperationInterface infrastructure
- Extend HierarchicalTypeData with resolve_own_binary_operation
- Migrate addition (+) for UntypedInteger as proof of concept
- Maintain backwards compatibility with existing tests
- Document resolved design decisions for RHS type, symmetric ops, and spans
- Add detailed analysis of short-circuiting operator challenges
- Recommend excluding && and || from initial migration
- Outline possible future approaches for lazy evaluation
Implement the first phase of the BinaryOperation migration:

- Add BinaryOperationInterface struct for binary operation method resolution
- Add BinaryOperationCallContext for passing operation context
- Update MethodResolver trait to take rhs_kind parameter
- Update BinaryOperationBuilder to resolve methods with both LHS and RHS kinds
- Implement addition (+) for UntypedInteger + UntypedInteger via new system
- Add create_binary_interface! macro for building BinaryOperationInterface

The new method resolution flow:
1. Evaluate both operands (currently using Owned ownership)
2. Resolve method with both LHS kind and RHS kind
3. If method found, execute via BinaryOperationInterface
4. Otherwise, fall back to legacy HandleBinaryOperation trait

Currently only UntypedInteger + UntypedInteger uses the new path.
Mixed cases (e.g., 1 + 5u16) still use the legacy system.

This establishes the infrastructure for incrementally migrating
all binary operations to the new method resolution pattern.
…UntypedInteger

- Add BinaryOperationInterface struct to type_data.rs for binary operation method resolution
- Add BinaryOperationCallContext to interface_macros.rs for passing operation context
- Extend define_interface! macro to support binary_operations module
- Add create_binary_interface! macro for generating binary operation interfaces
- Update value_frames.rs BinaryOperationBuilder to use BinaryOperationInterface
- Implement paired_operation for UntypedInteger that handles all paired binary operations
  (+, -, *, /, %, ==, !=, <, >, <=, >=) with proper type coercion
- Add backward-compatible macro rule for define_interface! without binary_operations

The new interface properly handles:
- UntypedInteger + UntypedInteger (stays untyped)
- UntypedInteger + TypedInteger (coerces to typed)

Error message for integer/float comparison is now more specific about the type mismatch.
…ace!

Remove backward-compatible macro rule that auto-generated empty
binary_operations. All define_interface! invocations now explicitly
include `pub(crate) mod binary_operations {}` section.
Move output(), output_if_some(), and unsupported() methods from WrappedOp
directly onto the Operation trait. Update HandleBinaryOperation trait and
all implementations to take &PairedBinaryOperation and &IntegerBinaryOperation
instead of WrappedOp<...>.

This simplifies the code by removing an unnecessary wrapper type.
dhedey added 30 commits January 7, 2026 22:51
Replace all the value wrappers with leaf-based specific values
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.

2 participants