Conversation
There was a problem hiding this comment.
Pull request overview
This PR promotes the CLI calculator’s arithmetic expression implementation into the Decimo core library as decimo.expression, exposing a stable high-level API (decimo.eval / decimo.evaluate) while updating the CLI and tests to consume the shared engine.
Changes:
- Introduces
src/decimo/expression/as a first-class core module (tokenizer, shunting-yard parser, RPN evaluator) and exportsdecimo.eval/decimo.evaluate. - Updates the CLI calculator to reuse
decimo.expressioninstead of maintaining its own copy. - Adds/updates expression test suite wiring and documents the new API in the changelog.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test.sh | Adds an expression test suite and includes it in the core (decimo) test group and suite listing. |
| tests/expression/test_tokenizer.mojo | Updates imports to use decimo.expression for tokenizer symbols. |
| tests/expression/test_parser.mojo | Updates imports to use decimo.expression and consolidates parser/tokenizer imports. |
| tests/expression/test_evaluator.mojo | Updates evaluator tests to use decimo.expression APIs (evaluate/tokenize/parse/evaluate_rpn/final_round). |
| tests/expression/test_error_handling.mojo | Updates imports to call into decimo.expression for error-path tests. |
| src/decimo/prelude.mojo | Adds import decimo / import decimo as dm to the prelude exports. |
| src/decimo/expression/tokenizer.mojo | Adjusts module wording/imports for core usage and expands whitespace handling to include \n/\r; adds variable-awareness via optional known-variable map. |
| src/decimo/expression/parser.mojo | Updates module wording to reflect core expression engine usage. |
| src/decimo/expression/evaluator.mojo | Adds eval(...) as the high-level entry point with optional variables; keeps evaluate(...) as a backwards-compatible alias; updates imports to core-relative modules. |
| src/decimo/expression/init.mojo | New public module surface for decimo.expression, re-exporting tokenizer/parser/evaluator APIs and constants. |
| src/decimo/init.mojo | Exports eval and evaluate from decimo.expression at the top level. |
| src/cli/calculator/repl.mojo | Switches REPL tokenizer helpers to import from decimo.expression. |
| src/cli/calculator/engine.mojo | Switches engine pipeline (tokenize/parse/evaluate/final_round) to use decimo.expression. |
| src/cli/calculator/init.mojo | Re-exports expression engine symbols from decimo.expression for CLI package consumers. |
| docs/changelog.md | Documents the new decimo.expression module, decimo.eval, variables support, and newline/CR whitespace behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR promotes the CLI calculator’s arithmetic expression implementation into the Decimo core library as
decimo.expression, exposing a stable high-level API (decimo.eval/decimo.evaluate) while updating the CLI and tests to consume the shared engine.