{"id":22494801,"url":"https://github.com/szilu/symbion-expr","last_synced_at":"2025-09-08T18:41:40.818Z","repository":{"id":45631538,"uuid":"119297881","full_name":"szilu/symbion-expr","owner":"szilu","description":"Javascript expression parser/evaluator/solver library","archived":false,"fork":false,"pushed_at":"2020-05-14T22:59:35.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T16:56:44.698Z","etag":null,"topics":["expression","expression-evaluator","expression-parser","expression-tree","grammar-rules","lexical-analyzer"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/szilu.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}},"created_at":"2018-01-28T21:07:28.000Z","updated_at":"2022-07-14T11:49:20.000Z","dependencies_parsed_at":"2022-09-06T01:11:36.360Z","dependency_job_id":null,"html_url":"https://github.com/szilu/symbion-expr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/szilu/symbion-expr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szilu%2Fsymbion-expr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szilu%2Fsymbion-expr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szilu%2Fsymbion-expr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szilu%2Fsymbion-expr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szilu","download_url":"https://codeload.github.com/szilu/symbion-expr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szilu%2Fsymbion-expr/sbom","scorecard":{"id":864300,"data":{"date":"2025-08-11","repo":{"name":"github.com/szilu/symbion-expr","commit":"bc6f5e6f43e012158df65e833175edee3cd0bbf1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T02:14:48.324Z","repository_id":45631538,"created_at":"2025-08-24T02:14:48.324Z","updated_at":"2025-08-24T02:14:48.324Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274229381,"owners_count":25245189,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["expression","expression-evaluator","expression-parser","expression-tree","grammar-rules","lexical-analyzer"],"created_at":"2024-12-06T19:17:44.045Z","updated_at":"2025-09-08T18:41:40.794Z","avatar_url":"https://github.com/szilu.png","language":"JavaScript","readme":"JavaScript Expression Parser\n============================\n\nDescription\n-----------\nThis small JavaScript library parses, evaluates expressions and transpiles them to JavaScript functions. It's very flexible, you can define your own grammar with your own types. For example there is an example grammar which handles **big.js** numeric type (grammar/bigjs).\n\nIt is also able to solve simple expressions (if the target variable is contained only once and all the operations are invertable).\n\nInstallation\n------------\nNPM:\n\n    npm install symbion-expr\n\nYARN:\n\n    yarn add symbion-expr\n\nBasic usage\n-----------\nLoad a grammar file. The module contains two example files. These are incomplete grammars for testing purposes, so DO NOT use them in production, but you can experiment with them and Use them as a template.\n```js\n\u003e const SMP = require('symbion-expr/grammar/simple')\n```\n\nParse an expression:\n```js\n\u003e let ast = SMP.parser.parse('1+2+3')\n```\n\nYou can regenerate the expression from the AST:\n```js\n\u003e SMP.evaluator.expression(ast)\n'1+2+3'\n```\n\n```js\n\u003e SMP.evaluator.eval(ast)\n6\n```\n\nUse variables:\n```js\n\u003e let ast2 = SMP.parser.parse('3*x+5')\n\u003e SMP.evaluator.eval(ast2, {x: 3})\n14\n```\n\nYou can even solve simple expressions:\n```js\n\u003e let inv = SMP.evaluator.invert('x', ast2, 'r')\n\u003e SMP.evaluator.expression(inv)\n'(r-5)/3'\n\u003e SMP.evaluator.eval(inv, {r: 14})\n3\n```\n\nLexical analyzer\n----------------\n\nThe lexical analyzer parses a text into a stream of tokens.\n\n```js\n\u003e const { Lexer } = require('symbion-expr')\n\u003e let lex = new Lexer('1+2')\n\n\u003e lex.next()\n{ type: Symbol(number), value: '1', pos: [ 1, 1 ], ws: '' }\n\u003e lex.next()\n{ type: Symbol(operator), value: '+', pos: [ 1, 2 ], ws: '' }\n\u003e lex.next()\n{ type: Symbol(number), value: '2', pos: [ 1, 3 ], ws: '' }\n```\n\nThe lexer is based on character classes, you can define the grammar like this:\n \n```js\nconst lexerGrammar = {\n    operChars: '+-*/^.:%|!?#\u0026\u003c\u003e=',\n    wordStartChars: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$',\n    wordChars: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$',\n    charTokens: '.,:;()[]{}',\n    lParens: '([{',\n    rParens: ')]}',\n    quotes: '\"\\''\n}\n\nlex = new Lexer('1+2', lexerGrammar)\n```\n\nParser\n------\n\nThe expression parser is based on the [Top Down Operator Precedence parser](http://crockford.com/javascript/tdop/tdop.html) created by [Vaughan Pratt](http://boole.stanford.edu/pratt.html) and [Douglas Crockford](http://www.crockford.com/).\n\nThe parser generates an AST for the expression.\n\n**FIXME**: The API is not stable yet, so the Parser is not documented, but you can look at the sample grammar files in the *grammar/* directory.\n\nEval\n----\n\nTODO\n----\n* [ ] type system\n* [ ] function call parser\n\nTest\n----\n\n* `cd` to the project directory\n* Install dev. dependencies\n    * `yarn/npm install`\n* Run tests\n    * `yarn/npm run lint`\n    * `yarn/npm run test`\n    * `yarn/npm run test-cover`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszilu%2Fsymbion-expr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszilu%2Fsymbion-expr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszilu%2Fsymbion-expr/lists"}