{"id":37057937,"url":"https://github.com/simulation-tree/expression-machine","last_synced_at":"2026-01-14T06:33:11.842Z","repository":{"id":287406319,"uuid":"801986537","full_name":"simulation-tree/expression-machine","owner":"simulation-tree","description":"Mathmetical expression interpreter","archived":false,"fork":false,"pushed_at":"2025-09-24T03:03:22.000Z","size":72,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T05:18:29.861Z","etag":null,"topics":["csharp","dotnet","expressions","interpreter","scripting"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simulation-tree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-05-17T09:45:59.000Z","updated_at":"2025-09-24T03:00:21.000Z","dependencies_parsed_at":"2025-04-11T15:32:46.535Z","dependency_job_id":"f6e2e303-13f4-473c-98d1-73d705b3b98d","html_url":"https://github.com/simulation-tree/expression-machine","commit_stats":null,"previous_names":["simulation-tree/expression-machine"],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/simulation-tree/expression-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fexpression-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fexpression-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fexpression-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fexpression-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simulation-tree","download_url":"https://codeload.github.com/simulation-tree/expression-machine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fexpression-machine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["csharp","dotnet","expressions","interpreter","scripting"],"created_at":"2026-01-14T06:33:11.258Z","updated_at":"2026-01-14T06:33:11.836Z","avatar_url":"https://github.com/simulation-tree.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Expression Machine\n\n[![Test](https://github.com/simulation-tree/expression-machine/actions/workflows/test.yml/badge.svg)](https://github.com/simulation-tree/expression-machine/actions/workflows/test.yml)\n\nLibrary for evaluating logic expressions at runtime.\n\n### Features\n\n- Basic arithmetic operations (addition, subtraction, multiplication, division)\n- Parentheses for grouping operations\n- Injectable `float` variables\n- Injectable functions accepting one or no input arguments\n\n### Example\n\nBelow is an example that fills a destination span with coordinates for the points of a circle,\nwith either a radius or a diameter as input. While reusing the same machine instance by modifying\nits source and variables, and re-evaluating the expression.\n```cs\npublic void GetCirclePositions(float radius, Span\u003cVector2\u003e positions)\n{\n    using Machine vm = new();\n    vm.SetVariable(\"value\", value);\n    vm.SetFunction(\"cos\", MathF.Cos);\n    vm.SetFunction(\"sin\", MathF.Sin);\n\n    int length = positions.Length;\n    for (int i = 0; i \u003c length; i++)\n    {\n        float t = i * MathF.PI / (length * 0.5f);\n        vm.SetVariable(\"t\", t);\n        vm.SetSource(\"cos(t) * radius\");\n        float x = vm.Evaluate();    \n        vm.SetSource(\"sin(t) * radius\");\n        float y = vm.Evaluate();\n        positions[i] = new Vector2(x, y);\n    }\n}\n```\n\n### Checking for compilation issues\n\nWhen a text source is assigned to the machine, it returns a compilation result.\nThis result value can be used to check if there were issues. And can do so with the try-do pattern:\n```cs\nif (vm.TrySetSource(\"5 +\", out Exception? exception))\n{\n    //success\n}\nelse\n{\n    //error\n    throw exception;\n}\n```\n\n### Contributions and direction\n\nThis library is small and isn't mean to substitute things like Lua or other languages within interpreters.\nInstead, it's more fitting as a base to extend upon and branch away. And it should remain as unmanaged as it is.\nWithout extending it, it's most useful fruit is allowing your code to express different values, all through a\nsingle C# variable via different expressions.\n\nContributions that align with this are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Fexpression-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimulation-tree%2Fexpression-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Fexpression-machine/lists"}