{"id":42667810,"url":"https://github.com/oboard/moonbit-eval","last_synced_at":"2026-01-29T10:13:07.012Z","repository":{"id":258478931,"uuid":"873789548","full_name":"oboard/moonbit-eval","owner":"oboard","description":"MoonBit language interpreter","archived":false,"fork":false,"pushed_at":"2026-01-18T16:58:11.000Z","size":3295,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-19T00:46:38.858Z","etag":null,"topics":["moonbit"],"latest_commit_sha":null,"homepage":"https://mooncakes.io/docs/oboard/moonbit-eval","language":"MoonBit","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oboard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-16T18:10:36.000Z","updated_at":"2026-01-18T16:58:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"5343e890-c977-4d79-b832-c3525d57b29c","html_url":"https://github.com/oboard/moonbit-eval","commit_stats":null,"previous_names":["oboard/moonbit-eval"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oboard/moonbit-eval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Fmoonbit-eval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Fmoonbit-eval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Fmoonbit-eval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Fmoonbit-eval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oboard","download_url":"https://codeload.github.com/oboard/moonbit-eval/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oboard%2Fmoonbit-eval/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28875450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T09:47:23.353Z","status":"ssl_error","status_checked_at":"2026-01-29T09:47:19.357Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["moonbit"],"created_at":"2026-01-29T10:13:06.380Z","updated_at":"2026-01-29T10:13:07.005Z","avatar_url":"https://github.com/oboard.png","language":"MoonBit","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MoonBit Eval\n\n[![Version](https://img.shields.io/badge/dynamic/json?url=https%3A//mooncakes.io/assets/oboard/moonbit-eval/resource.json\u0026query=%24.meta_info.version\u0026label=mooncakes\u0026color=yellow)](https://mooncakes.io/docs/oboard/moonbit-eval)\n[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/oboard/moonbit-eval/check.yaml)](https://github.com/oboard/moonbit-eval/actions/workflows/check.yaml)\n[![License](https://img.shields.io/github/license/oboard/moonbit-eval)](https://github.com/oboard/moonbit-eval/blob/main/LICENSE)\n\n## Demo\n🚀 **[REPL Demo](https://github.com/oboard/moonbit-repl/releases/)**\n\n🚀 **[Notebook Demo https://moonbit-notebook.oboard.fun/](https://moonbit-notebook.oboard.fun/)**\n\n## Introduction\nMoonBit Eval is an interpreter for the MoonBit language.\n\nBuilt on top of the [@moonbitlang/parser](https://github.com/moonbitlang/parser) library, it provides comprehensive and accurate MoonBit syntax support, capable of correctly parsing and executing complex MoonBit code structures including functions, structs, lambdas, loops, and more.\n\n## Quick Start\n\n```moonbit\nlet vm = MoonBitVM::new()\n\n// Basic expressions\ninspect(vm.eval(\"1 + 2 * 3\"), content=\"7\")\ninspect(vm.eval(\"\\\"hello\\\" + \\\" world\\\"\"), content=\"hello world\")\n\n// Variables and functions\ninspect(vm.eval(\"let x = 42\"), content=\"()\")\ninspect(vm.eval(\"fn double(n: Int) -\u003e Int { n * 2 }\"), content=\"(n: Int) -\u003e Int\")\ninspect(vm.eval(\"double(x)\"), content=\"84\")\n\n// Control flow\ninspect(vm.eval(\"if x \u003e 40 { \\\"big\\\" } else { \\\"small\\\" }\"), content=\"big\")\n\n// Pattern matching\ninspect(vm.eval(\"match (1, 2) { (a, b) =\u003e a + b }\"), content=\"3\")\n```\n\n## ✨ Features\n\n- ✅ **🥮 Mooncakes Loader**: Load Mooncakes packages at runtime\n- ✅ **Builtin FileSystem Library**: Provides basic file system operations.\n- ✅ **Eval Function**: Allows dynamic evaluation of MoonBit code strings.\n\n## MoonBit Language Support\n\n| Feature | Status | Description |\n|---------|--------|-------------|\n| **Core Language** | | |\n| Basic Types (Int, Bool, String, Double, Char) | ✅ | Full support for primitive types |\n| Expressions (arithmetic, logical, comparison) | ✅ | Complete expression evaluation |\n| Variables (let, let mut) | ✅ | Immutable and mutable variables |\n| Assignment | ✅ | Variable reassignment and shadowing |\n| Multiline strings | ✅ | #\\|syntax for multiline string literals |\n| String interpolation | ✅ | \\{variable} syntax in string literals |\n| Type constraints | ✅ | (value : Type) syntax for explicit typing |\n| **Control Flow** | | |\n| If-else | ✅ | Conditional expressions |\n| For loops | ✅ | C-style for loops with continue/break |\n| While loops | ✅ | While loop constructs with else clause |\n| Loop control | ✅ | Continue and break statements |\n| Guard expressions | ✅ | guard condition else { action } syntax |\n| Is expressions | ✅ | Pattern matching with 'is' operator |\n| Defer expressions | ✅ | defer statement for cleanup code |\n| Return expressions | ✅ | Early return from functions |\n| Raise expressions | ✅ | Exception throwing with raise |\n| Try-catch expressions | ✅ | Exception handling with try-catch |\n| Loop expressions | ✅ | loop pattern matching with break/continue |\n| **Functions** | | |\n| Function definitions | ✅ | Named functions with parameters |\n| Named parameters | ✅ | Named and optional parameters |\n| Lambda expressions | ✅ | Anonymous functions (x =\u003e x * 2) |\n| Closures | ✅ | Proper closure environment capture |\n| Recursive functions | ✅ | Self-referencing function calls |\n| Currying | ✅ | Higher-order function composition |\n| External functions | ✅ | Integration with external calls |\n| Embedded functions | ✅ | Native function integration |\n| **Data Structures** | | |\n| Arrays | ✅ | Array creation, indexing, assignment |\n| Array methods | ✅ | length, get, push, pop, contains, slice, concat, join |\n| Array boolean methods | ✅ | any, all operations |\n| Array spread syntax | ✅ | [..array1, ..array2] syntax |\n| Array slice operations | ✅ | arr[start:end], arr[start:], arr[:end] syntax |\n| Array augmented assignment | ✅ | arr[i] += value, arr[i] *= value syntax |\n| Tuples | ✅ | Tuple creation, access, destructuring |\n| Structs | ✅ | Custom data types with methods |\n| Mutable struct fields | ✅ | Field mutation support |\n| Nested struct references | ✅ | Reference semantics for nested structures |\n| Record update syntax | ✅ | { ..record, field: new_value } syntax |\n| Map literals | ✅ | { \"key\": value } syntax for map creation |\n| **Pattern Matching** | | |\n| Basic patterns | ✅ | Constants, variables, wildcards |\n| Tuple patterns | ✅ | Destructuring tuples |\n| Array patterns | ✅ | Array destructuring |\n| Record patterns | ✅ | Struct field matching |\n| Range patterns | ✅ | Range expressions (_..\u003cx, 'a'..='z') |\n| Constructor patterns | ✅ | Constant constructor matching |\n| Or patterns | ✅ | Multiple pattern alternatives |\n| Nested patterns | ✅ | Complex nested pattern matching |\n| **Enums and Generics** | | |\n| Basic enums | ✅ | Simple enumeration types |\n| Enums with data | ✅ | Algebraic data types |\n| Enum pattern matching | ✅ | Pattern matching on enum variants |\n| Generic types | ✅ | Generic enums and functions |\n| Generic functions | ✅ | Polymorphic function definitions |\n| **Option Type** | | |\n| Option basics | ✅ | Some/None construction |\n| Option pattern matching | ✅ | Pattern matching on Option |\n| Option methods | ✅ | unwrap, unwrap_or, is_empty, map, filter |\n| **Built-in Methods** | | |\n| Bool methods | ✅ | compare, default |\n| Int methods | ✅ | Bitwise ops, comparisons, bit manipulation |\n| String methods | ✅ | length, get, unsafe_get, to_string |\n| Double methods | ✅ | compare, to_int64 |\n| Char methods | ✅ | compare, to_int |\n| **Advanced Features** | | |\n| Type system | ✅ | Basic type checking and inference |\n| Static method calls | ✅ | Class::method() syntax |\n| Pipe operator | ✅ | \\|\u003e operator for function chaining |\n| Function aliases | ✅ | Alias support (e.g., not for %bool_not) |\n| Cross-package method calls | ✅ | Method calls across different packages |\n| Error handling | ✅ | Result type error handling |\n| Group expressions | ✅ | Parenthesized expressions for precedence |\n| For-in loops | ✅ | Iterator-based loops |\n| Iterator methods | ✅ | iter, map, filter, reduce, for_each |\n| Nested iteration | ✅ | Complex nested loop structures |\n| Iterator control flow | ✅ | break/continue in iterator contexts |\n| **Package System** | | |\n| Module imports | ✅ | @package.function syntax |\n| Cross-package types | ✅ | Using types from other packages |\n| Built-in packages | ✅ | @int, @math, @bigint, @cmp, @list support |\n| Package method calling | ✅ | Method calls across package boundaries |\n| **IO and FFI** | | |\n| Print functions | ✅ | println and print support |\n| Embedded functions | ✅ | Native function integration via FFI |\n| External function binding | ✅ | Custom function registration |\n| **Sorting and Collections** | | |\n| List sorting | ✅ | Built-in sort methods for collections |\n| Array sorting | ✅ | Sorting operations on arrays |\n| Collection methods | ✅ | Comprehensive collection manipulation |\n| **Comparison Operations** | | |\n| Equality operators | ✅ | == and != operators |\n| Relational operators | ✅ | \u003c, \u003e, \u003c=, \u003e= operators |\n| Type-aware comparison | ✅ | Proper type checking in comparisons |\n| **Constructor Patterns** | | |\n| Single argument matching | ✅ | Constructor pattern with single args |\n| Named field matching | ✅ | Constructor patterns with named fields |\n| Wildcard patterns | ✅ | _ patterns in constructor matching |\n| **Functional Programming** | | |\n| Higher-order functions | ✅ | Functions as first-class values |\n| Function composition | ✅ | Combining functions effectively |\n| Closure environments | ✅ | Proper variable capture in closures |\n| **Literal Overloading** | | |\n| Numeric literal overloading | ✅ | Automatic conversion between numeric types |\n| Character literal overloading | ✅ | Char to Int conversion in pattern matching |\n| String literal overloading | ✅ | String to Bytes conversion |\n| Array literal overloading | ✅ | Array to various types (Bytes, String) conversion |\n| Double literal overloading | ✅ | Double to Float precision conversion |\n| Map literal overloading | ✅ | Map to Json object conversion |\n| Complex overloading scenarios | ✅ | Multi-step type conversions |\n| Traits | 🟡 | Interface definitions |\n| Trait as expressions | 🟡 | (value as Trait) syntax for trait casting |\n| Packages | 🟡 | Module system with @package.function syntax (no trait, trait derive, operator overloading) |\n| **Attribute** | | |\n| #alias | ✅ | Function alias |\n| #external | ❌ | External function binding |\n| #callsite | ❌ | Call site information |\n| #skip | ❌ | Skipping compilation of a function |\n| #cfg | ❌ | Conditional compilation based on configuration |\n| **Not Yet Supported** | | |\n| Async/await | ❌ | Asynchronous programming |\n\n## Contributing\n\nWe welcome contributions to the MoonBit Eval project! Whether it's bug fixes, feature additions, or documentation improvements, your contributions are valuable.\n\n## Community\n\nJoin our community for discussions and support:\n- QQ Group: **949886784**\n\n![QQ 群](qrcode.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foboard%2Fmoonbit-eval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foboard%2Fmoonbit-eval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foboard%2Fmoonbit-eval/lists"}