feat: add !x as logical NOT expression#26
Merged
Conversation
Now that ^ handles Err-wrap, ! is free for its expected role:
- !x in expressions parses as UnaryOp::Not (connects to existing OP_NOT)
- !cond{body} negated guard continues to work unchanged
- 5 new tests: parser, interpreter, VM, codegen
Benchmark script comparing ilo's prefix notation against Python-style infix across 25 expression patterns. Results: 21.8% token savings, 42.4% character savings. Nested expressions show the biggest wins — each nesting level saves 2 chars (no parens needed).
- SPEC.md: nesting examples showing how prefix eliminates parentheses - README.md: "Why prefix notation?" section with savings summary - MANIFESTO.md: prefix notation rationale under Token-Conservative All link to research/explorations/prefix-vs-infix/ benchmark. 22% token savings, 42% character savings across 25 expression patterns.
danieljohnmorris
added a commit
that referenced
this pull request
Feb 27, 2026
* feat: add !x as logical NOT expression
Now that ^ handles Err-wrap, ! is free for its expected role:
- !x in expressions parses as UnaryOp::Not (connects to existing OP_NOT)
- !cond{body} negated guard continues to work unchanged
- 5 new tests: parser, interpreter, VM, codegen
* docs: update test count to 176
* docs: update OPEN.md with ^ sigil for Err references
* research: add prefix-vs-infix token/char savings exploration
Benchmark script comparing ilo's prefix notation against Python-style
infix across 25 expression patterns. Results: 21.8% token savings,
42.4% character savings. Nested expressions show the biggest wins —
each nesting level saves 2 chars (no parens needed).
* docs: add prefix notation savings to SPEC, README, and MANIFESTO
- SPEC.md: nesting examples showing how prefix eliminates parentheses
- README.md: "Why prefix notation?" section with savings summary
- MANIFESTO.md: prefix notation rationale under Token-Conservative
All link to research/explorations/prefix-vs-infix/ benchmark.
22% token savings, 42% character savings across 25 expression patterns.
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
!xas logical NOT expression in the parserUnaryOp::NotAST node,OP_NOTVM opcode, interpreter eval, and Python codegen!cond{body}negated guard continues to work (disambiguated by{following)Depends on: #25 (Err-wrap sigil migration
!→^)Test plan
cargo clippy -- -W clippy::all— cleancargo test— all 176 tests pass (163 unit + 13 integration)!xparses asExpr::UnaryOp { op: Not, ... }(parser test)!xin let binding:y=!xworks (parser test)f x:b>b;!xwithtrue→false(interpreter + VM tests)(not x)in Python codegen!cond{body}negated guard still works