{"id":13662365,"url":"https://github.com/codewriter-packages/Expression-Parser","last_synced_at":"2025-04-25T10:31:02.692Z","repository":{"id":41200585,"uuid":"377420534","full_name":"codewriter-packages/Expression-Parser","owner":"codewriter-packages","description":"Simple math expression parser library for Unity","archived":false,"fork":false,"pushed_at":"2023-05-29T17:10:09.000Z","size":87,"stargazers_count":48,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-09T20:05:50.883Z","etag":null,"topics":["c-sharp","calculus","expression-evaluator","formula-parser","gamedev","math-parser","mathematical-expression-parser","mathematical-expressions-evaluator","unity","unity3d"],"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/codewriter-packages.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}},"created_at":"2021-06-16T08:11:31.000Z","updated_at":"2024-09-04T07:27:35.000Z","dependencies_parsed_at":"2024-01-26T19:56:42.800Z","dependency_job_id":null,"html_url":"https://github.com/codewriter-packages/Expression-Parser","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewriter-packages%2FExpression-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewriter-packages%2FExpression-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewriter-packages%2FExpression-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewriter-packages%2FExpression-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewriter-packages","download_url":"https://codeload.github.com/codewriter-packages/Expression-Parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223996554,"owners_count":17238327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["c-sharp","calculus","expression-evaluator","formula-parser","gamedev","math-parser","mathematical-expression-parser","mathematical-expressions-evaluator","unity","unity3d"],"created_at":"2024-08-02T05:01:56.619Z","updated_at":"2024-11-10T18:30:16.397Z","avatar_url":"https://github.com/codewriter-packages.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# Expression Parser [![Github license](https://img.shields.io/github/license/codewriter-packages/Expression-Parser.svg?style=flat-square)](#) [![Unity 2020.1](https://img.shields.io/badge/Unity-2020.1+-2296F3.svg?style=flat-square)](#) ![GitHub package.json version](https://img.shields.io/github/package-json/v/codewriter-packages/Expression-Parser?style=flat-square)\n_Simple expression parser library for unity_\n\n## Quick Sample\n\n```csharp\n// create context\nvar context = new ExpresionContext\u003cfloat\u003e();\n\n// register some variables\ncontext.RegisterVariable(\"a\", () =\u003e 1);\ncontext.RegisterVariable(\"b\", () =\u003e 2);\ncontext.RegisterVariable(\"c\", () =\u003e 3);\n\nvar input = \"a \u003e= b AND NOT(b) OR (a + b) \u003e= c\";\n\n// compile expression\nvar compiledExpr = FloatExpressionParser.Instance.Compile(input, context, true);\n\n// execute expression\nvar result = compiledExpr.Invoke();\n\n```\n\nCreate your own `ExpressionParser` implementation to support other data types\n\n## Language Overview\n\n#### Constants\n\n| Input | Value |\n| ----- | ----- |\n| TRUE  | 1     |\n| FALSE | 0     |\n\n#### Numbers\n\n| Input | Value |\n| ----- | ----- |\n| 123   | 123.0 |\n| 123.0 | 123.0 |\n| 123.4 | 123.4 |\n\n#### Operators\n\n| Name        | Sample | Precedence |\n| ----------- | ------ | ---------- |\n| Unary Minus | -2     | 0  |\n| Power       | 2 ^ 3  | 1 (!!!, -2^2 = (-2) ^ 2 = 4)  |\n| Multiply    | 2 * 3  | 2  |\n| Divide      | 6 / 3  | 2  |\n| Module      | 5 % 3  | 2  |\n| Addition    | 2 + 3  | 3  |\n| Subtraction | 3 - 2  | 3  |\n| Less Than   | 2 \u003c 3  | 4  |\n| Less Than Or Equal | 2 \u003c= 3 | 4 |\n| Greater Than | 2 \u003e 3  | 4  |\n| Greater Than Or Equal | 2 \u003e= 3 | 4 |\n| Equality    | 2 = 3  | 5  |\n| Inequality  | 2 != 3 | 5  |\n| Logical and | 2 \u003e 1 AND 3 \u003e 2 | 6 |\n| Logical or | 2 = 3 OR 2 != 4 | 6 |\n\n#### Variables\n\nCreation of custom variables is supported.\nVariable name must starts with english letter or underscore.\nThe rest of the variable name may also contains digits.\n\n#### Functions\n\n| Name | Sample    | Description |\n| ---- | --------- | ----------- |\n| NOT  | NOT(TRUE) | Returns FALSE if argument is true, otherwise TRUE |\n| IF   | IF(n \u003c 5, 5, n \u003c 25, 25, 50) | Returns the second argument if the first argument is true, returns the fourth argument if the third argument is true, and so on. Otherwise, returns the last argument. Odd number of arguments required   |\n| MIN  | MIN(0, 1, ...) | Returns smallest argument |\n| MAX  | MAX(0, 1, ...) | Returns largest argument |\n| ROUND   | ROUND(1.1) | Rounds a number |\n| CEILING | CEILING(1.1) | Round number up |\n| FLOOR   | FLOOR(1.1) | Rounds number down |\n| LOG | LOG(8, 2) | Returns the logarithm to base B of number A |\n\n## How to Install\nMinimal Unity Version is 2020.1.\n\nLibrary distributed as git package ([How to install package from git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html))\n\u003cbr\u003eGit URL: `https://github.com/codewriter-packages/Expression-Parser.git`\n\n## License\n\nExpression-Parser is [MIT licensed](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewriter-packages%2FExpression-Parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewriter-packages%2FExpression-Parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewriter-packages%2FExpression-Parser/lists"}