Skip to content

[eval] Move expression evaluator from CLI to Decimo core library#259

Merged
forfudan merged 1 commit into
mainfrom
dev
Jul 9, 2026
Merged

[eval] Move expression evaluator from CLI to Decimo core library#259
forfudan merged 1 commit into
mainfrom
dev

Conversation

@forfudan

@forfudan forfudan commented Jul 9, 2026

Copy link
Copy Markdown
Owner

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.

Copilot AI left a comment

Copy link
Copy Markdown

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 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 exports decimo.eval / decimo.evaluate.
  • Updates the CLI calculator to reuse decimo.expression instead 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.

@forfudan forfudan changed the title [eval] Move expression evaluator from CLI to Decimo core package [eval] Move expression evaluator from CLI to Decimo core library Jul 9, 2026
@forfudan forfudan merged commit 29929c0 into main Jul 9, 2026
12 checks passed
@forfudan forfudan deleted the dev branch July 9, 2026 21:45
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