{"id":16967895,"url":"https://github.com/skyf0l/funevalexpr","last_synced_at":"2025-03-21T18:18:31.971Z","repository":{"id":134742726,"uuid":"381404429","full_name":"skyf0l/funEvalExpr","owner":"skyf0l","description":"Epitech - An expression evaluation in Haskell","archived":false,"fork":false,"pushed_at":"2022-03-04T14:49:28.000Z","size":366,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T13:11:51.252Z","etag":null,"topics":["ast","combinatory-parsers","haskell","interpreter","math","parser"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skyf0l.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}},"created_at":"2021-06-29T15:00:59.000Z","updated_at":"2024-09-10T21:19:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfec48fb-37b1-4495-bd1a-e2f7af9275c3","html_url":"https://github.com/skyf0l/funEvalExpr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FfunEvalExpr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FfunEvalExpr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FfunEvalExpr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyf0l%2FfunEvalExpr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyf0l","download_url":"https://codeload.github.com/skyf0l/funEvalExpr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244844531,"owners_count":20519790,"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":["ast","combinatory-parsers","haskell","interpreter","math","parser"],"created_at":"2024-10-14T00:10:08.838Z","updated_at":"2025-03-21T18:18:31.946Z","avatar_url":"https://github.com/skyf0l.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Epitech project - funEvalExpr\n\nAn expression evaluator written in [Haskell](https://www.haskell.org/).\n\n## Goal\n\nImplement a program which is able to parse a string given as argument, evaluate it and display the result.\n\n## Must\n\n- Handle float numbers ans parentheses.\n- Handle addition, subtraction, multiplication, division and power operators (+ - \\* / ^).\n- The output must always have two digits after the decimal points (examples: 1.00, 3.14).\n- Implement a recursive descent parser with combinators, following a Parsing Expression Grammar (PEG).\n\n# Example\n\nBuild with make and stack:\n\n```\n$ make\nor\n$ stack build --copy-bins\n```\n\nAnd run with:\n\n```bash\n$ ./funEvalExpr \"3 + 5.34\"\n8.34\n$ ./funEvalExpr \"(0.345+5)*(-2-1)/3\"\n-5.35\n```\n\n# Features\n\n## Operands format\n\n```regex\n(?:\\d+)|(?:\\d*\\.?\\d*)\n```\n\nValid operands can be:\n- `42`\n- `42.42`\n- `42.`\n- `.42`\n- `.`\n\n## Operators\n\n### Binary Operators\n\n| Operator | Aka | Precedence | Description               |\n| -------- | --- | ---------- | ------------------------- |\n| e        | Exp | 120        | Scientific exponentiation |\n| ^        | Pow | 120        | Exponentiation            |\n| \\*       | Mul | 100        | Multiplication            |\n| /        | Div | 100        | Division                  |\n| %        | Mod | 100        | Modulo                    |\n| +        | Add | 95         | Addition                  |\n| -        | Sub | 95         | Subtraction               |\n| \u003e        | Gt  | 80         | Greater than              |\n| \u003c        | Lt  | 80         | Less than                 |\n| \u003e=       | Ge  | 80         | Greater than or equal to  |\n| \u003c=       | Le  | 80         | Less than or equal to     |\n| ==       | Eq  | 80         | Equal to                  |\n| !=       | Ne  | 80         | Not equal to              |\n| \u0026\u0026       | And | 75         | Logical AND               |\n| \\|\\|     | Or  | 70         | Logical OR                |\n\n### Unary operators\n\n| Operator | Aka | Description      |\n| -------- | --- | ---------------- |\n| +        | Pos | Identity         |\n| -        | Neg | Negation         |\n| !        | Not | Logical negation |\n\n## Debug\n\nWith `-d` option, the program will print the AST of the expression.\n\n```\n$ ./funEvalExpr -d \"(0.345+5)*(-2-1)/3\"\nDiv(\n    Mul(\n        Add(\n            0.345,\n            5.0\n        ),\n        Sub(\n            Neg(\n                2.0\n            ),\n            1.0\n        )\n    ),\n    3.0\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyf0l%2Ffunevalexpr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyf0l%2Ffunevalexpr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyf0l%2Ffunevalexpr/lists"}